init
This commit is contained in:
73
modules/EmailTemplates/AttachFiles.php
Executable file
73
modules/EmailTemplates/AttachFiles.php
Executable 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".
|
||||
********************************************************************************/
|
||||
//Request object must have these property values:
|
||||
// Module: module name, this module should have a file called TreeData.php
|
||||
// Function: name of the function to be called in TreeData.php, the function will be called statically.
|
||||
// PARAM prefixed properties: array of these property/values will be passed to the function as parameter.
|
||||
|
||||
|
||||
require_once('include/JSON.php');
|
||||
require_once('include/upload_file.php');
|
||||
|
||||
$GLOBALS['log']->debug(print_r($_FILES, true));
|
||||
$file_ext_allow = FALSE;
|
||||
|
||||
if (!is_dir($GLOBALS['sugar_config']['cache_dir'].'images/'))
|
||||
mkdir_recursive($GLOBALS['sugar_config']['cache_dir'].'images/');
|
||||
|
||||
// cn: bug 11012 - fixed some MIME types not getting picked up. Also changed array iterator.
|
||||
$imgType = array('image/gif', 'image/png', 'image/x-png', 'image/bmp', 'image/jpeg', 'image/jpg', 'image/pjpeg');
|
||||
|
||||
$ret = array();
|
||||
|
||||
foreach($_FILES as $k => $file) {
|
||||
if(in_array(strtolower($_FILES[$k]['type']), $imgType)) {
|
||||
$dest = $GLOBALS['sugar_config']['cache_dir'].'images/'.$_FILES[$k]['name'];
|
||||
if(is_uploaded_file($_FILES[$k]['tmp_name'])) {
|
||||
move_uploaded_file($_FILES[$k]['tmp_name'], $dest);
|
||||
$ret[] = $dest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($ret)) {
|
||||
$json = getJSONobj();
|
||||
echo $json->encode($ret);
|
||||
//return the parameters
|
||||
}
|
||||
|
||||
?>
|
||||
73
modules/EmailTemplates/CheckDeletable.php
Executable file
73
modules/EmailTemplates/CheckDeletable.php
Executable 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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/EmailTemplates/EmailTemplate.php');
|
||||
|
||||
$focus = new EmailTemplate();
|
||||
if($_REQUEST['from'] == 'DetailView') {
|
||||
if(!isset($_REQUEST['record']))
|
||||
sugar_die("A record number must be specified to delete the template.");
|
||||
$focus->retrieve($_REQUEST['record']);
|
||||
if($focus->is_used_by_email_marketing()) {
|
||||
echo 'true';
|
||||
return;
|
||||
}
|
||||
echo 'false';
|
||||
} else if($_REQUEST['from'] == 'ListView') {
|
||||
$returnString = '';
|
||||
$idArray = explode(',', $_REQUEST['records']);
|
||||
foreach($idArray as $key => $value) {
|
||||
if($focus->retrieve($value)) {
|
||||
if($focus->is_used_by_email_marketing()) {
|
||||
$returnString .= $focus->name . ',';
|
||||
}
|
||||
}
|
||||
}
|
||||
$returnString = substr($returnString, 0, -1);
|
||||
echo $returnString;
|
||||
} else {
|
||||
echo '';
|
||||
}
|
||||
|
||||
?>
|
||||
61
modules/EmailTemplates/Delete.php
Executable file
61
modules/EmailTemplates/Delete.php
Executable file
@@ -0,0 +1,61 @@
|
||||
<?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 EmailTemplate();
|
||||
|
||||
if(!isset($_REQUEST['record']))
|
||||
sugar_die("A record number must be specified to delete the template.");
|
||||
$focus->retrieve($_REQUEST['record']);
|
||||
if(!$focus->ACLAccess('Delete')) {
|
||||
ACLController::displayNoAccess(true);
|
||||
sugar_cleanup(true);
|
||||
}
|
||||
$focus->mark_deleted($_REQUEST['record']);
|
||||
|
||||
header("Location: index.php?module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']."&record=".$_REQUEST['return_id']);
|
||||
?>
|
||||
124
modules/EmailTemplates/DetailView.html
Executable file
124
modules/EmailTemplates/DetailView.html
Executable file
@@ -0,0 +1,124 @@
|
||||
<!--
|
||||
/*********************************************************************************
|
||||
* 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 -->
|
||||
<form action="index.php" method="post" name="form" id="form">
|
||||
<table cellpadding="0" cellspacing="0" border="0" width='100%'>
|
||||
<input type="hidden" name="module" value="EmailTemplates">
|
||||
<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">
|
||||
{PORTAL_ON}
|
||||
<tr>
|
||||
<td><!-- BEGIN: edit --><input title="{APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{APP.LBL_EDIT_BUTTON_KEY}" class="button primary" onclick="this.form.return_module.value='EmailTemplates'; this.form.return_action.value='DetailView'; this.form.return_id.value='{ID}'; this.form.action.value='EditView'" type="submit" name="button" value=" {APP.LBL_EDIT_BUTTON_LABEL} "> <input title="{APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value='EmailTemplates'; this.form.return_action.value='index'; this.form.isDuplicate.value=true; this.form.action.value='EditView'" type="submit" name="button" value=" {APP.LBL_DUPLICATE_BUTTON_LABEL} "><!-- END: edit --> <input title="{APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{APP.LBL_DELETE_BUTTON_KEY}" class="button" onclick="check_deletable_EmailTemplate();" type="button" name="button" value=" {APP.LBL_DELETE_BUTTON_LABEL} "></td>
|
||||
<td align='right'>{ADMIN_EDIT}</td>
|
||||
</tr></table>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="detail view">
|
||||
<table width="100%" border="0" cellspacing="{GRIDLINE}" cellpadding="0">
|
||||
{PAGINATION}
|
||||
|
||||
<tr>
|
||||
<td scope="row" width='15%'><slot>{MOD.LBL_NAME}</slot></td>
|
||||
<td><slot>{NAME} </slot></td>
|
||||
<td scope="row"><slot>{APP.LBL_DATE_MODIFIED}</slot></td>
|
||||
<td><slot>{DATE_MODIFIED} {APP.LBL_BY} {MODIFIED_BY} </slot></td>
|
||||
<!--
|
||||
<td><slot>{MOD.LBL_PUBLISH}</slot></td>
|
||||
<td><slot><input type="checkbox" name="published" disabled {PUBLISHED}></slot></td>
|
||||
-->
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row" width='15%'><slot>{MOD.LBL_DESCRIPTION}</slot></td>
|
||||
<td><slot>{DESCRIPTION} </slot></td>
|
||||
<td scope="row"><slot>{APP.LBL_DATE_ENTERED}</slot></td>
|
||||
<td><slot>{DATE_ENTERED} {APP.LBL_BY} {CREATED_BY} </slot></td>
|
||||
</tr>
|
||||
<!--
|
||||
<tr>
|
||||
<td scope="row" valign="top"><slot></slot></td>
|
||||
<td><slot></slot></td>
|
||||
</tr>
|
||||
-->
|
||||
<tr>
|
||||
<td scope="row" valign="top"><slot>{MOD.LBL_SUBJECT}</slot></td>
|
||||
<td><slot>{SUBJECT} </slot></td>
|
||||
<td scope="row" valign="top">
|
||||
</td>
|
||||
<td><slot>{TEAM} </slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row" width='15%'><slot>{MOD.LBL_SEND_AS_TEXT}</slot></td>
|
||||
<td><slot><input id='text_only' type="checkbox" disabled="disabled" {TEXT_ONLY_CHECKED} /></slot></td>
|
||||
<td scope="row"><slot> </slot></td>
|
||||
<td><slot> </slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row" valign="top"><slot>{MOD.LBL_BODY}</slot></td>
|
||||
<td colspan="3" style="background-color: #ffffff;" ><slot><div id="html_div" style="background-color: #ffffff;padding: 5px">{BODY_HTML}</div>
|
||||
<input id='toggle_textarea_elem' onchange="toggle_textarea(this);" type="checkbox" name="toggle_html" {ALT_CHECKED}/> {MOD.LBL_SHOW_ALT_TEXT}<br>
|
||||
<div id="text_div" style="display: none;background-color: #ffffff;padding: 5px"><pre>{BODY}</pre></div></slot>
|
||||
<script>
|
||||
function toggle_textarea(obj)
|
||||
{
|
||||
if(obj.checked == true)
|
||||
{
|
||||
document.getElementById('text_div').style.display = 'block';
|
||||
} else
|
||||
{
|
||||
document.getElementById('text_div').style.display = 'none';
|
||||
}
|
||||
}
|
||||
toggle_textarea( document.getElementById('toggle_textarea_elem'));
|
||||
</script>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row" valign="top"><slot>{MOD.LBL_ATTACHMENTS}</td>
|
||||
<td colspan="3"><slot>{ATTACHMENTS} </slot></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!-- END: main -->
|
||||
182
modules/EmailTemplates/DetailView.php
Executable file
182
modules/EmailTemplates/DetailView.php
Executable file
@@ -0,0 +1,182 @@
|
||||
<?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/upload_file.php');
|
||||
require_once('include/DetailView/DetailView.php');
|
||||
|
||||
//Old DetailView compares wrong session variable against new view.list. Need to sync so that
|
||||
//the pagination on the DetailView page will show.
|
||||
if(isset($_SESSION['EMAILTEMPLATE_FROM_LIST_VIEW']))
|
||||
$_SESSION['EMAIL_TEMPLATE_FROM_LIST_VIEW'] = $_SESSION['EMAILTEMPLATE_FROM_LIST_VIEW'];
|
||||
|
||||
global $app_strings;
|
||||
global $mod_strings;
|
||||
|
||||
$focus = new EmailTemplate();
|
||||
|
||||
$detailView = new DetailView();
|
||||
$offset=0;
|
||||
if(isset($_REQUEST['offset']) or isset($_REQUEST['record'])) {
|
||||
$result = $detailView->processSugarBean("EMAIL_TEMPLATE", $focus, $offset);
|
||||
if($result == null) {
|
||||
sugar_die($app_strings['ERROR_NO_RECORD']);
|
||||
}
|
||||
$focus=$result;
|
||||
} else {
|
||||
header("Location: index.php?module=Accounts&action=index");
|
||||
}
|
||||
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
|
||||
$focus->id = "";
|
||||
}
|
||||
|
||||
//needed when creating a new note with default values passed in
|
||||
if(isset($_REQUEST['contact_name']) && is_null($focus->contact_name)) {
|
||||
$focus->contact_name = $_REQUEST['contact_name'];
|
||||
}
|
||||
if(isset($_REQUEST['contact_id']) && is_null($focus->contact_id)) {
|
||||
$focus->contact_id = $_REQUEST['contact_id'];
|
||||
}
|
||||
if(isset($_REQUEST['opportunity_name']) && is_null($focus->parent_name)) {
|
||||
$focus->parent_name = $_REQUEST['opportunity_name'];
|
||||
}
|
||||
if(isset($_REQUEST['opportunity_id']) && is_null($focus->parent_id)) {
|
||||
$focus->parent_id = $_REQUEST['opportunity_id'];
|
||||
}
|
||||
if(isset($_REQUEST['account_name']) && is_null($focus->parent_name)) {
|
||||
$focus->parent_name = $_REQUEST['account_name'];
|
||||
}
|
||||
if(isset($_REQUEST['account_id']) && is_null($focus->parent_id)) {
|
||||
$focus->parent_id = $_REQUEST['account_id'];
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params[] = "<a href='index.php?module={$focus->module_dir}&action=index'>{$GLOBALS['app_list_strings']['moduleList'][$focus->module_dir]}</a>";
|
||||
$params[] = $focus->name;
|
||||
|
||||
echo getClassicModuleTitle($focus->module_dir, $params, true);
|
||||
|
||||
|
||||
$GLOBALS['log']->info("EmailTemplate detail view");
|
||||
|
||||
$xtpl=new XTemplate ('modules/EmailTemplates/DetailView.html');
|
||||
$xtpl->assign("MOD", $mod_strings);
|
||||
$xtpl->assign("APP", $app_strings);
|
||||
|
||||
if(isset($_REQUEST['return_module'])) $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
|
||||
if(isset($_REQUEST['return_action'])) $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
|
||||
if(isset($_REQUEST['return_id'])) $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
|
||||
$xtpl->assign("GRIDLINE", $gridline);
|
||||
$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
|
||||
$xtpl->assign("ID", $focus->id);
|
||||
$xtpl->assign("CREATED_BY", $focus->created_by_name);
|
||||
$xtpl->assign("MODIFIED_BY", $focus->modified_by_name);
|
||||
//if text only is set to true, then make sure input is checked and value set to 1
|
||||
if(isset($focus->text_only) && $focus->text_only){
|
||||
$xtpl->assign("TEXT_ONLY_CHECKED","CHECKED");
|
||||
}
|
||||
$xtpl->assign("NAME", $focus->name);
|
||||
$xtpl->assign("DESCRIPTION", $focus->description);
|
||||
$xtpl->assign("SUBJECT", $focus->subject);
|
||||
$xtpl->assign("BODY", $focus->body);
|
||||
$xtpl->assign("BODY_HTML", from_html($focus->body_html));
|
||||
$xtpl->assign("DATE_MODIFIED", $focus->date_modified);
|
||||
$xtpl->assign("DATE_ENTERED", $focus->date_entered);
|
||||
|
||||
|
||||
if(ACLController::checkAccess('EmailTemplates', 'edit', true)) {
|
||||
$xtpl->parse("main.edit");
|
||||
//$xtpl->out("EDIT");
|
||||
|
||||
}
|
||||
if(!empty($focus->body)) {
|
||||
$xtpl->assign('ALT_CHECKED', 'CHECKED');
|
||||
}
|
||||
else
|
||||
$xtpl->assign('ALT_CHECKED', '');
|
||||
if( $focus->published == 'on')
|
||||
{
|
||||
$xtpl->assign("PUBLISHED","CHECKED");
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//// NOTES (attachements, etc.)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
$note = new Note();
|
||||
$where = "notes.parent_id='{$focus->id}'";
|
||||
$notes_list = $note->get_full_list("notes.name", $where,true);
|
||||
|
||||
if(! isset($notes_list)) {
|
||||
$notes_list = array();
|
||||
}
|
||||
|
||||
$attachments = '';
|
||||
for($i=0; $i<count($notes_list); $i++) {
|
||||
$the_note = $notes_list[$i];
|
||||
//$attachments .= "<a href=\"".UploadFile::get_url($the_note->filename,$the_note->id)."\" target=\"_blank\">". $the_note->filename ."</a><br>";
|
||||
$attachments .= "<a href=\"index.php?entryPoint=download&id=".$the_note->id."&type=Notes\">".$the_note->name.$the_note->description."</a><br />";
|
||||
}
|
||||
|
||||
$xtpl->assign("ATTACHMENTS", $attachments);
|
||||
|
||||
|
||||
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>");
|
||||
}
|
||||
|
||||
$xtpl->assign("DESCRIPTION", $focus->description);
|
||||
|
||||
$detailView->processListNavigation($xtpl, "EMAIL_TEMPLATE", $offset);
|
||||
// adding custom fields:
|
||||
require_once('modules/DynamicFields/templates/Files/DetailView.php');
|
||||
|
||||
|
||||
$xtpl->parse("main");
|
||||
|
||||
$xtpl->out("main");
|
||||
|
||||
?>
|
||||
250
modules/EmailTemplates/EditView.html
Executable file
250
modules/EmailTemplates/EditView.html
Executable file
@@ -0,0 +1,250 @@
|
||||
<!--
|
||||
/*********************************************************************************
|
||||
* 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" src="include/JSON.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
|
||||
<script type="text/javascript" src="include/javascript/sugar_grp1.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
|
||||
<script type="text/javascript" src="include/javascript/yui/YAHOO.js"></script>
|
||||
<script type="text/javascript" src="include/javascript/yui/connection.js"></script>
|
||||
{JSLANG}
|
||||
<script type="text/javascript" language="Javascript" src="modules/Emails/javascript/Email.js"></script>
|
||||
<script type="text/javascript" language="Javascript" src="modules/EmailTemplates/EmailTemplate.js"></script>
|
||||
<script type="text/javascript">
|
||||
{FIELD_DEFS_JS}
|
||||
</script>
|
||||
|
||||
<form name="EditView" id="EditView" method="POST" action="index.php" enctype="multipart/form-data">
|
||||
<input type="hidden" name="module" value="EmailTemplates">
|
||||
<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}">
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<input title="{APP.LBL_SAVE_BUTTON_TITLE}" accesskey="{APP.LBL_SAVE_BUTTON_KEY}" class="button primary"
|
||||
onclick=" this.form.action.value='Save';
|
||||
<!-- BEGIN: NoInbound1 -->
|
||||
addUploadFiles('EditView');
|
||||
addUploadDocs('EditView');
|
||||
<!-- END: NoInbound1 -->
|
||||
return check_form('EditView');"
|
||||
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="{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>
|
||||
<div class="edit view">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="15%" scope="row">
|
||||
{MOD.LBL_NAME}
|
||||
<span class="required">
|
||||
{APP.LBL_REQUIRED_SYMBOL}
|
||||
</span>
|
||||
</td>
|
||||
<td width="30%" >
|
||||
<input name='name' tabindex="10" type="text" size='30' maxlength="255" value="{NAME}">
|
||||
</td>
|
||||
<td width="15%" scope="row">
|
||||
</td>
|
||||
<td width="30%" >
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="15%" scope="row">
|
||||
{MOD.LBL_DESCRIPTION}
|
||||
</td>
|
||||
<td colspan="3" >
|
||||
<textarea name='description' tabindex='30' cols="90" rows="1" style="height: 1.6.em; overflow-y:auto; font-family:sans-serif,monospace; font-size:inherit;" id="subjectfield">{DESCRIPTION}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- BEGIN: NoInbound -->
|
||||
<tr>
|
||||
<td width="15%" scope="row" align='left'>
|
||||
{MOD.LBL_INSERT_VARIABLE}
|
||||
</td>
|
||||
<td width="30%" colspan="3">
|
||||
<select name='variable_module' tabindex="40" onchange="addVariables(document.EditView.variable_name,this.options[this.selectedIndex].value);">
|
||||
{DROPDOWN}
|
||||
</select>
|
||||
<select name='variable_name' tabindex="50" onchange="showVariable();">
|
||||
</select>
|
||||
<span scope="row">
|
||||
{MOD.LBL_USE}:
|
||||
</span>
|
||||
<input type="text" size="30" tabindex="60" name="variable_text" />
|
||||
<!-- BEGIN: variable_button -->
|
||||
<input type='button' tabindex="70" onclick='{INSERT_VARIABLE_ONCLICK}' class='button' value='{MOD.LBL_INSERT}'>
|
||||
<!-- END: variable_button -->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- BEGIN: tracker_url -->
|
||||
<tr>
|
||||
<td width="15%" scope="row" align='left'>
|
||||
{MOD.LBL_INSERT_TRACKER_URL}
|
||||
</td>
|
||||
<td width="85%" colspan="3" valign="top" >
|
||||
<select tabindex='75' name='tracker_url' onchange='this.form.url_text.value=this.value'>
|
||||
{TRACKER_KEY_OPTIONS}
|
||||
</select>
|
||||
<input type="text" size="30" id="url_text" name="url_text" value="{DEFAULT_URL_TEXT}" />
|
||||
<input type='button' tabindex="77" onclick='{INSERT_URL_ONCLICK}' class='button' value='{MOD.LBL_INSERT_URL_REF}'>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END: tracker_url -->
|
||||
<!-- END: NoInbound -->
|
||||
<tr>
|
||||
<td width="15%" scope="row">
|
||||
{MOD.LBL_SUBJECT}
|
||||
</td>
|
||||
<td colspan='4' >
|
||||
<textarea onblur="remember_place(this);" name='subject' tabindex='80' cols="90" rows="1" style="height: 1.6.em; overflow-y:auto; font-family:sans-serif,monospace; font-size:inherit;" id="subjectfield">{SUBJECT}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td colspan='4'>
|
||||
<input name="toggle_textonly" id="toggle_textonly" onclick="toggle_text_only();" type="checkbox" {TEXTONLY_CHECKED}/>
|
||||
<input name="text_only" id="text_only" type="hidden" value='{TEXTONLY_VALUE}'/>
|
||||
{MOD.LBL_SEND_AS_TEXT}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" scope="row">
|
||||
{MOD.LBL_BODY}
|
||||
</td>
|
||||
|
||||
<!-- BEGIN: textarea -->
|
||||
<td colspan="4" >
|
||||
<div id='body_text_div'>
|
||||
<textarea id='body_text' tabindex='90' name='body_html' cols="100" rows="20">{BODY_HTML}</textarea>
|
||||
</div>
|
||||
<br>
|
||||
<div id='toggle_textarea_option'>
|
||||
<input id='toggle_textarea_elem' onclick="toggle_textarea(this);" type="checkbox" name="toggle_html" />
|
||||
{MOD.LBL_EDIT_ALT_TEXT}
|
||||
</div>
|
||||
<br>
|
||||
<div id="text_div" style="display: none">
|
||||
<textarea tabindex='110' name='body' cols="100" rows="20" >{BODY}</textarea>
|
||||
</div>
|
||||
</td>
|
||||
<!-- END: textarea -->
|
||||
</tr>
|
||||
<!-- BEGIN: NoInbound2 -->
|
||||
<tr>
|
||||
<td valign="top" scope="row">
|
||||
{MOD.LBL_ATTACHMENTS}:
|
||||
</td>
|
||||
<td colspan="2" nowrap>
|
||||
{ATTACHMENTS_JAVASCRIPT} {ATTACHMENTS}
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END: NoInbound2 -->
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<!-- BEGIN: NoInbound3 -->
|
||||
<form id="upload_form" name="upload_form" method="POST" action='AttachDocuments.php' enctype="multipart/form-data">
|
||||
<div id="upload_div">
|
||||
<input type="file" id="my_file" name="file_1" size="40" />
|
||||
<input type="hidden" id="documentName" name="uploaddoc" onchange="docUpload(); form_reset_doc();" size="1" />
|
||||
<input type="hidden" id="documentId" name="seldoc" tabindex="0" />
|
||||
<input type="hidden" id="docRevId" name="seldoc" tabindex="0" />
|
||||
<input type="hidden" id="documentType" name="seldoc" tabindex="0" />
|
||||
<input type="button" name="add_doc" onclick="selectDoc();" value='{MOD.LBL_SUGAR_DOCUMENT}' class="button" />
|
||||
</div>
|
||||
<div id="attachments_div">
|
||||
</div>
|
||||
</form>
|
||||
<!-- END: NoInbound3 -->
|
||||
{tiny}
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!-- BEGIN: NoInbound4 -->
|
||||
var multi_selector = new multiFiles(document.getElementById('upload_div'));
|
||||
multi_selector.addElement( document.getElementById('my_file'));
|
||||
<!-- END: NoInbound4 -->
|
||||
//call the function on load, this will hide the tinyMCE editor if needed
|
||||
toggle_text_only(true);
|
||||
|
||||
function toggle_portal_flag() {
|
||||
{TOGGLE_JS}
|
||||
}
|
||||
<!-- BEGIN: NoInbound5 -->
|
||||
addVariables(document.EditView.variable_name,'{DEFAULT_MODULE}');
|
||||
<!-- END: NoInbound5 -->
|
||||
focus_obj = document.EditView.body;
|
||||
toggle_portal_flag();
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<!-- END: main -->
|
||||
326
modules/EmailTemplates/EditView.php
Executable file
326
modules/EmailTemplates/EditView.php
Executable 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: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/Campaigns/utils.php');
|
||||
|
||||
//if campaign_id is passed then we assume this is being invoked from the campaign module and in a popup.
|
||||
$has_campaign=true;
|
||||
$inboundEmail=true;
|
||||
if (!isset($_REQUEST['campaign_id']) || empty($_REQUEST['campaign_id'])) {
|
||||
$has_campaign=false;
|
||||
}
|
||||
if (!isset($_REQUEST['inboundEmail']) || empty($_REQUEST['inboundEmail'])) {
|
||||
$inboundEmail=false;
|
||||
}
|
||||
$focus = new EmailTemplate();
|
||||
|
||||
if(isset($_REQUEST['record'])) {
|
||||
$focus->retrieve($_REQUEST['record']);
|
||||
}
|
||||
|
||||
$old_id = '';
|
||||
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
|
||||
$old_id = $focus->id; // for attachments down below
|
||||
$focus->id = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
//setting default flag value so due date and time not required
|
||||
if(!isset($focus->id)) $focus->date_due_flag = 1;
|
||||
|
||||
//needed when creating a new case with default values passed in
|
||||
if(isset($_REQUEST['contact_name']) && is_null($focus->contact_name)) {
|
||||
$focus->contact_name = $_REQUEST['contact_name'];
|
||||
}
|
||||
if(isset($_REQUEST['contact_id']) && is_null($focus->contact_id)) {
|
||||
$focus->contact_id = $_REQUEST['contact_id'];
|
||||
}
|
||||
if(isset($_REQUEST['parent_name']) && is_null($focus->parent_name)) {
|
||||
$focus->parent_name = $_REQUEST['parent_name'];
|
||||
}
|
||||
if(isset($_REQUEST['parent_id']) && is_null($focus->parent_id)) {
|
||||
$focus->parent_id = $_REQUEST['parent_id'];
|
||||
}
|
||||
if(isset($_REQUEST['parent_type'])) {
|
||||
$focus->parent_type = $_REQUEST['parent_type'];
|
||||
}
|
||||
elseif(!isset($focus->parent_type)) {
|
||||
$focus->parent_type = $app_list_strings['record_type_default_key'];
|
||||
}
|
||||
if(isset($_REQUEST['filename']) && $_REQUEST['isDuplicate'] != 'true') {
|
||||
$focus->filename = $_REQUEST['filename'];
|
||||
}
|
||||
|
||||
if($has_campaign || $inboundEmail) {
|
||||
insert_popup_header($theme);
|
||||
}
|
||||
|
||||
|
||||
$params = array();
|
||||
$params[] = "<a href='index.php?module={$focus->module_dir}&action=index'>{$GLOBALS['app_list_strings']['moduleList'][$focus->module_dir]}</a>";
|
||||
if(empty($focus->id)){
|
||||
$params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL'];
|
||||
}else{
|
||||
$params[] = "<a href='index.php?module={$focus->module_dir}&action=DetailView&record={$focus->id}'>{$focus->name}</a>";
|
||||
$params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL'];
|
||||
}
|
||||
|
||||
echo getClassicModuleTitle($focus->module_dir, $params, true);
|
||||
|
||||
$GLOBALS['log']->info("EmailTemplate detail view");
|
||||
|
||||
if($has_campaign || $inboundEmail) {
|
||||
$xtpl=new XTemplate ('modules/EmailTemplates/EditView.html');
|
||||
} else {
|
||||
$xtpl=new XTemplate ('modules/EmailTemplates/EditViewMain.html');
|
||||
} // else
|
||||
$xtpl->assign("MOD", $mod_strings);
|
||||
$xtpl->assign("APP", $app_strings);
|
||||
|
||||
$xtpl->assign("LBL_ACCOUNT",$app_list_strings['moduleList']['Accounts']);
|
||||
$xtpl->parse("main.variable_option");
|
||||
|
||||
$returnAction = 'index';
|
||||
if(isset($_REQUEST['return_module'])) $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
|
||||
if(isset($_REQUEST['return_action'])){
|
||||
$xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
|
||||
$returnAction = $_REQUEST['return_action'];
|
||||
}
|
||||
if(isset($_REQUEST['return_id'])) $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
|
||||
// handle Create $module then Cancel
|
||||
if(empty($_REQUEST['return_id'])) {
|
||||
$xtpl->assign("RETURN_ACTION", 'index');
|
||||
}
|
||||
|
||||
if ($has_campaign || $inboundEmail ) {
|
||||
$cancel_script="window.close();";
|
||||
}else {
|
||||
$cancel_script="this.form.action.value='{$returnAction}'; this.form.module.value='{$_REQUEST['return_module']}';
|
||||
this.form.record.value=";
|
||||
if(empty($_REQUEST['return_id'])) {
|
||||
$cancel_script="this.form.action.value='index'; this.form.module.value='{$_REQUEST['return_module']}';this.form.name.value='';this.form.description.value=''";
|
||||
} else {
|
||||
$cancel_script.="'{$_REQUEST['return_id']}'";
|
||||
}
|
||||
}
|
||||
|
||||
$xtpl->assign("CANCEL_SCRIPT", $cancel_script);
|
||||
$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
|
||||
$xtpl->assign("JAVASCRIPT", get_set_focus_js());
|
||||
|
||||
if(!is_file($GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js')) {
|
||||
require_once('include/language/jsLanguage.php');
|
||||
jsLanguage::createAppStringsCache($GLOBALS['current_language']);
|
||||
}
|
||||
$jsLang = '<script type="text/javascript" src="' . $GLOBALS['sugar_config']['cache_dir'] . 'jsLanguage/' . $GLOBALS['current_language'] . '.js?s=' . $GLOBALS['sugar_version'] . '&c=' . $GLOBALS['sugar_config']['js_custom_version'] . '&j=' . $GLOBALS['sugar_config']['js_lang_version'] . '"></script>';
|
||||
$xtpl->assign("JSLANG", $jsLang);
|
||||
|
||||
$xtpl->assign("ID", $focus->id);
|
||||
if(isset($focus->name)) $xtpl->assign("NAME", $focus->name); else $xtpl->assign("NAME", "");
|
||||
if(isset($focus->description)) $xtpl->assign("DESCRIPTION", $focus->description); else $xtpl->assign("DESCRIPTION", "");
|
||||
if(isset($focus->subject)) $xtpl->assign("SUBJECT", $focus->subject); else $xtpl->assign("SUBJECT", "");
|
||||
if( $focus->published == 'on')
|
||||
{
|
||||
$xtpl->assign("PUBLISHED","CHECKED");
|
||||
}
|
||||
//if text only is set to true, then make sure input is checked and value set to 1
|
||||
if(isset($focus->text_only) && $focus->text_only){
|
||||
$xtpl->assign("TEXTONLY_CHECKED","CHECKED");
|
||||
$xtpl->assign("TEXTONLY_VALUE","1");
|
||||
}else{//set value to 0
|
||||
$xtpl->assign("TEXTONLY_VALUE","0");
|
||||
}
|
||||
|
||||
|
||||
|
||||
$xtpl->assign("FIELD_DEFS_JS", $focus->generateFieldDefsJS());
|
||||
$xtpl->assign("LBL_CONTACT",$app_list_strings['moduleList']['Contacts']);
|
||||
|
||||
global $current_user;
|
||||
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) {
|
||||
$record = '';
|
||||
if(!empty($_REQUEST['record'])) {
|
||||
$record = $_REQUEST['record'];
|
||||
}
|
||||
$xtpl->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>");
|
||||
}
|
||||
if(isset($focus->parent_type) && $focus->parent_type != "") {
|
||||
$change_parent_button = "<input title='".$app_strings['LBL_SELECT_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_SELECT_BUTTON_KEY']."'
|
||||
tabindex='3' type='button' class='button' value='".$app_strings['LBL_SELECT_BUTTON_LABEL']."' name='button' LANGUAGE=javascript onclick='return
|
||||
window.open(\"index.php?module=\"+ document.EditView.parent_type.value +
|
||||
\"&action=Popup&html=Popup_picker&form=TasksEditView\",\"test\",\"width=600,height=400,resizable=1,scrollbars=1\");'>";
|
||||
$xtpl->assign("CHANGE_PARENT_BUTTON", $change_parent_button);
|
||||
}
|
||||
if($focus->parent_type == "Account") {
|
||||
$xtpl->assign("DEFAULT_SEARCH","&query=true&account_id=$focus->parent_id&account_name=".urlencode($focus->parent_name));
|
||||
}
|
||||
|
||||
$xtpl->assign("DESCRIPTION", $focus->description);
|
||||
$xtpl->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['record_type_display'], $focus->parent_type));
|
||||
//$xtpl->assign("DEFAULT_MODULE","Accounts");
|
||||
|
||||
if(isset($focus->body)) $xtpl->assign("BODY", $focus->body); else $xtpl->assign("BODY", "");
|
||||
if(isset($focus->body_html)) $xtpl->assign("BODY_HTML", $focus->body_html); else $xtpl->assign("BODY_HTML", "");
|
||||
|
||||
|
||||
if(true) {
|
||||
if ( !isTouchScreen() ) {
|
||||
require_once("include/SugarTinyMCE.php");
|
||||
$tiny = new SugarTinyMCE();
|
||||
$tiny->defaultConfig['cleanup_on_startup']=true;
|
||||
$tiny->defaultConfig['height']=600;
|
||||
$tinyHtml = $tiny->getInstance();
|
||||
$xtpl->assign("tiny", $tinyHtml);
|
||||
}
|
||||
///////////////////////////////////////
|
||||
//// MACRO VARS
|
||||
$xtpl->assign("INSERT_VARIABLE_ONCLICK", "insert_variable(document.EditView.variable_text.value)");
|
||||
if(!$inboundEmail){
|
||||
$xtpl->parse("main.NoInbound.variable_button");
|
||||
}
|
||||
///////////////////////////////////////
|
||||
//// CAMPAIGNS
|
||||
if($has_campaign || $inboundEmail) {
|
||||
$xtpl->assign("INPOPUPWINDOW",'true');
|
||||
$xtpl->assign("INSERT_URL_ONCLICK", "insert_variable_html_link(document.EditView.tracker_url.value)");
|
||||
if($has_campaign){
|
||||
$campaign_urls=get_campaign_urls($_REQUEST['campaign_id']);
|
||||
}
|
||||
if(!empty($campaign_urls)) {
|
||||
$xtpl->assign("DEFAULT_URL_TEXT",key($campaign_urls));
|
||||
}
|
||||
if($has_campaign){
|
||||
$xtpl->assign("TRACKER_KEY_OPTIONS", get_select_options_with_id($campaign_urls, null));
|
||||
$xtpl->parse("main.NoInbound.tracker_url");
|
||||
}
|
||||
}
|
||||
|
||||
// The insert variable drodown should be conditionally displayed.
|
||||
// If it's campaign then hide the Account.
|
||||
if($has_campaign) {
|
||||
$dropdown="<option value='Contacts'>
|
||||
".$mod_strings['LBL_CONTACT_AND_OTHERS']."
|
||||
</option>";
|
||||
$xtpl->assign("DROPDOWN",$dropdown);
|
||||
$xtpl->assign("DEFAULT_MODULE",'Contacts');
|
||||
//$xtpl->assign("CAMPAIGN_POPUP_JS", '<script type="text/javascript" src="include/javascript/sugar_3.js"></script>');
|
||||
} else {
|
||||
$dropdown="<option value='Accounts'>
|
||||
".$mod_strings['LBL_ACCOUNT']."
|
||||
</option>
|
||||
<option value='Contacts'>
|
||||
".$mod_strings['LBL_CONTACT_AND_OTHERS']."
|
||||
</option>
|
||||
<!--<option value='Users'>
|
||||
".$mod_strings['LBL_USERS']."
|
||||
</option> --!>";
|
||||
$xtpl->assign("DROPDOWN",$dropdown);
|
||||
$xtpl->assign("DEFAULT_MODULE",'Accounts');
|
||||
}
|
||||
//// END CAMPAIGNS
|
||||
///////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////
|
||||
//// ATTACHMENTS
|
||||
$attachments = '';
|
||||
if(!empty($focus->id)) {
|
||||
$etid = $focus->id;
|
||||
} elseif(!empty($old_id)) {
|
||||
$xtpl->assign('OLD_ID', $old_id);
|
||||
$etid = $old_id;
|
||||
}
|
||||
if(!empty($etid)) {
|
||||
$note = new Note();
|
||||
$where = "notes.parent_id='{$etid}' AND notes.filename IS NOT NULL";
|
||||
$notes_list = $note->get_full_list("", $where,true);
|
||||
|
||||
if(!isset($notes_list)) {
|
||||
$notes_list = array();
|
||||
}
|
||||
for($i = 0;$i < count($notes_list);$i++) {
|
||||
$the_note = $notes_list[$i];
|
||||
if( empty($the_note->filename)) {
|
||||
continue;
|
||||
}
|
||||
$secureLink = 'index.php?entryPoint=download&id='.$the_note->id.'&type=Notes';
|
||||
$attachments .= '<input type="checkbox" name="remove_attachment[]" value="'.$the_note->id.'"> '.$app_strings['LNK_REMOVE'].' ';
|
||||
$attachments .= '<a href="'.$secureLink.'" target="_blank">'. $the_note->filename .'</a><br>';
|
||||
}
|
||||
}
|
||||
$attJs = '<script type="text/javascript">';
|
||||
$attJs .= 'var file_path = "'.$sugar_config['site_url'].'/'.$sugar_config['upload_dir'].'";';
|
||||
$attJs .= 'var lnk_remove = "'.$app_strings['LNK_REMOVE'].'";';
|
||||
$attJs .= '</script>';
|
||||
$xtpl->assign('ATTACHMENTS', $attachments);
|
||||
$xtpl->assign('ATTACHMENTS_JAVASCRIPT', $attJs);
|
||||
|
||||
//// END ATTACHMENTS
|
||||
///////////////////////////////////////
|
||||
|
||||
// done and parse
|
||||
$xtpl->parse("main.textarea");
|
||||
}
|
||||
|
||||
//Add Custom Fields
|
||||
require_once('modules/DynamicFields/templates/Files/EditView.php');
|
||||
if(!$inboundEmail){
|
||||
$xtpl->parse("main.NoInbound");
|
||||
$xtpl->parse("main.NoInbound1");
|
||||
$xtpl->parse("main.NoInbound2");
|
||||
$xtpl->parse("main.NoInbound3");
|
||||
$xtpl->parse("main.NoInbound4");
|
||||
$xtpl->parse("main.NoInbound5");
|
||||
}
|
||||
$xtpl->parse("main");
|
||||
|
||||
$xtpl->out("main");
|
||||
|
||||
$javascript = new javascript();
|
||||
$javascript->setFormName('EditView');
|
||||
$javascript->setSugarBean($focus);
|
||||
$javascript->addAllFields('');
|
||||
echo $javascript->getScript();
|
||||
?>
|
||||
244
modules/EmailTemplates/EditViewMain.html
Executable file
244
modules/EmailTemplates/EditViewMain.html
Executable file
@@ -0,0 +1,244 @@
|
||||
<!--
|
||||
/*********************************************************************************
|
||||
* 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="modules/EmailTemplates/EmailTemplate.js"></script>
|
||||
<script type="text/javascript" src="include/JSON.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
|
||||
<script type="text/javascript" src="include/javascript/sugar_grp1.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
|
||||
<script type="text/javascript" src="include/javascript/yui/YAHOO.js"></script>
|
||||
<script type="text/javascript" src="include/javascript/yui/connection.js"></script>
|
||||
<script type="text/javascript">
|
||||
{FIELD_DEFS_JS}
|
||||
</script>
|
||||
{JSLANG}
|
||||
|
||||
<form name="EditView" id="EditView" method="POST" action="index.php" enctype="multipart/form-data">
|
||||
<input type="hidden" name="module" value="EmailTemplates">
|
||||
<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}">
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<input title="{APP.LBL_SAVE_BUTTON_TITLE}" accesskey="{APP.LBL_SAVE_BUTTON_KEY}" class="button primary"
|
||||
onclick=" this.form.action.value='Save';
|
||||
<!-- BEGIN: NoInbound1 -->
|
||||
addUploadFiles('EditView');
|
||||
addUploadDocs('EditView');
|
||||
<!-- END: NoInbound1 -->
|
||||
return check_form('EditView');"
|
||||
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="{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 width="15%" scope="row">
|
||||
{MOD.LBL_NAME}
|
||||
<span class="required">
|
||||
{APP.LBL_REQUIRED_SYMBOL}
|
||||
</span>
|
||||
</td>
|
||||
<td width="30%" >
|
||||
<input name='name' tabindex="10" type="text" size='30' maxlength="255" value="{NAME}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="15%" scope="row">
|
||||
{MOD.LBL_DESCRIPTION}
|
||||
</td>
|
||||
<td colspan="3" >
|
||||
<textarea name='description' tabindex='30' cols="90" rows="1" style="height: 1.6.em; overflow-y:auto; font-family:sans-serif,monospace; font-size:inherit;" id="subjectfield">{DESCRIPTION}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<!-- BEGIN: NoInbound -->
|
||||
<tr>
|
||||
<td width="15%" scope="row" align='left'>
|
||||
{MOD.LBL_INSERT_VARIABLE}
|
||||
</td>
|
||||
<td width="30%" colspan="3">
|
||||
<select name='variable_module' tabindex="40" onchange="addVariables(document.EditView.variable_name,this.options[this.selectedIndex].value);">
|
||||
{DROPDOWN}
|
||||
</select>
|
||||
<select name='variable_name' tabindex="50" onchange="showVariable();">
|
||||
</select>
|
||||
<span scope="row">
|
||||
{MOD.LBL_USE}:
|
||||
</span>
|
||||
<input type="text" size="30" tabindex="60" name="variable_text" />
|
||||
<!-- BEGIN: variable_button -->
|
||||
<input type='button' tabindex="70" onclick='{INSERT_VARIABLE_ONCLICK}' class='button' value='{MOD.LBL_INSERT}'>
|
||||
<!-- END: variable_button -->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- BEGIN: tracker_url -->
|
||||
<tr>
|
||||
<td width="15%" scope="row" align='left'>
|
||||
{MOD.LBL_INSERT_TRACKER_URL}
|
||||
</td>
|
||||
<td width="85%" colspan="3" valign="top" >
|
||||
<select tabindex='75' name='tracker_url' onchange='this.form.url_text.value=this.value'>
|
||||
{TRACKER_KEY_OPTIONS}
|
||||
</select>
|
||||
<input type="text" size="30" id="url_text" name="url_text" value="{DEFAULT_URL_TEXT}" />
|
||||
<input type='button' tabindex="77" onclick='{INSERT_URL_ONCLICK}' class='button' value='{MOD.LBL_INSERT_URL_REF}'>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END: tracker_url -->
|
||||
<!-- END: NoInbound -->
|
||||
<tr>
|
||||
<td width="15%" scope="row">
|
||||
{MOD.LBL_SUBJECT}
|
||||
</td>
|
||||
<td colspan='4' >
|
||||
<textarea onblur="remember_place(this);" name='subject' tabindex='80' cols="90" rows="1" style="height: 1.6.em; overflow-y:auto; font-family:sans-serif,monospace; font-size:inherit;" id="subjectfield">{SUBJECT}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td colspan='4'>
|
||||
<input name="toggle_textonly" id="toggle_textonly" onclick="toggle_text_only();" type="checkbox" {TEXTONLY_CHECKED}/>
|
||||
<input name="text_only" id="text_only" type="hidden" value='{TEXTONLY_VALUE}'/>
|
||||
{MOD.LBL_SEND_AS_TEXT}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" scope="row">
|
||||
{MOD.LBL_BODY}
|
||||
</td>
|
||||
|
||||
<!-- BEGIN: textarea -->
|
||||
<td colspan="4" >
|
||||
<div id='body_text_div'>
|
||||
<textarea id='body_text' tabindex='90' name='body_html' cols="100" rows="40">{BODY_HTML}</textarea>
|
||||
</div>
|
||||
<br>
|
||||
<div id='toggle_textarea_option'>
|
||||
<input id='toggle_textarea_elem' onclick="toggle_textarea(this);" type="checkbox" name="toggle_html" />
|
||||
{MOD.LBL_EDIT_ALT_TEXT}
|
||||
</div>
|
||||
<br>
|
||||
<div id="text_div" style="display: none">
|
||||
<textarea id='body_text_plain' tabindex='110' name='body' cols="100" rows="40" >{BODY}</textarea>
|
||||
</div>
|
||||
</td>
|
||||
<!-- END: textarea -->
|
||||
</tr>
|
||||
<!-- BEGIN: NoInbound2 -->
|
||||
<tr>
|
||||
<td valign="top" scope="row">
|
||||
{MOD.LBL_ATTACHMENTS}:
|
||||
</td>
|
||||
<td colspan="2" nowrap>
|
||||
{ATTACHMENTS_JAVASCRIPT} {ATTACHMENTS}
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END: NoInbound2 -->
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<!-- BEGIN: NoInbound3 -->
|
||||
<form id="upload_form" name="upload_form" method="POST" action='AttachDocuments.php' enctype="multipart/form-data">
|
||||
<div id="upload_div">
|
||||
<input type="file" id="my_file" name="file_1" size="40" />
|
||||
<input type="hidden" id="documentName" name="uploaddoc" onchange="docUpload(); form_reset_doc();" size="1" />
|
||||
<input type="hidden" id="documentId" name="seldoc" tabindex="0" />
|
||||
<input type="hidden" id="docRevId" name="seldoc" tabindex="0" />
|
||||
<input type="hidden" id="documentType" name="seldoc" tabindex="0" />
|
||||
<input type="button" name="add_doc" onclick="selectDoc();" value='{MOD.LBL_SUGAR_DOCUMENT}' class="button" />
|
||||
</div>
|
||||
<div id="attachments_div">
|
||||
</div>
|
||||
</form>
|
||||
<!-- END: NoInbound3 -->
|
||||
{tiny}
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!-- BEGIN: NoInbound4 -->
|
||||
var multi_selector = new multiFiles(document.getElementById('upload_div'));
|
||||
multi_selector.addElement( document.getElementById('my_file'));
|
||||
<!-- END: NoInbound4 -->
|
||||
//call the function on load, this will hide the tinyMCE editor if needed
|
||||
toggle_text_only(true);
|
||||
|
||||
function toggle_portal_flag() {
|
||||
{TOGGLE_JS}
|
||||
}
|
||||
<!-- BEGIN: NoInbound5 -->
|
||||
addVariables(document.EditView.variable_name,'{DEFAULT_MODULE}');
|
||||
<!-- END: NoInbound5 -->
|
||||
focus_obj = document.EditView.body;
|
||||
toggle_portal_flag();
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<!-- END: main -->
|
||||
52
modules/EmailTemplates/EmailTemplate.js
Normal file
52
modules/EmailTemplates/EmailTemplate.js
Normal file
@@ -0,0 +1,52 @@
|
||||
/*********************************************************************************
|
||||
* 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 focus_obj=false;var label=SUGAR.language.get('app_strings','LBL_DEFAULT_LINK_TEXT');function remember_place(obj){focus_obj=obj;}
|
||||
function showVariable(){document.EditView.variable_text.value=document.EditView.variable_name.options[document.EditView.variable_name.selectedIndex].value;}
|
||||
function addVariables(the_select,the_module){the_select.options.length=0;for(var i=0;i<field_defs[the_module].length;i++){var new_option=document.createElement("option");new_option.value="$"+field_defs[the_module][i].name;new_option.text=field_defs[the_module][i].value;the_select.options.add(new_option,i);}
|
||||
showVariable();}
|
||||
function toggle_text_only(firstRun){if(typeof(firstRun)=='undefined')
|
||||
firstRun=false;var text_only=document.getElementById('text_only');if(firstRun){setTimeout("tinyMCE.execCommand('mceAddControl', false, 'body_text');",500);var tiny=tinyMCE.getInstanceById('body_text');}
|
||||
if(document.getElementById('toggle_textonly').checked==true){document.getElementById('body_text_div').style.display='none';document.getElementById('toggle_textarea_option').style.display='none';document.getElementById('toggle_textarea_elem').checked=true;document.getElementById('text_div').style.display='inline';text_only.value=1;}else{document.getElementById('body_text_div').style.display='inline';document.getElementById('toggle_textarea_option').style.display='inline';document.getElementById('toggle_textarea_elem').checked=false;document.getElementById('text_div').style.display='none';text_only.value=0;}}
|
||||
function setTinyHTML(text){var tiny=tinyMCE.getInstanceById('body_text');if(tiny.getContent()!=null){tiny.setContent(text)}else{setTimeout(setTinyHTML(text),1000);}}
|
||||
function stripTags(str){var theText=new String(str);if(theText!='undefined'){return theText.replace(/<\/?[^>]+>/gi,'');}}
|
||||
function insert_variable_text(myField,myValue){if(document.selection){myField.focus();sel=document.selection.createRange();sel.text=myValue;}
|
||||
else if(myField.selectionStart||myField.selectionStart=='0'){var startPos=myField.selectionStart;var endPos=myField.selectionEnd;myField.value=myField.value.substring(0,startPos)
|
||||
+myValue
|
||||
+myField.value.substring(endPos,myField.value.length);}else{myField.value+=myValue;}}
|
||||
function insert_variable_html(text){var inst=tinyMCE.getInstanceById("body_text");if(inst)
|
||||
inst.getWin().focus();inst.execCommand('mceInsertRawHTML',false,text);}
|
||||
function insert_variable_html_link(text){the_label=document.getElementById('url_text').value;if(typeof(the_label)=='undefined'){the_label=label;}
|
||||
var thelink="<a href='"+text+"' > "+the_label+" </a>";insert_variable_html(thelink);}
|
||||
function insert_variable(text){if(document.getElementById('toggle_textonly').checked==true){insert_variable_text(document.getElementById('body_text_plain'),text);}else{insert_variable_html(text);}}
|
||||
628
modules/EmailTemplates/EmailTemplate.php
Executable file
628
modules/EmailTemplates/EmailTemplate.php
Executable file
@@ -0,0 +1,628 @@
|
||||
<?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): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// EmailTemplate is used to store email email_template information.
|
||||
class EmailTemplate extends SugarBean {
|
||||
var $field_name_map = array();
|
||||
// Stored fields
|
||||
var $id;
|
||||
var $date_entered;
|
||||
var $date_modified;
|
||||
var $modified_user_id;
|
||||
var $created_by;
|
||||
var $created_by_name;
|
||||
var $modified_by_name;
|
||||
var $name;
|
||||
var $published;
|
||||
var $description;
|
||||
var $body;
|
||||
var $body_html;
|
||||
var $subject;
|
||||
var $attachments;
|
||||
var $from_name;
|
||||
var $from_address;
|
||||
var $table_name = "email_templates";
|
||||
var $object_name = "EmailTemplate";
|
||||
var $module_dir = "EmailTemplates";
|
||||
var $new_schema = true;
|
||||
// This is used to retrieve related fields from form posts.
|
||||
var $additional_column_fields = array(
|
||||
);
|
||||
// add fields here that would not make sense in an email template
|
||||
var $badFields = array(
|
||||
'account_description',
|
||||
'contact_id',
|
||||
'lead_id',
|
||||
'opportunity_amount',
|
||||
'opportunity_id',
|
||||
'opportunity_name',
|
||||
'opportunity_role_id',
|
||||
'opportunity_role_fields',
|
||||
'opportunity_role',
|
||||
'campaign_id',
|
||||
// User objects
|
||||
'id',
|
||||
'date_entered',
|
||||
'date_modified',
|
||||
'user_preferences',
|
||||
'accept_status',
|
||||
'user_hash',
|
||||
'authenticate_id',
|
||||
'sugar_login',
|
||||
'reports_to_id',
|
||||
'reports_to_name',
|
||||
'is_admin',
|
||||
'receive_notifications',
|
||||
'modified_user_id',
|
||||
'modified_by_name',
|
||||
'created_by',
|
||||
'created_by_name',
|
||||
'accept_status_id',
|
||||
'accept_status_name',
|
||||
);
|
||||
|
||||
function EmailTemplate() {
|
||||
parent::SugarBean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the extended field_defs for creating macros
|
||||
* @param object $bean SugarBean
|
||||
* @param string $prefix "contact_", "user_" etc.
|
||||
* @return
|
||||
*/
|
||||
function generateFieldDefsJS() {
|
||||
global $current_user;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$contact = new Contact();
|
||||
$account = new Account();
|
||||
$lead = new Lead();
|
||||
$prospect = new Prospect();
|
||||
|
||||
|
||||
$loopControl = array(
|
||||
'Contacts' => array(
|
||||
'Contacts' => $contact,
|
||||
'Leads' => $lead,
|
||||
'Prospects' => $prospect,
|
||||
),
|
||||
'Accounts' => array(
|
||||
'Accounts' => $account,
|
||||
),
|
||||
/*
|
||||
'Users' => array(
|
||||
'Users' => $current_user,
|
||||
), */
|
||||
);
|
||||
|
||||
$prefixes = array(
|
||||
'Contacts' => 'contact_',
|
||||
'Accounts' => 'account_',
|
||||
'Users' => 'contact_user_',
|
||||
);
|
||||
|
||||
$collection = array();
|
||||
$collection['Accounts'][] = array("name" => 'account_name', "value" => 'Nazwa kontrahenta');
|
||||
$collection['Accounts'][] = array("name" => 'account_description', "value" => 'Opis');
|
||||
|
||||
$collection['Accounts'][] = array("name" => 'account_billing_address_street', "value" => 'Ulica - adres korespondencyjny');
|
||||
$collection['Accounts'][] = array("name" => 'account_billing_address_city', "value" => 'Miasto - adres korespondencyjny');
|
||||
$collection['Accounts'][] = array("name" => 'account_billing_address_state', "value" => 'Województwo - adres korespondencyjny');
|
||||
$collection['Accounts'][] = array("name" => 'account_billing_address_postalcode', "value" => 'Kod pocztowy - adres korespondencyjny');
|
||||
$collection['Accounts'][] = array("name" => 'account_billing_address_country', "value" => 'Kraj - adres korespondencyjny');
|
||||
|
||||
$collection['Accounts'][] = array("name" => 'account_shipping_address_street', "value" => 'Ulica - adres dostawy');
|
||||
$collection['Accounts'][] = array("name" => 'account_shipping_address_city', "value" => 'Miasto - adres dostawy');
|
||||
$collection['Accounts'][] = array("name" => 'account_shipping_address_state', "value" => 'Województwo - adres dostawy');
|
||||
$collection['Accounts'][] = array("name" => 'account_shipping_address_postalcode', "value" => 'Kod pocztowy - adres dostawy');
|
||||
$collection['Accounts'][] = array("name" => 'account_shipping_address_country', "value" => 'Kraj - adres dostawy');
|
||||
|
||||
$collection['Accounts'][] = array("name" => 'account_krs', "value" => 'KRS');
|
||||
$collection['Accounts'][] = array("name" => 'account_regon', "value" => 'REGON');
|
||||
$collection['Accounts'][] = array("name" => 'account_to_vatid', "value" => 'NIP');
|
||||
|
||||
|
||||
$collection['Contacts'][] = array("name" => 'contact_salutation', "value" => 'Tytuł, np Sz. Pan');
|
||||
|
||||
$collection['Contacts'][] = array("name" => 'contact_first_name', "value" => 'Imię');
|
||||
$collection['Contacts'][] = array("name" => 'contact_last_name', "value" => 'Nazwisko');
|
||||
$collection['Contacts'][] = array("name" => 'contact_full_name', "value" => 'Imię i nazwisko');
|
||||
|
||||
$collection['Contacts'][] = array("name" => 'contact_primary_address_street', "value" => 'Ulica - adres główny');
|
||||
$collection['Contacts'][] = array("name" => 'contact_primary_address_city', "value" => 'Miasto - adres główny');
|
||||
$collection['Contacts'][] = array("name" => 'contact_primary_address_state', "value" => 'Województwo - adres główny');
|
||||
$collection['Contacts'][] = array("name" => 'contact_primary_address_postalcode', "value" => 'Kod pocztowy - adres główny');
|
||||
$collection['Contacts'][] = array("name" => 'contact_primary_address_country', "value" => 'Kraj - adres główny');
|
||||
|
||||
$collection['Contacts'][] = array("name" => 'contact_second_address_street', "value" => 'Ulica - adres inny');
|
||||
$collection['Contacts'][] = array("name" => 'contact_second_address_city', "value" => 'Miasto - adres inny');
|
||||
$collection['Contacts'][] = array("name" => 'contact_second_address_state', "value" => 'Województwo - adres inny');
|
||||
$collection['Contacts'][] = array("name" => 'contact_second_address_postalcode', "value" => 'Kod pocztowy - adres inny');
|
||||
$collection['Contacts'][] = array("name" => 'contact_second_address_country', "value" => 'Kraj - adres inny');
|
||||
/*
|
||||
foreach($loopControl as $collectionKey => $beans) {
|
||||
$collection[$collectionKey] = array();
|
||||
foreach($beans as $beankey => $bean) {
|
||||
|
||||
foreach($bean->field_defs as $key => $field_def) {
|
||||
if( ($field_def['type'] == 'relate' && empty($field_def['custom_type'])) ||
|
||||
($field_def['type'] == 'assigned_user_name' || $field_def['type'] =='link') ||
|
||||
($field_def['type'] == 'bool') ||
|
||||
(in_array($field_def['name'], $this->badFields)) ) {
|
||||
continue;
|
||||
}
|
||||
if(!isset($field_def['vname'])) {
|
||||
//echo $key;
|
||||
}
|
||||
// valid def found, process
|
||||
$optionKey = strtolower("{$prefixes[$collectionKey]}{$key}");
|
||||
$optionLabel = preg_replace('/:$/', "", translate($field_def['vname'], $beankey));
|
||||
$dup=1;
|
||||
foreach ($collection[$collectionKey] as $value){
|
||||
if($value['name']==$optionKey){
|
||||
$dup=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($dup)
|
||||
$collection[$collectionKey][] = array("name" => $optionKey, "value" => $optionLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
$json = getJSONobj();
|
||||
$ret = "var field_defs = ";
|
||||
$ret .= $json->encode($collection, false);
|
||||
$ret .= ";";
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function get_summary_text() {
|
||||
return "$this->name";
|
||||
}
|
||||
|
||||
function create_export_query(&$order_by, &$where) {
|
||||
return $this->create_new_list_query($order_by, $where);
|
||||
}
|
||||
|
||||
function fill_in_additional_list_fields() {
|
||||
$this->fill_in_additional_parent_fields();
|
||||
}
|
||||
|
||||
function fill_in_additional_detail_fields() {
|
||||
$this->created_by_name = get_assigned_user_name($this->created_by);
|
||||
$this->modified_by_name = get_assigned_user_name($this->modified_user_id);
|
||||
$this->fill_in_additional_parent_fields();
|
||||
}
|
||||
|
||||
function fill_in_additional_parent_fields() {
|
||||
}
|
||||
|
||||
function get_list_view_data() {
|
||||
global $app_list_strings, $focus, $action, $currentModule;
|
||||
$fields = $this->get_list_view_array();
|
||||
$fields["DATE_MODIFIED"] = substr($fields["DATE_MODIFIED"], 0 , 10);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
//function all string that match the pattern {.} , also catches the list of found strings.
|
||||
//the cache will get refreshed when the template bean instance changes.
|
||||
//The found url key patterns are replaced with name value pairs provided as function parameter. $tracked_urls.
|
||||
//$url_template is used to construct the url for the email message. the template should have place holder for 1 varaible parameter, represented by %1
|
||||
//$template_text_array is a list of text strings that need to be searched. usually the subject, html body and text body of the email message.
|
||||
//$removeme_url_template, if the url has is_optout property checked then use this template.
|
||||
function parse_tracker_urls($template_text_array,$url_template,$tracked_urls,$removeme_url_template) {
|
||||
global $beanFiles,$beanList, $app_list_strings,$sugar_config;
|
||||
if (!isset($this->parsed_urls))
|
||||
$this->parsed_urls=array();
|
||||
|
||||
//parse the template and find all the dynamic strings that need replacement.
|
||||
$pattern = '/\{*[^\{\}]*\}/'; // cn: bug 6638, find multibyte strings
|
||||
foreach ($template_text_array as $key=>$template_text) {
|
||||
if (!empty($template_text)) {
|
||||
$template_text = urldecode($template_text);
|
||||
if(!isset($this->parsed_urls[$key]) || $this->parsed_urls[$key]['text'] != $template_text) {
|
||||
$matches=array();
|
||||
$count=preg_match_all($pattern,$template_text,$matches,PREG_OFFSET_CAPTURE);
|
||||
$this->parsed_urls[$key]=array('matches' => $matches, 'text' => $template_text);
|
||||
} else {
|
||||
$matches=$this->parsed_urls[$key]['matches'];
|
||||
if(!empty($matches[0])) {
|
||||
$count=count($matches[0]);
|
||||
} else {
|
||||
$count=0;
|
||||
}
|
||||
}
|
||||
|
||||
//navigate thru all the matched keys and replace the keys with actual strings.
|
||||
for ($i=($count -1); $i>=0; $i--) {
|
||||
$url_key_name=$matches[0][$i][0];
|
||||
|
||||
if (!empty($tracked_urls[$url_key_name])) {
|
||||
if ($tracked_urls[$url_key_name]['is_optout']==1){
|
||||
$tracker_url = $removeme_url_template;
|
||||
} else {
|
||||
$tracker_url = sprintf($url_template,$tracked_urls[$url_key_name]['id']);
|
||||
}
|
||||
}
|
||||
if(!empty($tracker_url) && !empty($template_text) && !empty($matches[0][$i][0]) && !empty($tracked_urls[$matches[0][$i][0]])){
|
||||
$template_text=substr_replace($template_text,$tracker_url,$matches[0][$i][1], strlen($matches[0][$i][0]));
|
||||
$template_text=str_replace($sugar_config['site_url'].'/'.$sugar_config['site_url'],$sugar_config['site_url'],$template_text);
|
||||
}
|
||||
}
|
||||
}
|
||||
$return_array[$key]=$template_text;
|
||||
}
|
||||
|
||||
return $return_array;
|
||||
}
|
||||
|
||||
function parse_email_template($template_text_array, $focus_name, $focus, &$macro_nv) {
|
||||
|
||||
|
||||
global $beanFiles, $beanList, $app_list_strings;
|
||||
|
||||
// generate User instance that owns this "Contact" for contact_user_* macros
|
||||
$user = new User();
|
||||
if(isset($focus->assigned_user_id) && !empty($focus->assigned_user_id)){
|
||||
$user->retrieve($focus->assigned_user_id);
|
||||
}
|
||||
|
||||
if(!isset($this->parsed_entities))
|
||||
$this->parsed_entities=array();
|
||||
|
||||
//parse the template and find all the dynamic strings that need replacement.
|
||||
$pattern_prefix = '$'.strtolower($beanList[$focus_name]).'_';
|
||||
$pattern_prefix_length = strlen($pattern_prefix);
|
||||
$pattern = '/\\'.$pattern_prefix.'[A-Za-z_0-9]*/';
|
||||
|
||||
foreach($template_text_array as $key=>$template_text) {
|
||||
if(!isset($this->parsed_entities[$key])) {
|
||||
$matches = array();
|
||||
$count = preg_match_all($pattern, $template_text, $matches, PREG_OFFSET_CAPTURE);
|
||||
|
||||
if($count != 0) {
|
||||
for($i=($count -1); $i>=0; $i--) {
|
||||
if(!isset($matches[0][$i][2])) {
|
||||
//find the field name in the bean.
|
||||
$matches[0][$i][2]=substr($matches[0][$i][0],$pattern_prefix_length,strlen($matches[0][$i][0]) - $pattern_prefix_length);
|
||||
|
||||
//store the localized strings if the field is of type enum..
|
||||
if(isset($focus->field_defs[$matches[0][$i][2]]) && $focus->field_defs[$matches[0][$i][2]]['type']=='enum' && isset($focus->field_defs[$matches[0][$i][2]]['options'])) {
|
||||
$matches[0][$i][3]=$focus->field_defs[$matches[0][$i][2]]['options'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->parsed_entities[$key]=$matches;
|
||||
} else {
|
||||
$matches=$this->parsed_entities[$key];
|
||||
if(!empty($matches[0])) {
|
||||
$count=count($matches[0]);
|
||||
} else {
|
||||
$count=0;
|
||||
}
|
||||
}
|
||||
|
||||
for ($i=($count -1); $i>=0; $i--) {
|
||||
$field_name=$matches[0][$i][2];
|
||||
|
||||
// cn: feel for User object attribute key and assign as found
|
||||
if(strpos($field_name, "user_") === 0) {
|
||||
$userFieldName = substr($field_name, 5);
|
||||
$value = $user->$userFieldName;
|
||||
//_pp($userFieldName."[{$value}]");
|
||||
} else {
|
||||
$value = $focus->{$field_name};
|
||||
}
|
||||
|
||||
//check dom
|
||||
if(isset($matches[0][$i][3])) {
|
||||
if(isset($app_list_strings[$matches[0][$i][3]][$value])) {
|
||||
$value=$app_list_strings[$matches[0][$i][3]][$value];
|
||||
}
|
||||
}
|
||||
|
||||
//generate name value pair array of macros and corresponding values for the targed.
|
||||
$macro_nv[$matches[0][$i][0]] =$value;
|
||||
|
||||
$template_text=substr_replace($template_text,$value,$matches[0][$i][1], strlen($matches[0][$i][0]));
|
||||
}
|
||||
|
||||
//parse the template for tracker url strings. patter for these strings in {[a-zA-Z_0-9]+}
|
||||
|
||||
$return_array[$key]=$template_text;
|
||||
}
|
||||
|
||||
return $return_array;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method to parse for user's values in a template
|
||||
* @param array $repl_arr
|
||||
* @param object $user
|
||||
* @return array
|
||||
*/
|
||||
function _parseUserValues($repl_arr, &$user) {
|
||||
foreach($user->field_defs as $field_def) {
|
||||
if(($field_def['type'] == 'relate' && empty($field_def['custom_type'])) || $field_def['type'] == 'assigned_user_name') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($field_def['type'] == 'enum') {
|
||||
$translated = translate($field_def['options'], 'Users', $user->$field_def['name']);
|
||||
|
||||
if(isset($translated) && ! is_array($translated)) {
|
||||
$repl_arr["contact_user_".$field_def['name']] = $translated;
|
||||
} else { // unset enum field, make sure we have a match string to replace with ""
|
||||
$repl_arr["contact_user_".$field_def['name']] = '';
|
||||
}
|
||||
} else {
|
||||
if(isset($user->$field_def['name'])) {
|
||||
$repl_arr["contact_user_".$field_def['name']] = $user->$field_def['name'];
|
||||
} else {
|
||||
$repl_arr["contact_user_".$field_def['name']] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $repl_arr;
|
||||
}
|
||||
|
||||
|
||||
function parse_template_bean($string, $bean_name, &$focus) {
|
||||
global $current_user;
|
||||
global $beanFiles, $beanList;
|
||||
$repl_arr = array();
|
||||
|
||||
// cn: bug 9277 - create a replace array with empty strings to blank-out invalid vars
|
||||
if(!class_exists('Account'))
|
||||
if(!class_exists('Contact'))
|
||||
if(!class_exists('Leads'))
|
||||
if(!class_exists('Prospects'))
|
||||
|
||||
require_once('modules/Accounts/Account.php');
|
||||
$acct = new Account();
|
||||
$contact = new Contact();
|
||||
$lead = new Lead();
|
||||
$prospect = new Prospect();
|
||||
|
||||
foreach($lead->field_defs as $field_def) {
|
||||
if(($field_def['type'] == 'relate' && empty($field_def['custom_type'])) || $field_def['type'] == 'assigned_user_name') {
|
||||
continue;
|
||||
}
|
||||
$repl_arr["contact_".$field_def['name']] = '';
|
||||
$repl_arr["contact_account_".$field_def['name']] = '';
|
||||
}
|
||||
foreach($prospect->field_defs as $field_def) {
|
||||
if(($field_def['type'] == 'relate' && empty($field_def['custom_type'])) || $field_def['type'] == 'assigned_user_name') {
|
||||
continue;
|
||||
}
|
||||
$repl_arr["contact_".$field_def['name']] = '';
|
||||
$repl_arr["contact_account_".$field_def['name']] = '';
|
||||
}
|
||||
foreach($contact->field_defs as $field_def) {
|
||||
if(($field_def['type'] == 'relate' && empty($field_def['custom_type'])) || $field_def['type'] == 'assigned_user_name') {
|
||||
continue;
|
||||
}
|
||||
$repl_arr["contact_".$field_def['name']] = '';
|
||||
$repl_arr["contact_account_".$field_def['name']] = '';
|
||||
}
|
||||
foreach($acct->field_defs as $field_def) {
|
||||
if(($field_def['type'] == 'relate' && empty($field_def['custom_type'])) || $field_def['type'] == 'assigned_user_name') {
|
||||
continue;
|
||||
}
|
||||
$repl_arr["account_".$field_def['name']] = '';
|
||||
$repl_arr["account_contact_".$field_def['name']] = '';
|
||||
}
|
||||
// cn: end bug 9277 fix
|
||||
|
||||
|
||||
// feel for Parent account, only for Contacts traditionally, but written for future expansion
|
||||
if(isset($focus->account_id) && !empty($focus->account_id)) {
|
||||
$acct->retrieve($focus->account_id);
|
||||
}
|
||||
|
||||
if($bean_name == 'Contacts') {
|
||||
// cn: bug 9277 - email templates not loading account/opp info for templates
|
||||
if(!empty($acct->id)) {
|
||||
foreach($acct->field_defs as $field_def) {
|
||||
if(($field_def['type'] == 'relate' && empty($field_def['custom_type'])) || $field_def['type'] == 'assigned_user_name') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($field_def['type'] == 'enum') {
|
||||
$translated = translate($field_def['options'], 'Accounts' ,$acct->$field_def['name']);
|
||||
|
||||
if(isset($translated) && ! is_array($translated)) {
|
||||
$repl_arr["account_".$field_def['name']] = $translated;
|
||||
$repl_arr["contact_account_".$field_def['name']] = $translated;
|
||||
} else { // unset enum field, make sure we have a match string to replace with ""
|
||||
$repl_arr["account_".$field_def['name']] = '';
|
||||
$repl_arr["contact_account_".$field_def['name']] = '';
|
||||
}
|
||||
} else {
|
||||
$repl_arr["account_".$field_def['name']] = $acct->$field_def['name'];
|
||||
$repl_arr["contact_account_".$field_def['name']] = $acct->$field_def['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($focus->assigned_user_id)) {
|
||||
$user = new User();
|
||||
$user->retrieve($focus->assigned_user_id);
|
||||
$repl_arr = EmailTemplate::_parseUserValues($repl_arr, $user);
|
||||
}
|
||||
} elseif($bean_name == 'Users') {
|
||||
/**
|
||||
* This section of code will on do work when a blank Contact, Lead,
|
||||
* etc. is passed in to parse the contact_* vars. At this point,
|
||||
* $current_user will be used to fill in the blanks.
|
||||
*/
|
||||
$repl_arr = EmailTemplate::_parseUserValues($repl_arr, $current_user);
|
||||
} else {
|
||||
// assumed we have an Account in focus
|
||||
foreach($contact->field_defs as $field_def) {
|
||||
if(($field_def['type'] == 'relate' && empty($field_def['custom_type'])) || $field_def['type'] == 'assigned_user_name' || $field_def['type'] == 'link') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($field_def['type'] == 'enum') {
|
||||
$translated = translate($field_def['options'], 'Accounts' ,$contact->$field_def['name']);
|
||||
|
||||
if(isset($translated) && ! is_array($translated)) {
|
||||
$repl_arr["contact_".$field_def['name']] = $translated;
|
||||
$repl_arr["contact_account_".$field_def['name']] = $translated;
|
||||
} else { // unset enum field, make sure we have a match string to replace with ""
|
||||
$repl_arr["contact_".$field_def['name']] = '';
|
||||
$repl_arr["contact_account_".$field_def['name']] = '';
|
||||
}
|
||||
} else {
|
||||
if (isset($contact->$field_def['name'])) {
|
||||
$repl_arr["contact_".$field_def['name']] = $contact->$field_def['name'];
|
||||
$repl_arr["contact_account_".$field_def['name']] = $contact->$field_def['name'];
|
||||
} // if
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//// LOAD FOCUS DATA INTO REPL_ARR
|
||||
foreach($focus->field_defs as $field_def) {
|
||||
if(isset($focus->$field_def['name'])) {
|
||||
if(($field_def['type'] == 'relate' && empty($field_def['custom_type'])) || $field_def['type'] == 'assigned_user_name') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($field_def['type'] == 'enum' && isset($field_def['options'])) {
|
||||
$translated = translate($field_def['options'],$bean_name,$focus->$field_def['name']);
|
||||
|
||||
if(isset($translated) && ! is_array($translated)) {
|
||||
$repl_arr[strtolower($beanList[$bean_name])."_".$field_def['name']] = $translated;
|
||||
} else { // unset enum field, make sure we have a match string to replace with ""
|
||||
$repl_arr[strtolower($beanList[$bean_name])."_".$field_def['name']] = '';
|
||||
}
|
||||
} else {
|
||||
$repl_arr[strtolower($beanList[$bean_name])."_".$field_def['name']] = $focus->$field_def['name'];
|
||||
}
|
||||
} else {
|
||||
if($field_def['name'] == 'full_name') {
|
||||
$repl_arr[strtolower($beanList[$bean_name]).'_full_name'] = $focus->get_summary_text();
|
||||
} else {
|
||||
$repl_arr[strtolower($beanList[$bean_name])."_".$field_def['name']] = '';
|
||||
}
|
||||
}
|
||||
} // end foreach()
|
||||
|
||||
krsort($repl_arr);
|
||||
reset($repl_arr);
|
||||
//20595 add nl2br() to respect the multi-lines formatting
|
||||
if(isset($repl_arr['contact_primary_address_street'])){
|
||||
$repl_arr['contact_primary_address_street'] = nl2br($repl_arr['contact_primary_address_street']);
|
||||
}
|
||||
if(isset($repl_arr['contact_alt_address_street'])){
|
||||
$repl_arr['contact_alt_address_street'] = nl2br($repl_arr['contact_alt_address_street']);
|
||||
}
|
||||
|
||||
foreach ($repl_arr as $name=>$value) {
|
||||
if($value != '' && is_string($value)) {
|
||||
$string = str_replace("\$$name", $value, $string);
|
||||
} else {
|
||||
$string = str_replace("\$$name", ' ', $string);
|
||||
}
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
function parse_template($string, &$bean_arr) {
|
||||
global $beanFiles, $beanList;
|
||||
|
||||
foreach($bean_arr as $bean_name => $bean_id) {
|
||||
require_once($beanFiles[$beanList[$bean_name]]);
|
||||
|
||||
$focus = new $beanList[$bean_name];
|
||||
$result = $focus->retrieve($bean_id);
|
||||
|
||||
if($bean_name == 'Leads' || $bean_name == 'Prospects') {
|
||||
$bean_name = 'Contacts';
|
||||
}
|
||||
|
||||
if(isset($this) && isset($this->module_dir) && $this->module_dir == 'EmailTemplates') {
|
||||
$string = $this->parse_template_bean($string, $bean_name, $focus);
|
||||
} else {
|
||||
$string = EmailTemplate::parse_template_bean($string, $bean_name, $focus);
|
||||
}
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
function bean_implements($interface) {
|
||||
switch($interface) {
|
||||
case 'ACL':return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function is_used_by_email_marketing() {
|
||||
$query = "select id from email_marketing where template_id='$this->id' and deleted=0";
|
||||
$result = $this->db->query($query);
|
||||
if($this->db->fetchByAssoc($result)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
364
modules/EmailTemplates/EmailTemplateFormBase.php
Executable file
364
modules/EmailTemplates/EmailTemplateFormBase.php
Executable file
@@ -0,0 +1,364 @@
|
||||
<?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: Base Form For Notes
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
class EmailTemplateFormBase {
|
||||
|
||||
function getFormBody($prefix, $mod='',$formname='', $size='30') {
|
||||
|
||||
|
||||
global $mod_strings;
|
||||
|
||||
$temp_strings = $mod_strings;
|
||||
|
||||
if(!empty($mod)) {
|
||||
global $current_language;
|
||||
$mod_strings = return_module_language($current_language, $mod);
|
||||
}
|
||||
global $app_strings;
|
||||
global $app_list_strings;
|
||||
|
||||
$lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
|
||||
$lbl_subject = $mod_strings['LBL_NOTE_SUBJECT'];
|
||||
$lbl_description = $mod_strings['LBL_NOTE'];
|
||||
$default_parent_type= $app_list_strings['record_type_default_key'];
|
||||
|
||||
$form = <<<EOF
|
||||
<input type="hidden" name="${prefix}record" value="">
|
||||
<input type="hidden" name="${prefix}parent_type" value="${default_parent_type}">
|
||||
<p>
|
||||
<table cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td scope="row">$lbl_subject <span class="required">$lbl_required_symbol</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td ><input name='${prefix}name' size='${size}' maxlength='255' type="text" value=""></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row">$lbl_description</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td ><textarea name='${prefix}description' cols='${size}' rows='4' ></textarea></td>
|
||||
</tr>
|
||||
</table></p>
|
||||
EOF;
|
||||
|
||||
$javascript = new javascript();
|
||||
$javascript->setFormName($formname);
|
||||
$javascript->setSugarBean(new EmailTemplate());
|
||||
$javascript->addRequiredFields($prefix);
|
||||
$form .=$javascript->getScript();
|
||||
$mod_strings = $temp_strings;
|
||||
return $form;
|
||||
}
|
||||
|
||||
function getForm($prefix, $mod='') {
|
||||
if(!empty($mod)) {
|
||||
global $current_language;
|
||||
$mod_strings = return_module_language($current_language, $mod);
|
||||
}else global $mod_strings;
|
||||
global $app_strings;
|
||||
global $app_list_strings;
|
||||
|
||||
$lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
|
||||
$lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
|
||||
$lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
|
||||
|
||||
|
||||
$the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
|
||||
$the_form .= <<<EOQ
|
||||
|
||||
<form name="${prefix}EmailTemplateSave" onSubmit="return check_form('${prefix}EmailTemplateSave')" method="POST" action="index.php">
|
||||
<input type="hidden" name="${prefix}module" value="EmailTemplates">
|
||||
<input type="hidden" name="${prefix}action" value="Save">
|
||||
EOQ;
|
||||
$the_form .= $this->getFormBody($prefix, $mod, "${prefix}EmailTemplateSave", "20");
|
||||
$the_form .= <<<EOQ
|
||||
<p><input title="$lbl_save_button_title" accessKey="$lbl_save_button_key" class="button" type="submit" name="button" value=" $lbl_save_button_label " ></p>
|
||||
</form>
|
||||
|
||||
EOQ;
|
||||
|
||||
$the_form .= get_left_form_footer();
|
||||
$the_form .= get_validate_record_js();
|
||||
|
||||
|
||||
return $the_form;
|
||||
}
|
||||
|
||||
|
||||
function handleSave($prefix,$redirect=true, $useRequired=false) {
|
||||
|
||||
|
||||
|
||||
|
||||
require_once('include/formbase.php');
|
||||
require_once('include/upload_file.php');
|
||||
global $upload_maxsize, $upload_dir;
|
||||
global $mod_strings;
|
||||
global $sugar_config;
|
||||
|
||||
$focus = new EmailTemplate();
|
||||
if($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
|
||||
return null;
|
||||
}
|
||||
$focus = populateFromPost($prefix, $focus);
|
||||
//process the text only flag
|
||||
if(isset($_POST['text_only']) && ($_POST['text_only'] == '1')){
|
||||
$focus->text_only = 1;
|
||||
}else{
|
||||
$focus->text_only = 0;
|
||||
}
|
||||
if(!$focus->ACLAccess('Save')) {
|
||||
ACLController::displayNoAccess(true);
|
||||
sugar_cleanup(true);
|
||||
}
|
||||
if(!isset($_REQUEST['published'])) $focus->published = 'off';
|
||||
|
||||
$preProcessedImages = array();
|
||||
$emailTemplateBodyHtml = from_html($focus->body_html);
|
||||
$fileBasePath = "{$sugar_config['cache_dir']}images/";
|
||||
$filePatternSearch = "{$sugar_config['cache_dir']}";
|
||||
$filePatternSearch = str_replace("/", "\/", $filePatternSearch);
|
||||
$filePatternSearch = $filePatternSearch . "images\/";
|
||||
$fileBasePath1 = "\"" .$fileBasePath;
|
||||
if(strpos($emailTemplateBodyHtml, "\"{$fileBasePath}")) {
|
||||
$matches = array();
|
||||
preg_match_all("/{$filePatternSearch}.+?\"/i", $emailTemplateBodyHtml, $matches);
|
||||
foreach($matches[0] as $match) {
|
||||
$filenameUndecoded = str_replace($fileBasePath, '', $match);
|
||||
$filename = urldecode(substr($filenameUndecoded, 0, -1));
|
||||
$filenameUndecoded = str_replace("\"", '', $filenameUndecoded);
|
||||
$cid = $filename;
|
||||
$file_location = clean_path(getcwd()."/{$sugar_config['cache_dir']}images/{$filename}");
|
||||
$mime_type = strtolower(substr($filename, strrpos($filename, ".")+1, strlen($filename)));
|
||||
|
||||
if(file_exists($file_location)) {
|
||||
$id = create_guid();
|
||||
$newFileLocation = "{$sugar_config['upload_dir']}{$id}";
|
||||
if(!copy($file_location, $newFileLocation)) {
|
||||
$GLOBALS['log']->debug("EMAIL Template could not copy attachment to {$sugar_config['upload_dir']} [ {$newFileLocation} ]");
|
||||
} else {
|
||||
$secureLink = 'index.php?entryPoint=download&id='.$id.'&type=Notes';
|
||||
$emailTemplateBodyHtml = str_replace("{$sugar_config['cache_dir']}images/{$filenameUndecoded}", $secureLink, $emailTemplateBodyHtml);
|
||||
unlink($file_location);
|
||||
$preProcessedImages[$filename] = $id;
|
||||
}
|
||||
} // if
|
||||
} // foreach
|
||||
} // if
|
||||
|
||||
$focus->body_html = $emailTemplateBodyHtml;
|
||||
$return_id = $focus->save();
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//// ATTACHMENT HANDLING
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//// ADDING NEW ATTACHMENTS
|
||||
|
||||
$max_files_upload = count($_FILES);
|
||||
|
||||
if(!empty($focus->id)) {
|
||||
$note = new Note();
|
||||
$where = "notes.parent_id='{$focus->id}'";
|
||||
if(!empty($_REQUEST['old_id'])) { // to support duplication of email templates
|
||||
$where .= " OR notes.parent_id='".$_REQUEST['old_id']."'";
|
||||
}
|
||||
$notes_list = $note->get_full_list("", $where, true);
|
||||
}
|
||||
|
||||
if(!isset($notes_list)) {
|
||||
$notes_list = array();
|
||||
}
|
||||
|
||||
if(!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here.
|
||||
$focus->attachments = array();
|
||||
}
|
||||
$focus->attachments = array_merge($focus->attachments, $notes_list);
|
||||
|
||||
|
||||
|
||||
//for($i = 0; $i < $max_files_upload; $i++) {
|
||||
|
||||
foreach ($_FILES as $key => $file)
|
||||
{
|
||||
$note = new Note();
|
||||
|
||||
//Images are presaved above so we need to prevent duplicate files from being created.
|
||||
if( isset($preProcessedImages[$file['name']]) )
|
||||
{
|
||||
$oldId = $preProcessedImages[$file['name']];
|
||||
$note->id = $oldId;
|
||||
$note->new_with_id = TRUE;
|
||||
$GLOBALS['log']->debug("Image {$file['name']} has already been processed.");
|
||||
}
|
||||
|
||||
$i=preg_replace("/email_attachment(.+)/",'$1',$key);
|
||||
$upload_file = new UploadFile($key);
|
||||
|
||||
|
||||
if(isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/",$key)) {
|
||||
$note->filename = $upload_file->get_stored_file_name();
|
||||
$note->file = $upload_file;
|
||||
$note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'].': '.$note->file->original_file_name;
|
||||
if(isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])){
|
||||
if($_REQUEST['embedded'.$i]=='true'){
|
||||
$note->embed_flag =true;
|
||||
}
|
||||
else{
|
||||
$note->embed_flag =false;
|
||||
}
|
||||
}
|
||||
array_push($focus->attachments, $note);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$focus->saved_attachments = array();
|
||||
foreach($focus->attachments as $note)
|
||||
{
|
||||
if( !empty($note->id) && $note->new_with_id === FALSE)
|
||||
{
|
||||
if(empty($_REQUEST['old_id']))
|
||||
array_push($focus->saved_attachments, $note); // to support duplication of email templates
|
||||
else
|
||||
{
|
||||
// we're duplicating a template with attachments
|
||||
// dupe the file, create a new note, assign the note to the new template
|
||||
$newNote = new Note();
|
||||
$newNote->retrieve($note->id);
|
||||
$newNote->id = create_guid();
|
||||
$newNote->parent_id = $focus->id;
|
||||
$newNote->new_with_id = true;
|
||||
$newNote->date_modified = '';
|
||||
$newNote->date_entered = '';
|
||||
$newNoteId = $newNote->save();
|
||||
|
||||
$dupeFile = new UploadFile('duplicate');
|
||||
$dupeFile->duplicate_file($note->id, $newNoteId, $note->filename);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$note->parent_id = $focus->id;
|
||||
$note->parent_type = 'Emails';
|
||||
$note->file_mime_type = $note->file->mime_type;
|
||||
$note_id = $note->save();
|
||||
array_push($focus->saved_attachments, $note);
|
||||
$note->id = $note_id;
|
||||
|
||||
if($note->new_with_id === FALSE)
|
||||
$note->file->final_move($note->id);
|
||||
else
|
||||
$GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
|
||||
}
|
||||
|
||||
//// END NEW ATTACHMENTS
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//// ATTACHMENTS FROM DOCUMENTS
|
||||
$count='';
|
||||
//_pp($_REQUEST);
|
||||
//_ppd(count($_REQUEST['document']));
|
||||
if(!empty($_REQUEST['document'])){
|
||||
$count = count($_REQUEST['document']);
|
||||
}
|
||||
else{
|
||||
$count=10;
|
||||
}
|
||||
|
||||
for($i=0; $i<$count; $i++) {
|
||||
if(isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) {
|
||||
$doc = new Document();
|
||||
$docRev = new DocumentRevision();
|
||||
$docNote = new Note();
|
||||
$noteFile = new UploadFile('none');
|
||||
|
||||
$doc->retrieve($_REQUEST['documentId'.$i]);
|
||||
$docRev->retrieve($doc->document_revision_id);
|
||||
|
||||
array_push($focus->saved_attachments, $docRev);
|
||||
|
||||
$docNote->name = $doc->document_name;
|
||||
$docNote->filename = $docRev->filename;
|
||||
$docNote->description = $doc->description;
|
||||
$docNote->parent_id = $focus->id;
|
||||
$docNote->parent_type = 'Emails';
|
||||
$docNote->file_mime_type = $docRev->file_mime_type;
|
||||
$docId = $docNote = $docNote->save();
|
||||
|
||||
$noteFile->duplicate_file($docRev->id, $docId, $docRev->filename);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//// END ATTACHMENTS FROM DOCUMENTS
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//// REMOVE ATTACHMENTS
|
||||
|
||||
if(isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
|
||||
foreach($_REQUEST['remove_attachment'] as $noteId) {
|
||||
$q = 'UPDATE notes SET deleted = 1 WHERE id = \''.$noteId.'\'';
|
||||
$focus->db->query($q);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//// END REMOVE ATTACHMENTS
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//// END ATTACHMENT HANDLING
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if($redirect) {
|
||||
$GLOBALS['log']->debug("Saved record with id of ".$return_id);
|
||||
handleRedirect($return_id, "EmailTemplates");
|
||||
}else{
|
||||
return $focus;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
46
modules/EmailTemplates/Menu.php
Executable file
46
modules/EmailTemplates/Menu.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?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): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
include('modules/Emails/Menu.php');
|
||||
?>
|
||||
109
modules/EmailTemplates/PopupDocumentsCampaignTemplate.html
Executable file
109
modules/EmailTemplates/PopupDocumentsCampaignTemplate.html
Executable file
@@ -0,0 +1,109 @@
|
||||
<!--
|
||||
/*********************************************************************************
|
||||
* 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/javascript/sugar_3.js"></script>
|
||||
<script type="text/javascript" language="Javascript" src="modules/Emails/javascript/Email.js"></script>
|
||||
|
||||
<!-- BEGIN: SearchHeader -->
|
||||
<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="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td scope="row" nowrap="nowrap">{MOD.LBL_DOC_NAME}</td>
|
||||
<td nowrap="nowrap"><input type="text" name="document_name" size="10" value="{DOCUMENT_NAME}"/></td>
|
||||
<td scope="row" nowrap="nowrap">{MOD.LBL_DET_IS_TEMPLATE}</td>
|
||||
<td nowrap="nowrap"><select name="is_template" >{IS_TEMPLATE_OPTIONS}</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row" nowrap="nowrap">{MOD.LBL_DET_TEMPLATE_TYPE}</td>
|
||||
<td nowrap="nowrap"><select name="template_type" >{TEMPLATE_TYPE_OPTIONS}</select></td>
|
||||
<td scope="row" nowrap="nowrap">{MOD.LBL_CATEGORY_VALUE}</td>
|
||||
<td nowrap="nowrap"><select name="category_id" >{CATEGORY_OPTIONS}</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope="row" nowrap="nowrap">{MOD.LBL_SUBCATEGORY_VALUE}</td>
|
||||
<td nowrap="nowrap"><select name="subcategory_id" >{SUB_CATEGORY_OPTIONS}</select></td>
|
||||
<td align="right" colspan=2>
|
||||
<input type="hidden" name="module" value="EmailTemplates" />
|
||||
<input type="hidden" name="action" value="PopupDocumentsCampaignTemplate" />
|
||||
<input type="hidden" name="to_pdf" value="true" />
|
||||
<input type="hidden" name="query" value="true" />
|
||||
<input type="hidden" name="record_id" value="" />
|
||||
<input type="hidden" name="target" value="{DOCUMENT_TARGET}" />
|
||||
<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>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- END: SearchHeader -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<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" width="33%" nowrap="nowrap"><a href="{ORDER_BY}document_name" class="listViewThLinkS1">{MOD.LBL_LIST_DOCUMENT}{arrow_start}{name_arrow}{arrow_end}</a></td>
|
||||
<td scope="col" width="33%" nowrap="nowrap">{MOD.LBL_LIST_REVISION}</td>
|
||||
<td scope="col" width="34%" nowrap="nowrap">{MOD.LBL_LIST_STATUS}</td>
|
||||
</tr>
|
||||
<!-- BEGIN: row -->
|
||||
<tr height="20" class="{ROW_COLOR}S1">
|
||||
<td scope="row" valign="top">
|
||||
<a href="javascript:void(0);" onclick="setDocumentToCampaignTemplate('{DOCUMENT_TARGET}','{DOCUMENT.ID}', '{DOCUMENT.DOCUMENT_NAME}','{DOCUMENT.DOCUMENT_REVISION_ID}','{DOCUMENT.LAST_REV_MIME_TYPE}');" >{DOCUMENT.DOCUMENT_NAME}</a>
|
||||
</td>
|
||||
<td valign="top">{DOCUMENT.LATEST_REVISION}</td>
|
||||
<td valign="top">{DOCUMENT.STATUS_ID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="20" class="listViewHRS1"></td>
|
||||
</tr>
|
||||
<!-- END: row -->
|
||||
</table>
|
||||
146
modules/EmailTemplates/PopupDocumentsCampaignTemplate.php
Executable file
146
modules/EmailTemplates/PopupDocumentsCampaignTemplate.php
Executable file
@@ -0,0 +1,146 @@
|
||||
<?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/Documents/Popup_picker.php');
|
||||
$popup = new Popup_Picker();
|
||||
|
||||
global $theme;
|
||||
global $current_mod_strings;
|
||||
global $app_strings;
|
||||
global $currentModule;
|
||||
global $sugar_version, $sugar_config;
|
||||
global $app_list_strings;
|
||||
|
||||
$current_mod_strings = return_module_language($current_language, 'Documents');
|
||||
$output_html = '';
|
||||
$where = '';
|
||||
|
||||
$where = $popup->_get_where_clause();
|
||||
|
||||
|
||||
|
||||
$name = empty($_REQUEST['name']) ? '' : $_REQUEST['name'];
|
||||
$document_name = empty($_REQUEST['document_name']) ? '' : $_REQUEST['document_name'];
|
||||
$category_id = empty($_REQUEST['category_id']) ? '' : $_REQUEST['category_id'];
|
||||
$subcategory_id = empty($_REQUEST['subcategory_id']) ? '' : $_REQUEST['subcategory_id'];
|
||||
$template_type = empty($_REQUEST['template_type']) ? '' : $_REQUEST['template_type'];
|
||||
$is_template = empty($_REQUEST['is_template']) ? '' : $_REQUEST['is_template'];
|
||||
$document_revision_id = empty($_REQUEST['document_revision_id']) ? '' : $_REQUEST['document_revision_id'];
|
||||
|
||||
|
||||
$hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
|
||||
$button = "<form action='index.php' method='post' name='form' id='form'>\n";
|
||||
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/EmailTemplates/PopupDocumentsCampaignTemplate.html');
|
||||
$form->assign('MOD', $current_mod_strings);
|
||||
$form->assign('APP', $app_strings);
|
||||
$form->assign('THEME', $theme);
|
||||
$form->assign('MODULE_NAME', $currentModule);
|
||||
$form->assign('NAME', $name);
|
||||
$form->assign('DOCUMENT_NAME', $document_name);
|
||||
$form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
|
||||
$form->assign('DOCUMENT_REVISION_ID', $document_revision_id);
|
||||
|
||||
$form->assign("CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_category_dom'], $category_id));
|
||||
$form->assign("SUB_CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_subcategory_dom'], $subcategory_id));
|
||||
$form->assign("IS_TEMPLATE_OPTIONS", get_select_options_with_id($app_list_strings['checkbox_dom'], $is_template));
|
||||
$form->assign("TEMPLATE_TYPE_OPTIONS", get_select_options_with_id($app_list_strings['document_template_type_dom'], $template_type));
|
||||
|
||||
|
||||
ob_start();
|
||||
insert_popup_header($theme);
|
||||
$output_html .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$output_html .= get_form_header($current_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 Document();
|
||||
$ListView = new ListView();
|
||||
$ListView->show_export_button = false;
|
||||
$ListView->process_for_popups = true;
|
||||
$ListView->setXTemplate($form);
|
||||
$ListView->setHeaderTitle($current_mod_strings['LBL_LIST_FORM_TITLE']);
|
||||
$ListView->setHeaderText($button);
|
||||
$ListView->setQuery($where, '', 'document_name', 'DOCUMENT');
|
||||
$ListView->setModStrings($current_mod_strings);
|
||||
|
||||
ob_start();
|
||||
$ListView->processListView($seed_bean, 'main', 'DOCUMENT');
|
||||
$output_html .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$output_html .= insert_popup_footer();
|
||||
|
||||
|
||||
echo $output_html;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
67
modules/EmailTemplates/Save.php
Executable file
67
modules/EmailTemplates/Save.php
Executable 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: Saves an Account record and then redirects the browser to the
|
||||
* defined return URL.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
$focus = new EmailTemplate();
|
||||
require_once('include/formbase.php');
|
||||
$focus = populateFromPost('', $focus);
|
||||
|
||||
require_once('modules/EmailTemplates/EmailTemplateFormBase.php');
|
||||
$form = new EmailTemplateFormBase();
|
||||
if(isset($_REQUEST['inpopupwindow']) and $_REQUEST['inpopupwindow'] == true) {
|
||||
$focus=$form->handleSave('',false, false); //do not redirect.
|
||||
$body1 = "
|
||||
<script type='text/javascript'>
|
||||
function refreshTemplates() {
|
||||
window.opener.refresh_email_template_list('$focus->id','$focus->name')
|
||||
window.close();
|
||||
}
|
||||
|
||||
refreshTemplates();
|
||||
</script>";
|
||||
echo $body1;
|
||||
} else {
|
||||
$form->handleSave('',true, false);
|
||||
}
|
||||
?>
|
||||
60
modules/EmailTemplates/field_arrays.php
Executable file
60
modules/EmailTemplates/field_arrays.php
Executable file
@@ -0,0 +1,60 @@
|
||||
<?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['EmailTemplate'] = array ('column_fields' => Array("id"
|
||||
, "date_entered"
|
||||
, "date_modified"
|
||||
, "modified_user_id"
|
||||
, "created_by"
|
||||
, "description"
|
||||
, "subject"
|
||||
, "body"
|
||||
, "body_html"
|
||||
, "name"
|
||||
, "published"
|
||||
),
|
||||
'list_fields' => Array('id', 'name', 'description','date_modified'
|
||||
),
|
||||
'required_fields' => array("name"=>1),
|
||||
);
|
||||
?>
|
||||
113
modules/EmailTemplates/language/en_us.lang.php
Executable file
113
modules/EmailTemplates/language/en_us.lang.php
Executable file
@@ -0,0 +1,113 @@
|
||||
<?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_ADD_ANOTHER_FILE' => 'Add Another File',
|
||||
'LBL_ADD_DOCUMENT' => 'Add a Sugar Document',
|
||||
'LBL_ADD_FILE' => 'Add a file',
|
||||
'LBL_ATTACHMENTS' => 'Attachments',
|
||||
'LBL_BODY' => 'Body:',
|
||||
'LBL_CLOSE' => 'Close:',
|
||||
'LBL_COLON' => ':',
|
||||
'LBL_CONTACT_AND_OTHERS' => 'Contact/Lead/Target',
|
||||
'LBL_DESCRIPTION' => 'Description:',
|
||||
'LBL_EDIT_ALT_TEXT' => 'Edit Plain Text',
|
||||
'LBL_EMAIL_ATTACHMENT' => 'Email Attachment',
|
||||
'LBL_HTML_BODY' => 'HTML Body',
|
||||
'LBL_INSERT_VARIABLE' => 'Insert Variable:',
|
||||
'LBL_INSERT_URL_REF' => 'Insert URL Reference',
|
||||
'LBL_INSERT_TRACKER_URL' => 'Insert Tracker URL:',
|
||||
'LBL_INSERT' => 'Insert',
|
||||
'LBL_LIST_DATE_MODIFIED' => 'Last Modified',
|
||||
'LBL_LIST_DESCRIPTION' => 'Description',
|
||||
'LBL_LIST_FORM_TITLE' => 'Email Templates List',
|
||||
'LBL_LIST_NAME' => 'Name',
|
||||
'LBL_MODULE_NAME' => 'Email Templates',
|
||||
'LBL_MODULE_TITLE' => 'Email Templates: Home',
|
||||
'LBL_NAME' => 'Name:',
|
||||
'LBL_NEW_FORM_TITLE' => 'Create Email Template',
|
||||
'LBL_PUBLISH' => 'Publish:',
|
||||
'LBL_RELATED_TO' => 'Related To:',
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Email Templates Search',
|
||||
'LBL_SHOW_ALT_TEXT' => 'Show Plain Text',
|
||||
'LBL_SUBJECT' => 'Subject:',
|
||||
'LBL_SUGAR_DOCUMENT' => 'Sugar Document',
|
||||
'LBL_TEAMS' => 'Teams:',
|
||||
'LBL_TEAMS_LINK' => 'Teams',
|
||||
'LBL_TEXT_BODY' => 'Text Body',
|
||||
'LBL_USERS' => 'Users',
|
||||
|
||||
'LNK_ALL_EMAIL_LIST' => 'All Emails',
|
||||
'LNK_ARCHIVED_EMAIL_LIST' => 'Archived Emails',
|
||||
'LNK_CHECK_EMAIL' => 'Check Mail',
|
||||
'LNK_DRAFTS_EMAIL_LIST' => 'All Drafts',
|
||||
'LNK_EMAIL_TEMPLATE_LIST' => 'View Email Templates',
|
||||
'LNK_IMPORT_NOTES' => 'Import Notes',
|
||||
'LNK_NEW_ARCHIVE_EMAIL' => 'Create Archived Email',
|
||||
'LNK_NEW_EMAIL_TEMPLATE' => 'Create Email Template',
|
||||
'LNK_NEW_EMAIL' => 'Archive Email',
|
||||
'LNK_NEW_SEND_EMAIL' => 'Compose Email',
|
||||
'LNK_SENT_EMAIL_LIST' => 'Sent Emails',
|
||||
'LNK_VIEW_CALENDAR' => 'Today',
|
||||
// for Inbox
|
||||
'LBL_NEW' => 'New',
|
||||
'LNK_CHECK_MY_INBOX' => 'Check My Mail',
|
||||
'LNK_GROUP_INBOX' => 'Group Inbox',
|
||||
'LNK_MY_ARCHIVED_LIST' => 'My Archives',
|
||||
'LNK_MY_DRAFTS' => 'My Drafts',
|
||||
'LNK_MY_INBOX' => 'My Email',
|
||||
'LBL_LIST_BASE_MODULE' => 'Base Module:',
|
||||
'LBL_TEXT_ONLY' => 'Text Only',
|
||||
'LBL_SEND_AS_TEXT' => 'Send Text Only',
|
||||
'LBL_ACCOUNT' => 'Account',
|
||||
'LBL_BASE_MODULE'=>'Base Module',
|
||||
'LBL_FROM_NAME'=>'From Name',
|
||||
'LBL_PLAIN_TEXT'=>'Plain Text',
|
||||
'LBL_CREATED_BY'=>'Created By',
|
||||
'LBL_FROM_ADDRESS'=>'From Address',
|
||||
'LBL_PUBLISHED'=>'Published',
|
||||
'LBL_ACTIVITIES_REPORTS' => 'Activities Report',
|
||||
'LNK_VIEW_MY_INBOX' => 'View My Email',
|
||||
);
|
||||
?>
|
||||
106
modules/EmailTemplates/language/pl_pl.lang.php
Executable file
106
modules/EmailTemplates/language/pl_pl.lang.php
Executable file
@@ -0,0 +1,106 @@
|
||||
<?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_ADD_ANOTHER_FILE'=> 'Dodaj inny plik',
|
||||
'LBL_ADD_DOCUMENT'=> 'Dodaj plik z SugarDokument',
|
||||
'LBL_ADD_FILE'=> 'Dodaj plik',
|
||||
'LBL_ATTACHMENTS'=> 'Załączniki',
|
||||
'LBL_BODY'=> 'Treść:',
|
||||
'LBL_CLOSE'=> 'Zamknij:',
|
||||
'LBL_COLON'=> ':',
|
||||
'LBL_CONTACT_AND_OTHERS'=>'Kontakty/Adresy/Potencjalni Klienci',
|
||||
'LBL_DESCRIPTION'=> 'Opis:',
|
||||
'LBL_EDIT_ALT_TEXT'=> 'Edytuj w formacie tekstowym',
|
||||
'LBL_EMAIL_ATTACHMENT'=> 'Załącznik wiadomości',
|
||||
'LBL_HTML_BODY'=> 'Kod HTML',
|
||||
'LBL_INSERT_VARIABLE'=> 'Wstaw zmienną:',
|
||||
'LBL_INSERT_URL_REF'=> 'Wstaw podstawowy URL',
|
||||
'LBL_INSERT_TRACKER_URL'=> 'Wstaw ścieżkę URL:',
|
||||
'LBL_INSERT'=> 'Wstaw',
|
||||
'LBL_LIST_DATE_MODIFIED'=> 'Ostatnio modyfikowane',
|
||||
'LBL_LIST_DESCRIPTION'=> 'Opis',
|
||||
'LBL_LIST_FORM_TITLE'=> 'Lista szablonów wiadmości',
|
||||
'LBL_LIST_NAME'=> 'Nazwa',
|
||||
'LBL_MODULE_NAME'=> 'Szablony wiadmosci',
|
||||
'LBL_MODULE_TITLE'=> 'Szablony wiadomości: Strona główna',
|
||||
'LBL_NAME'=> 'Nazwa:',
|
||||
'LBL_NEW_FORM_TITLE'=> 'Utwórz szablon wiadomości',
|
||||
'LBL_PUBLISH'=> 'Publikuj:',
|
||||
'LBL_RELATED_TO'=> 'Połaczone z:',
|
||||
'LBL_SEARCH_FORM_TITLE'=> 'Szukaj szablonów wiadomości',
|
||||
'LBL_SHOW_ALT_TEXT'=> 'Pokaż w formacie tekstowym',
|
||||
'LBL_SUBJECT'=> 'Temat:',
|
||||
'LBL_SUGAR_DOCUMENT' => 'Dokumenty Sugar',
|
||||
'LBL_TEAM'=> 'Zespół:',
|
||||
'LBL_TEAMS_LINK'=> 'Zespół',
|
||||
'LBL_TEXT_BODY'=> 'Tekst treści',
|
||||
'LBL_USERS'=> 'Użytkownicy',
|
||||
|
||||
'LNK_ALL_EMAIL_LIST'=> 'Wszystkie wiadomości',
|
||||
'LNK_ARCHIVED_EMAIL_LIST' => 'Wiadomości zarchiwizowane',
|
||||
'LNK_CHECK_EMAIL'=> 'Sprawdź pocztę',
|
||||
'LNK_DRAFTS_EMAIL_LIST'=> 'Wszystkie szkice',
|
||||
'LNK_EMAIL_TEMPLATE_LIST'=> 'Szablony wiadomości',
|
||||
'LNK_IMPORT_NOTES'=> 'Importuj notatki',
|
||||
'LNK_NEW_ARCHIVE_EMAIL'=> 'Utwórz zarchiwizowany email',
|
||||
'LNK_NEW_EMAIL_TEMPLATE' => 'Utwórz szablon wiadomości',
|
||||
'LNK_NEW_EMAIL'=> 'Archiwum wiadomości',
|
||||
'LNK_NEW_SEND_EMAIL'=> 'Napisz wiadomość',
|
||||
'LNK_SENT_EMAIL_LIST'=> 'Wyślij wiadomości',
|
||||
'LNK_VIEW_CALENDAR'=> 'Dziś',
|
||||
// for Inbox
|
||||
'LBL_NEW'=> 'Nowy',
|
||||
'LNK_CHECK_MY_INBOX'=> 'Sprawdź moją pocztę',
|
||||
'LNK_GROUP_INBOX'=> 'Skrzynka grupowa',
|
||||
'LNK_MY_ARCHIVED_LIST'=> 'Moje archiwum',
|
||||
'LNK_MY_DRAFTS'=> 'Moje szkice',
|
||||
'LNK_MY_INBOX'=> 'Moja skrzynka',
|
||||
|
||||
'LBL_LIST_BASE_MODULE'=> 'Moduł podstawowy:',
|
||||
'LBL_MODULE_NAME_WORKFLOW' => 'Szkice wiadomości prac do wykonania',
|
||||
'LBL_DEFAULT_LINK_TEXT'=> 'Domyślny tekst odnośnika.',
|
||||
'LBL_TEXT_ONLY' => 'Tylko jako tekst',
|
||||
'LBL_SEND_AS_TEXT' => 'Wyślij tylko jako tekst',
|
||||
'LBL_ACCOUNT' => 'Konto',
|
||||
'LBL_BASE_MODULE'=>'Moduł podstawowy',
|
||||
'LBL_FROM_NAME'=>'Nazwa Od',
|
||||
'LBL_PLAIN_TEXT'=>'Zwykły tekst',
|
||||
'LBL_CREATED_BY'=>'Utworzone przez',
|
||||
'LBL_FROM_ADDRESS'=>'Adres Od',
|
||||
'LBL_PUBLISHED'=>'Opublikowany',
|
||||
'LBL_ACTIVITIES_REPORTS' => 'Raport aktywności',
|
||||
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
42
modules/EmailTemplates/metadata/SearchFields.php
Executable file
42
modules/EmailTemplates/metadata/SearchFields.php
Executable file
@@ -0,0 +1,42 @@
|
||||
<?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['EmailTemplates'] =
|
||||
array (
|
||||
'name' => array( 'query_type'=>'default'),
|
||||
'description'=> array('query_type'=>'default'),
|
||||
);
|
||||
?>
|
||||
55
modules/EmailTemplates/metadata/listviewdefs.php
Executable file
55
modules/EmailTemplates/metadata/listviewdefs.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
$listViewDefs['EmailTemplates'] = array(
|
||||
'NAME' => array(
|
||||
'width' => '20',
|
||||
'label' => 'LBL_NAME',
|
||||
'link' => true,
|
||||
'default' => true),
|
||||
'DESCRIPTION' => array(
|
||||
'width' => '40',
|
||||
'default' => true,
|
||||
'label' => 'LBL_DESCRIPTION'),
|
||||
'DATE_MODIFIED' => array(
|
||||
'width' => '10',
|
||||
'default' => true,
|
||||
'label' => 'LBL_DATE_MODIFIED'),
|
||||
);
|
||||
?>
|
||||
54
modules/EmailTemplates/metadata/searchdefs.php
Executable file
54
modules/EmailTemplates/metadata/searchdefs.php
Executable file
@@ -0,0 +1,54 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*
|
||||
* Created on May 29, 2007
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
||||
*/
|
||||
$searchdefs['EmailTemplates'] = array(
|
||||
'templateMeta' => array(
|
||||
'maxColumns' => '2',
|
||||
'widths' => array('label' => '10', 'field' => '30'),
|
||||
),
|
||||
'layout' => array(
|
||||
'basic_search' => array(
|
||||
'name',
|
||||
),
|
||||
'advanced_search' => array('name','subject','description')
|
||||
),
|
||||
);
|
||||
?>
|
||||
156
modules/EmailTemplates/vardefs.php
Executable file
156
modules/EmailTemplates/vardefs.php
Executable file
@@ -0,0 +1,156 @@
|
||||
<?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['EmailTemplate'] = array(
|
||||
'table' => 'email_templates', 'comment' => 'Templates used in email processing',
|
||||
'fields' => array(
|
||||
'id' => array(
|
||||
'name' => 'id',
|
||||
'vname' => 'LBL_NAME',
|
||||
'type' => 'id',
|
||||
'required' => true,
|
||||
'reportable'=>false,
|
||||
'comment' => 'Unique identifier'
|
||||
),
|
||||
'date_entered' => array(
|
||||
'name' => 'date_entered',
|
||||
'vname' => 'LBL_DATE_ENTERED',
|
||||
'type' => 'datetime',
|
||||
'required'=>true,
|
||||
'comment' => 'Date record created'
|
||||
),
|
||||
'date_modified' => array(
|
||||
'name' => 'date_modified',
|
||||
'vname' => 'LBL_DATE_MODIFIED',
|
||||
'type' => 'datetime',
|
||||
'required'=>true,
|
||||
'comment' => 'Date record last modified'
|
||||
),
|
||||
'modified_user_id' => array(
|
||||
'name' => 'modified_user_id',
|
||||
'rname' => 'user_name',
|
||||
'id_name' => 'modified_user_id',
|
||||
'vname' => 'LBL_ASSIGNED_TO',
|
||||
'type' => 'assigned_user_name',
|
||||
'table' => 'users',
|
||||
'reportable'=>true,
|
||||
'isnull' => 'false',
|
||||
'dbType' => 'id',
|
||||
'comment' => 'User who last modified record'
|
||||
),
|
||||
'created_by' => array(
|
||||
'name' => 'created_by',
|
||||
'vname' => 'LBL_CREATED_BY',
|
||||
'type' => 'varchar',
|
||||
'len'=> '36',
|
||||
'comment' => 'User who created record'
|
||||
),
|
||||
'published' => array(
|
||||
'name' => 'published',
|
||||
'vname' => 'LBL_PUBLISHED',
|
||||
'type' => 'varchar',
|
||||
'len' => '3',
|
||||
'comment' => ''
|
||||
),
|
||||
'name' => array(
|
||||
'name' => 'name',
|
||||
'vname' => 'LBL_NAME',
|
||||
'type' => 'varchar',
|
||||
'len' => '255',
|
||||
'comment' => 'Email template name',
|
||||
'importable' => 'required',
|
||||
),
|
||||
'description' => array(
|
||||
'name' => 'description',
|
||||
'vname' => 'LBL_DESCRIPTION',
|
||||
'type' => 'text',
|
||||
'comment' => 'Email template description'
|
||||
),
|
||||
'subject' => array(
|
||||
'name' => 'subject',
|
||||
'vname' => 'LBL_SUBJECT',
|
||||
'type' => 'varchar',
|
||||
'len' => '255',
|
||||
'comment' => 'Email subject to be used in resulting email'
|
||||
),
|
||||
'body' => array(
|
||||
'name' => 'body',
|
||||
'vname' => 'LBL_BODY',
|
||||
'type' => 'text',
|
||||
'comment' => 'Plain text body to be used in resulting email'
|
||||
),
|
||||
'body_html' => array(
|
||||
'name' => 'body_html',
|
||||
'vname' => 'LBL_PLAIN_TEXT',
|
||||
'type' => 'text',
|
||||
'comment' => 'HTML formatted email body to be used in resulting email'
|
||||
),
|
||||
'deleted' => array(
|
||||
'name' => 'deleted',
|
||||
'vname' => 'LBL_DELETED',
|
||||
'type' => 'bool',
|
||||
'required' => false,
|
||||
'reportable'=>false,
|
||||
'comment' => 'Record deletion indicator'
|
||||
),
|
||||
'text_only' => array(
|
||||
'name' => 'text_only',
|
||||
'vname' => 'LBL_TEXT_ONLY',
|
||||
'type' => 'bool',
|
||||
'required' => false,
|
||||
'reportable'=>false,
|
||||
'comment' => 'Should be checked if email template is to be sent in text only'
|
||||
),
|
||||
),
|
||||
'indices' => array(
|
||||
array(
|
||||
'name' => 'email_templatespk',
|
||||
'type' =>'primary',
|
||||
'fields'=>array('id')
|
||||
),
|
||||
array(
|
||||
'name' => 'idx_email_template_name',
|
||||
'type'=>'index',
|
||||
'fields'=>array('name')
|
||||
)
|
||||
),
|
||||
'relationships' => array(
|
||||
),
|
||||
);
|
||||
|
||||
VardefManager::createVardef('EmailTemplates','EmailTemplate', array(
|
||||
));
|
||||
?>
|
||||
Reference in New Issue
Block a user