init
This commit is contained in:
1000
modules/Emails/javascript/Email.js
Executable file
1000
modules/Emails/javascript/Email.js
Executable file
File diff suppressed because it is too large
Load Diff
3518
modules/Emails/javascript/EmailUI.js
Executable file
3518
modules/Emails/javascript/EmailUI.js
Executable file
File diff suppressed because it is too large
Load Diff
2429
modules/Emails/javascript/EmailUICompose.js
Executable file
2429
modules/Emails/javascript/EmailUICompose.js
Executable file
File diff suppressed because it is too large
Load Diff
89
modules/Emails/javascript/EmailUIShared.js
Executable file
89
modules/Emails/javascript/EmailUIShared.js
Executable file
@@ -0,0 +1,89 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
SUGAR.email2 = {
|
||||
cache : new Object(),
|
||||
o : null, // holder for reference to AjaxObject's return object (used in composeDraft())
|
||||
reGUID : new RegExp(/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/i),
|
||||
templates : {},
|
||||
tinyInstances : {
|
||||
currentHtmleditor : ''
|
||||
},
|
||||
|
||||
/**
|
||||
* preserves hits from email server
|
||||
*/
|
||||
_setDetailCache : function(ret) {
|
||||
if(ret.meta) {
|
||||
var compKey = ret.meta.mbox + ret.meta.uid;
|
||||
|
||||
if(!SUGAR.email2.cache[compKey]) {
|
||||
SUGAR.email2.cache[compKey] = ret;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
autoSetLayout : function() {
|
||||
var c = document.getElementById('container');
|
||||
var tHeight = YAHOO.util.Dom.getViewportHeight() - YAHOO.util.Dom.getY(c) - 35;
|
||||
//Ensure a minimum height.
|
||||
tHeight = Math.max(tHeight, 550);
|
||||
c.style.height = tHeight + "px";
|
||||
SUGAR.email2.complexLayout.set('height', tHeight);
|
||||
SUGAR.email2.complexLayout.set('width', YAHOO.util.Dom.getViewportWidth() - 40);
|
||||
SUGAR.email2.complexLayout.render();
|
||||
SUGAR.email2.listViewLayout.resizePreview();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Shows overlay progress message
|
||||
*/
|
||||
function overlayModal(title, body) {
|
||||
overlay(title, body);
|
||||
}
|
||||
function overlay(reqtitle, body, type, additconfig) {
|
||||
var config = { };
|
||||
if (typeof(additconfig) == "object") {
|
||||
var config = additconfig;
|
||||
}
|
||||
config.type = type;
|
||||
config.title = reqtitle;
|
||||
config.msg = body;
|
||||
YAHOO.SUGAR.MessageBox.show(config);
|
||||
};
|
||||
|
||||
function hideOverlay() {
|
||||
YAHOO.SUGAR.MessageBox.hide();
|
||||
};
|
||||
1604
modules/Emails/javascript/ajax.js
Executable file
1604
modules/Emails/javascript/ajax.js
Executable file
File diff suppressed because it is too large
Load Diff
272
modules/Emails/javascript/complexLayout.js
Executable file
272
modules/Emails/javascript/complexLayout.js
Executable file
@@ -0,0 +1,272 @@
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
/**
|
||||
Complex layout init
|
||||
*/
|
||||
function complexLayoutInit() {
|
||||
var se = SUGAR.email2;
|
||||
var Dom = YAHOO.util.Dom;
|
||||
se.e2Layout = {
|
||||
getInnerLayout : function(rows) {
|
||||
se.listViewLayout = new YAHOO.widget.Layout('listViewDiv', {
|
||||
parent: se.complexLayout,
|
||||
border:true,
|
||||
hideOnLayout: true,
|
||||
height: 400,
|
||||
units: [{
|
||||
position: "center",
|
||||
scroll:false, // grid should autoScroll itself
|
||||
split:true,
|
||||
body: "<div id='emailGrid'></div><div id='dt-pag-nav'></div> "
|
||||
},{
|
||||
position: "bottom",
|
||||
scroll:true,
|
||||
collapse: false,
|
||||
resize: true,
|
||||
useShim:true,
|
||||
height:'250',
|
||||
body: "<div id='listBottom' />"
|
||||
},{
|
||||
position: "right",
|
||||
scroll:true,
|
||||
collapse: false,
|
||||
resize: true,
|
||||
useShim:true,
|
||||
width:'250',
|
||||
body: "<div id='listRight' />",
|
||||
titlebar: false //,header: "right"
|
||||
}]
|
||||
});
|
||||
se.complexLayout.on("render", function(){
|
||||
var height = SUGAR.email2.innerLayout.get("element").clientHeight - 30;
|
||||
SUGAR.email2.innerLayout.get("activeTab").get("contentEl").parentNode.style.height = height + "px";
|
||||
SUGAR.email2.listViewLayout.set("height", height);
|
||||
SUGAR.email2.listViewLayout.render();
|
||||
});
|
||||
se.listViewLayout.render();
|
||||
//CSS hack for now
|
||||
se.listViewLayout.get("element").parentNode.parentNode.style.padding = "0px"
|
||||
var rp = se.listViewLayout.resizePreview = function() {
|
||||
var pre = Dom.get("displayEmailFramePreview");
|
||||
if (pre) {
|
||||
var parent = Dom.getAncestorByClassName(pre, "yui-layout-bd");
|
||||
pre.style.height = (parent.clientHeight - pre.offsetTop) + "px";
|
||||
}
|
||||
};
|
||||
se.listViewLayout.getUnitByPosition("bottom").on("heightChange", se.autoSetLayout);
|
||||
se.listViewLayout.getUnitByPosition("right").on("endResize", se.autoSetLayout);
|
||||
se.e2Layout.setPreviewPanel(rows);
|
||||
se.previewLayout = se.listViewLayout;
|
||||
return se.listViewLayout;
|
||||
},
|
||||
|
||||
getInnerLayout2Rows : function() {
|
||||
return this.getInnerLayout(true);
|
||||
},
|
||||
getInnerLayout2Columns : function() {
|
||||
return this.getInnerLayout(false);
|
||||
},
|
||||
|
||||
init : function(){
|
||||
// initialize state manager, we will use cookies
|
||||
// Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
|
||||
var viewHeight = document.documentElement ? document.documentElement.clientHeight : self.innerHeight;
|
||||
se.complexLayout = new YAHOO.widget.Layout("container", {
|
||||
border:true,
|
||||
hideOnLayout: true,
|
||||
height: Dom.getViewportHeight() - (document.getElementById('header').clientHeight ) - 65,
|
||||
width: Dom.getViewportWidth() - 40,
|
||||
units: [{
|
||||
position: "center",
|
||||
scroll:false,
|
||||
body: "<div id='emailtabs'></div>"
|
||||
},
|
||||
{
|
||||
position: "left",
|
||||
scroll: true,
|
||||
body: "<div id='lefttabs'></div>",
|
||||
collapse: true,
|
||||
width: 210,
|
||||
minWidth: 100,
|
||||
resize:true,
|
||||
useShim:true,
|
||||
titlebar: true,
|
||||
header: " "
|
||||
},
|
||||
{
|
||||
header: Dom.get('footerLinks').innerHTML,
|
||||
position: 'bottom',
|
||||
id: 'mbfooter',
|
||||
height: 22,
|
||||
border: false
|
||||
}]
|
||||
});
|
||||
se.complexLayout.render();
|
||||
var tp = se.innerLayout = new YAHOO.widget.TabView("emailtabs");
|
||||
tp.addTab(new YAHOO.widget.Tab({
|
||||
label: "Inbox",
|
||||
scroll : true,
|
||||
content : "<div id='listViewDiv'/>",
|
||||
id : "center",
|
||||
active : true
|
||||
}));
|
||||
var centerEl = se.complexLayout.getUnitByPosition('center').get('wrap');
|
||||
tp.appendTo(centerEl);
|
||||
//CSS hack for now
|
||||
tp.get("element").style.borderRight = "1px solid #666"
|
||||
|
||||
var listV = this.getInnerLayout2Rows();
|
||||
listV.set("height", tp.get("element").clientHeight - 25);
|
||||
listV.render();
|
||||
|
||||
se.leftTabs = new YAHOO.widget.TabView("lefttabs");
|
||||
var folderTab = new YAHOO.widget.Tab({
|
||||
label: app_strings.LBL_EMAIL_FOLDERS_SHORT,
|
||||
scroll : true,
|
||||
content : "<div id='emailtree'/>",
|
||||
id : "tree",
|
||||
active : true
|
||||
});
|
||||
folderTab.on("activeChange", function(o){
|
||||
if (o.newValue) {
|
||||
se.complexLayout.getUnitByPosition("left").set("header", app_strings.LBL_EMAIL_FOLDERS);
|
||||
}
|
||||
});
|
||||
se.leftTabs.addTab(folderTab);
|
||||
|
||||
var tabContent = SUGAR.util.getAndRemove("searchTab");
|
||||
var searchTab = new YAHOO.widget.Tab({
|
||||
label: app_strings.LBL_EMAIL_SEARCH_SHORT,
|
||||
scroll : true,
|
||||
content : tabContent.innerHTML,
|
||||
id : tabContent.id
|
||||
});
|
||||
searchTab.on("activeChange", function(o){
|
||||
if (o.newValue)
|
||||
{
|
||||
se.complexLayout.getUnitByPosition("left").set("header", app_strings.LBL_EMAIL_SEARCH);
|
||||
//Setup the calendars if needed
|
||||
Calendar.setup ({inputField : "searchDateFrom", ifFormat : calFormat, showsTime : false, button : "jscal_trigger_from", singleClick : true, step : 1, weekNumbers:false});
|
||||
Calendar.setup ({inputField : "searchDateTo", ifFormat : calFormat, showsTime : false, button : "jscal_trigger_to", singleClick : true, step : 1, weekNumbers:false});
|
||||
|
||||
//Initalize sqs object for assigned user name
|
||||
se.e2Layout.initSQSObject('advancedSearchForm','assigned_user_name');
|
||||
|
||||
//Attach event handler for when the relate module option is selected for the correct sqs object
|
||||
var parentSearchArgs = {'formName':'advancedSearchForm','fieldName':'data_parent_name_search',
|
||||
'moduleSelectField':'data_parent_type_search','fieldId':'data_parent_id_search'};
|
||||
YAHOO.util.Event.addListener('data_parent_type_search', 'change',function(){
|
||||
SUGAR.email2.composeLayout.enableQuickSearchRelate(null,parentSearchArgs) });
|
||||
|
||||
//If enter key is pressed, perform search
|
||||
var addKeyPressFields = ['searchSubject','searchFrom','searchTo','data_parent_name_search','searchDateTo','searchDateFrom','attachmentsSearch','assigned_user_name'];
|
||||
for(var i=0; i < addKeyPressFields.length;i++)
|
||||
{
|
||||
YAHOO.util.Event.addListener(window.document.forms['advancedSearchForm'].elements[addKeyPressFields[i]],"keydown", function(e){
|
||||
if (e.keyCode == 13) {
|
||||
YAHOO.util.Event.stopEvent(e);
|
||||
SUGAR.email2.search.searchAdvanced();
|
||||
}
|
||||
});
|
||||
}
|
||||
//Initiate quick search for the search tab. Do this only when the tab is selected rather than onDomLoad for perf. gains.
|
||||
enableQS(true);
|
||||
//Clear parent values if selecting another parent type.
|
||||
YAHOO.util.Event.addListener('data_parent_type_search','change',
|
||||
function(){
|
||||
document.getElementById('data_parent_id_search').value ='';
|
||||
document.getElementById('data_parent_name_search').value ='';
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
se.leftTabs.addTab(searchTab);
|
||||
|
||||
var resizeTabBody = function() {
|
||||
var height = SUGAR.email2.leftTabs.get("element").clientHeight - 30;
|
||||
SUGAR.email2.leftTabs.get("activeTab").get("contentEl").parentNode.style.height = height + "px";
|
||||
}
|
||||
resizeTabBody();
|
||||
se.complexLayout.on("render", resizeTabBody);
|
||||
se.leftTabs.on("activeTabChange", resizeTabBody);
|
||||
//hack to allow left pane scroll bar to fully show
|
||||
var lefttabsDiv = document.getElementById('lefttabs');
|
||||
var lefttabsDivParent = Dom.getAncestorBy(lefttabsDiv);
|
||||
var lefttabsDivGParent = Dom.getAncestorBy(lefttabsDivParent);
|
||||
lefttabsDivParent.style.width = lefttabsDivGParent.offsetWidth - 10 + "px";
|
||||
|
||||
},
|
||||
initSQSObject: function(formName,fieldName)
|
||||
{
|
||||
var fullFieldName = formName + '_' + fieldName; //SQS Convention
|
||||
var resultName = fullFieldName + '_' + 'results';
|
||||
|
||||
if (QSFieldsArray[fullFieldName] != null)
|
||||
{
|
||||
QSFieldsArray[fullFieldName].destroy();
|
||||
delete QSFieldsArray[fullFieldName];
|
||||
}
|
||||
if (QSProcessedFieldsArray[fullFieldName])
|
||||
QSProcessedFieldsArray[fullFieldName] = false;
|
||||
|
||||
if( Dom.get(resultName) )
|
||||
{
|
||||
var obj = document.getElementById(resultName);
|
||||
obj.parentNode.removeChild(obj);
|
||||
}
|
||||
},
|
||||
setPreviewPanel: function(rows) {
|
||||
if (rows) {
|
||||
SUGAR.email2.listViewLayout.getUnitByPosition("right").set("width", 0);
|
||||
SUGAR.email2.listViewLayout.getUnitByPosition("bottom").set("height", 250);
|
||||
Dom.get("listRight").innerHTML = "";
|
||||
Dom.get("listBottom").innerHTML = "<div id='_blank' />";
|
||||
} else {
|
||||
SUGAR.email2.listViewLayout.getUnitByPosition("bottom").set("height", 0);
|
||||
SUGAR.email2.listViewLayout.getUnitByPosition("right").set("width", 250);
|
||||
Dom.get("listBottom").innerHTML = "";
|
||||
Dom.get("listRight").innerHTML = "<div id='_blank' />";
|
||||
}
|
||||
}
|
||||
};
|
||||
se.e2Layout.init();
|
||||
}
|
||||
|
||||
var myBufferedListenerObject = new Object();
|
||||
myBufferedListenerObject.refit = function() {
|
||||
if(SUGAR.email2.grid) {
|
||||
SUGAR.email2.grid.autoSize();
|
||||
}
|
||||
}
|
||||
245
modules/Emails/javascript/composeEmailTemplate.js
Executable file
245
modules/Emails/javascript/composeEmailTemplate.js
Executable file
@@ -0,0 +1,245 @@
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
SUGAR.email2.templates['compose'] = '<div id="composeLayout{idx}" class="ylayout-inactive-content"></div>' +
|
||||
'<div id="composeOverFrame{idx}" style="height:100%;width:100%">' +
|
||||
' <form id="emailCompose{idx}" name="ComposeEditView{idx}" action="index.php" method="POST">' +
|
||||
' <input type="hidden" id="email_id{idx}" name="email_id" value="">' +
|
||||
' <input type="hidden" id="uid{idx}" name="uid" value="">' +
|
||||
' <input type="hidden" id="ieId{idx}" name="ieId" value="">' +
|
||||
' <input type="hidden" id="mbox{idx}" name="mbox" value="">' +
|
||||
' <input type="hidden" id="type{idx}" name="type" value="">' +
|
||||
' <input type="hidden" id="composeLayoutId" name="composeLayoutId" value="shouldNotSeeMe">' +
|
||||
' <input type="hidden" id="composeType" name="composeType">' +
|
||||
' <input type="hidden" id="fromAccount" name="fromAccount">' +
|
||||
' <input type="hidden" id="sendSubject" name="sendSubject">' +
|
||||
' <input type="hidden" id="sendDescription" name="sendDescription">' +
|
||||
' <input type="hidden" id="sendTo" name="sendTo">' +
|
||||
' <input type="hidden" id="sendBcc" name="sendBcc">' +
|
||||
' <input type="hidden" id="sendCc" name="sendCc">' +
|
||||
' <input type="hidden" id="setEditor" name="setEditor">' +
|
||||
' <input type="hidden" id="saveToSugar" name="saveToSugar">' +
|
||||
' <input type="hidden" id="parent_id" name="parent_id">' +
|
||||
' <input type="hidden" id="parent_type" name="parent_type">' +
|
||||
' <input type="hidden" id="attachments" name="attachments">' +
|
||||
' <input type="hidden" id="documents" name="documents">' +
|
||||
' <input type="hidden" id="outbound_email{idx}" name="outbound_email">' +
|
||||
' <input type="hidden" id="templateAttachments" name="templateAttachments">' +
|
||||
' <input type="hidden" id="templateAttachmentsRemove{idx}" name="templateAttachmentsRemove">' +
|
||||
' <table id="composeHeaderTable{idx}" cellpadding="0" cellspacing="0" border="0" width="100%" class="list">' +
|
||||
' <tr>' +
|
||||
' <th><table cellpadding="0" cellspacing="0" border="0"><tbody><tr ><td style="padding: 0px !important;margin:0px; !important" >' +
|
||||
' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.sendEmail({idx}, false);"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=icon_email_send.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_SEND}</button>' +
|
||||
' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.saveDraft({idx}, false);"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=icon_email_save.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_SAVE_DRAFT}</button>' +
|
||||
' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.showAttachmentPanel({idx}, false);"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=icon_email_attach.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_ATTACHMENT}</button>' +
|
||||
' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.showOptionsPanel({idx}, false);"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=icon_email_options.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_OPTIONS}</button>' +
|
||||
'</td><td style="padding: 0px !important;margin:0px; !important"> {mod_strings.LBL_EMAIL_RELATE}: <select class="select" id="data_parent_type{idx}" onchange="document.getElementById(\'data_parent_name{idx}\').value=\'\';document.getElementById(\'data_parent_id{idx}\').value=\'\'; SUGAR.email2.composeLayout.enableQuickSearchRelate(\'{idx}\');" name="data_parent_type{idx}">{linkbeans_options}</select>' +
|
||||
' </td><td style="padding: 0px !important;margin:0px; !important"><input id="data_parent_id{idx}" name="data_parent_id{idx}" type="hidden" value="">' +
|
||||
'<input class="sqsEnabled" id="data_parent_name{idx}" name="data_parent_name{idx}" type="text" value=""> <button type="button" class="button" onclick="SUGAR.email2.composeLayout.callopenpopupForEmail2({idx});"><img src="index.php?entryPoint=getImage&themeName=default&imageName=id-ff-select.png" align="absmiddle" border="0"></button>' +
|
||||
' </td></tr></tbody></table></th>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' <div style="margin:5px;">' +
|
||||
' <table cellpadding="4" cellspacing="0" border="0" width="100%">' +
|
||||
' <tr>' +
|
||||
' <td class="emailUILabel" NOWRAP >' +
|
||||
' {app_strings.LBL_EMAIL_FROM}:' +
|
||||
' </td>' +
|
||||
' <td class="emailUIField" NOWRAP>' +
|
||||
' <div>' +
|
||||
' <select style="width: 500px;" class="ac_input" id="addressFrom{idx}" name="addressFrom{idx}"></select>' +
|
||||
' </div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td class="emailUILabel" NOWRAP>' +
|
||||
' <button class="button" type="button" onclick="SUGAR.email2.addressBook.selectContactsDialogue(\'addressTO{idx}\')">' +
|
||||
' {app_strings.LBL_EMAIL_TO}:' +
|
||||
' </button>' +
|
||||
' </td>' +
|
||||
' <td class="emailUIField" NOWRAP>' +
|
||||
' <div class="ac_autocomplete">' +
|
||||
' <input class="ac_input" type="text" size="96" id="addressTO{idx}" name="addressTO{idx}" onkeyup="SE.composeLayout.showAddressDetails(this);">' +
|
||||
' <span class="rolloverEmail"> <a id="MoreaddressTO{idx}" href="#" style="display: none;">+<span id="DetailaddressTO{idx}"> </span></a> </span>' +
|
||||
' <div class="ac_container" id="addressToAC{idx}"></div>' +
|
||||
' </div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr id="add_addr_options_tr{idx}">' +
|
||||
' <td class="emailUILabel" NOWRAP> </td><td class="emailUIField" valign="top" NOWRAP> <span id="cc_span{idx}"><a href="#" onclick="SE.composeLayout.showHiddenAddress(\'cc\',\'{idx}\');">{mod_strings.LBL_ADD_CC}</a></span><span id="bcc_cc_sep{idx}"> {mod_strings.LBL_ADD_CC_BCC_SEP} </span><span id="bcc_span{idx}"><a href="#" onclick="SE.composeLayout.showHiddenAddress(\'bcc\',\'{idx}\');">{mod_strings.LBL_ADD_BCC}</a></span></td>'+
|
||||
' </tr>'+
|
||||
' <tr class="yui-hidden" id="cc_tr{idx}">' +
|
||||
' <td class="emailUILabel" NOWRAP>' +
|
||||
' <button class="button" type="button" onclick="SUGAR.email2.addressBook.selectContactsDialogue(\'addressCC{idx}\')">' +
|
||||
' {app_strings.LBL_EMAIL_CC}:' +
|
||||
' </button>' +
|
||||
' </td>' +
|
||||
' <td class="emailUIField" NOWRAP>' +
|
||||
' <div class="ac_autocomplete">' +
|
||||
' <input class="ac_input" type="text" size="96" id="addressCC{idx}" name="addressCC{idx}" onkeyup="SE.composeLayout.showAddressDetails(this);">' +
|
||||
' <span class="rolloverEmail"> <a id="MoreaddressCC{idx}" href="#" style="display: none;">+<span id="DetailaddressCC{idx}"> </span></a> </span>' +
|
||||
' <div class="ac_container" id="addressCcAC{idx}"></div>' +
|
||||
' </div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr class="yui-hidden" id="bcc_tr{idx}">' +
|
||||
' <td class="emailUILabel" NOWRAP>' +
|
||||
' <button class="button" type="button" onclick="SUGAR.email2.addressBook.selectContactsDialogue(\'addressBCC{idx}\')">' +
|
||||
' {app_strings.LBL_EMAIL_BCC}:' +
|
||||
' </button>' +
|
||||
' </td>' +
|
||||
' <td class="emailUIField" NOWRAP>' +
|
||||
' <div class="ac_autocomplete">' +
|
||||
' <input class="ac_input" type="text" size="96" id="addressBCC{idx}" name="addressBCC{idx}" onkeyup="SE.composeLayout.showAddressDetails(this);">' +
|
||||
' <span class="rolloverEmail"> <a id="MoreaddressBCC{idx}" href="#" style="display: none;">+<span id="DetailaddressBCC{idx}"> </span></a> </span>' +
|
||||
' <div class="ac_container" id="addressBccAC{idx}"></div>' +
|
||||
' </div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td class="emailUILabel" NOWRAP width="1%">' +
|
||||
' {app_strings.LBL_EMAIL_SUBJECT}:' +
|
||||
' </td>' +
|
||||
' <td class="emailUIField" NOWRAP width="99%">' +
|
||||
' <div class="ac_autocomplete">' +
|
||||
' <input class="ac_input" type="text" size="96" id="emailSubject{idx}" name="subject{idx}" value="">' +
|
||||
' </div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' </table>' +
|
||||
' </div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' </table>' +
|
||||
' <textarea id="htmleditor{idx}" name="htmleditor{idx}" style="width:100%; height: 100px;"></textarea>' +
|
||||
' <div id="divAttachments{idx}" class="ylayout-inactive-content">' +
|
||||
' <div style="padding:5px;">' +
|
||||
' <table cellpadding="2" cellspacing="0" border="0">' +
|
||||
' <tr>' +
|
||||
' <th>' +
|
||||
' <b>{app_strings.LBL_EMAIL_ATTACHMENTS}</b>' +
|
||||
' <br />' +
|
||||
' ' +
|
||||
' </th>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' <input type="button" name="add_file_button" onclick="SUGAR.email2.composeLayout.addFileField();" value="{mod_strings.LBL_ADD_FILE}" class="button" />' +
|
||||
' <div id="addedFiles{idx}" name="addedFiles{idx}"></div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' ' +
|
||||
' <br />' +
|
||||
' ' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <th>' +
|
||||
' <b>{app_strings.LBL_EMAIL_ATTACHMENTS2}</b>' +
|
||||
' <br />' +
|
||||
' ' +
|
||||
' </th>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' <input type="button" name="add_document_button" onclick="SUGAR.email2.composeLayout.addDocumentField({idx});" value="{mod_strings.LBL_ADD_DOCUMENT}" class="button" />' +
|
||||
' <div id="addedDocuments{idx}"></div>' + //<input name="document{idx}0" id="document{idx}0" type="hidden" /><input name="documentId{idx}0" id="documentId{idx}0" type="hidden" /><input name="documentName{idx}0" id="documentName{idx}0" disabled size="30" type="text" /><input type="button" id="documentSelect{idx}0" onclick="SUGAR.email2.selectDocument({idx}0, this);" class="button" value="{app_strings.LBL_EMAIL_SELECT}" /><input type="button" id="documentRemove{idx}0" onclick="SUGAR.email2.deleteDocumentField({idx}0, this);" class="button" value="{app_strings.LBL_EMAIL_REMOVE}" /><br /></div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' ' +
|
||||
' <br />' +
|
||||
' ' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <th>' +
|
||||
' <div id="templateAttachmentsTitle{idx}" style="display:none"><b>{app_strings.LBL_EMAIL_ATTACHMENTS3}</b></div>' +
|
||||
' <br />' +
|
||||
' ' +
|
||||
' </th>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' <div id="addedTemplateAttachments{idx}"></div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' </table>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' </form>' +
|
||||
' <div id="divOptions{idx}" class="ylayout-inactive-content"' +
|
||||
' <div style="padding:5px;">' +
|
||||
' <form name="composeOptionsForm{idx}" id="composeOptionsForm{idx}">' +
|
||||
' <table border="0" width="100%">' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <b>{app_strings.LBL_EMAIL_TEMPLATES}:</b>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <select name="email_template{idx}" id="email_template{idx}" onchange="SUGAR.email2.composeLayout.applyEmailTemplate(\'{idx}\', this.options[this.selectedIndex].value);"></select>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' </table>' +
|
||||
' <br />' +
|
||||
' <table border="0" width="100%">' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <b>{app_strings.LBL_EMAIL_SIGNATURES}:</b>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <select name="signatures{idx}" id="signatures{idx}" onchange="SUGAR.email2.composeLayout.setSignature(\'{idx}\');"></select>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' </table>' +
|
||||
' <table border="0" width="100%">' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <input type="checkbox" id="setEditor{idx}" name="setEditor{idx}" value="1" onclick="SUGAR.email2.composeLayout.renderTinyMCEToolBar(\'{idx}\', this.checked);"/> ' +
|
||||
' <b>{mod_strings.LBL_SEND_IN_PLAIN_TEXT}</b>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' </table>' +
|
||||
' </form>' +
|
||||
' </div> ' +
|
||||
' </div>' +
|
||||
'</div>';
|
||||
276
modules/Emails/javascript/composeEmailTemplate1.js
Executable file
276
modules/Emails/javascript/composeEmailTemplate1.js
Executable file
@@ -0,0 +1,276 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU 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 General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU 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 General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU 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".
|
||||
********************************************************************************/
|
||||
SUGAR.email2.templates['compose'] = '<div id="composeLayout{idx}" class="ylayout-inactive-content"></div>' +
|
||||
'<div id="composeOverFrame{idx}" style="height:100%;width:100%">' +
|
||||
' <form id="emailCompose{idx}" name="ComposeEditView" action="index.php" method="POST">' +
|
||||
' <input type="hidden" id="email_id{idx}" name="email_id" value="">' +
|
||||
' <input type="hidden" id="type{idx}" name="type" value="">' +
|
||||
' <input type="hidden" id="composeLayoutId" name="composeLayoutId" value="shouldNotSeeMe">' +
|
||||
' <input type="hidden" id="composeType" name="composeType">' +
|
||||
' <input type="hidden" id="fromAccount" name="fromAccount">' +
|
||||
' <input type="hidden" id="sendSubject" name="sendSubject">' +
|
||||
' <input type="hidden" id="sendDescription" name="sendDescription">' +
|
||||
' <input type="hidden" id="sendTo" name="sendTo">' +
|
||||
' <input type="hidden" id="sendBcc" name="sendBcc">' +
|
||||
' <input type="hidden" id="sendCc" name="sendCc">' +
|
||||
' <input type="hidden" id="setEditor" name="setEditor">' +
|
||||
' <input type="hidden" id="sendCharset" name="sendCharset">' +
|
||||
|
||||
|
||||
|
||||
' <input type="hidden" id="saveToSugar" name="saveToSugar">' +
|
||||
' <input type="hidden" id="parent_id" name="parent_id">' +
|
||||
' <input type="hidden" id="parent_type" name="parent_type">' +
|
||||
' <input type="hidden" id="attachments" name="attachments">' +
|
||||
' <input type="hidden" id="documents" name="documents">' +
|
||||
' <input type="hidden" id="outbound_email{idx}" name="outbound_email">' +
|
||||
' <input type="hidden" id="templateAttachments" name="templateAttachments">' +
|
||||
' <input type="hidden" id="templateAttachmentsRemove{idx}" name="templateAttachmentsRemove">' +
|
||||
' <table id="composeHeaderTable{idx}" cellpadding="0" cellspacing="0" border="0" width="100%">' +
|
||||
' <tr>' +
|
||||
' <td class="listViewThS1" NOWRAP>' +
|
||||
' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.sendEmail({idx}, false);"><img src="themes/default/images/icon_email_send.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_SEND}</button>' +
|
||||
' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.saveDraft({idx}, false);"><img src="themes/default/images/icon_email_save.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_SAVE_DRAFT}</button>' +
|
||||
' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.showAttachmentPanel({idx}, false);"><img src="themes/default/images/icon_email_attach.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_ATTACHMENT}</button>' +
|
||||
//' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.showContactsPanel({idx}, false);"><img src="themes/default/images/icon_email_addressbook.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_ADDRESS_BOOK_TITLE}</button>' +
|
||||
' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.showOptionsPanel({idx}, false);"><img src="themes/default/images/icon_email_options.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_OPTIONS}</button>' +
|
||||
' {mod_strings.LBL_EMAIL_RELATE}: <select class="select" id="data_parent_type{idx}" onchange="document.getElementById(\'data_parent_name{idx}\').value=\'\';document.getElementById(\'data_parent_id{idx}\').value=\'\';checkParentType(document.getElementById(\'data_parent_type{idx}\').value, document.getElementById(\'change_parent\'));" name="data_parent_type{idx}">{linkbeans_options}</select>' +
|
||||
'<input id="data_parent_id{idx}" name="data_parent_id{idx}" type="hidden" value="">' +
|
||||
' <input class="sqsEnabled" id="data_parent_name{idx}" name="data_parent_name{idx}" type="text" value=""> <input type="button" name="button" class="button" title="{mod_strings.LBL_EMAIL_SELECTOR}" value="{mod_strings.LBL_EMAIL_SELECTOR}" onclick="SUGAR.email2.composeLayout.callopenpopupForEmail2({idx});"/>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' <div style="margin:5px;">' +
|
||||
' <table cellpadding="4" cellspacing="0" border="0" width="100%">' +
|
||||
' <tr>' +
|
||||
' <td class="emailUILabel" NOWRAP >' +
|
||||
' {app_strings.LBL_EMAIL_FROM}:' +
|
||||
' </td>' +
|
||||
' <td class="emailUIField" NOWRAP>' +
|
||||
' <div>' +
|
||||
' <select class="ac_input" id="addressFrom{idx}" name="addressFrom{idx}"></select>' +
|
||||
' </div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td class="emailUILabel" NOWRAP>' +
|
||||
' <button class="button" type="button" onclick=\'open_popup_emails("Contacts",800,600,"&tree=ProductsProd&div=contacts_div_to&pre=contacts_to",true,false,{"call_back_function":"set_return","form_name":"EditView","field_to_name_array":{"id":"contact_id","name":"contact_name"}});\'>' +
|
||||
' {app_strings.LBL_EMAIL_TO}:' +
|
||||
' </button>' +
|
||||
' </td>' +
|
||||
' <td class="emailUIField" NOWRAP>' +
|
||||
' <div class="ac_autocomplete"><input type="hidden" value="{idx}" id="idx" />' +
|
||||
' <input class="ac_input" type="text" size="500" id="addressTo{idx}" name="addressTo{idx}">' +
|
||||
' <div class="ac_container" id="addressToAC{idx}"></div><input type="hidden" name="contacts_to_count" id="contacts_to_count" value="0" /><div style="margin-left: 10px;width: 510px;" id="contacts_to_div"></div>' +
|
||||
' </div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td class="emailUILabel" NOWRAP>' +
|
||||
' <button class="button" type="button" onclick=\'open_popup_emails("Contacts",800,600,"&tree=ProductsProd&div=contacts_div_cc&pre=contacts_cc",true,false,{"call_back_function":"set_return","form_name":"EditView","field_to_name_array":{"id":"contact_id","name":"contact_name"}});\'>' +
|
||||
' {app_strings.LBL_EMAIL_CC}:' +
|
||||
' </button>' +
|
||||
' </td>' +
|
||||
' <td class="emailUIField" NOWRAP>' +
|
||||
' <div class="ac_autocomplete">' +
|
||||
' <input class="ac_input" type="text" size="2000" id="addressCC{idx}" name="addressCC{idx}">' +
|
||||
' <div class="ac_container" id="addressCcAC{idx}"></div><input type="hidden" name="contacts_cc_count" id="contacts_cc_count" value="0" /><div style="margin-left: 10px;width: 510px;" id="contacts_cc_div"></div>' +
|
||||
' </div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td class="emailUILabel" NOWRAP>' +
|
||||
' <button class="button" type="button" onclick=\'open_popup_emails("Contacts",800,600,"&tree=ProductsProd&div=contacts_div_bcc&pre=contacts_bcc",true,false,{"call_back_function":"set_return","form_name":"EditView","field_to_name_array":{"id":"contact_id","name":"contact_name"}});\'>' +
|
||||
' {app_strings.LBL_EMAIL_BCC}:' +
|
||||
' </button>' +
|
||||
' </td>' +
|
||||
' <td class="emailUIField" NOWRAP>' +
|
||||
' <div class="ac_autocomplete">' +
|
||||
' <input class="ac_input" type="text" size="2000" id="addressBCC{idx}" name="addressBCC{idx}">' +
|
||||
' <div class="ac_container" id="addressBccAC{idx}"></div><input type="hidden" name="contacts_bcc_count" id="contacts_bcc_count" value="0" /><div style="margin-left: 10px;width: 510px;" id="contacts_bcc_div"></div>' +
|
||||
' </div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td class="emailUILabel" NOWRAP width="1%">' +
|
||||
' {app_strings.LBL_EMAIL_SUBJECT}:' +
|
||||
' </td>' +
|
||||
' <td class="emailUIField" NOWRAP width="99%">' +
|
||||
' <div class="ac_autocomplete">' +
|
||||
' <input class="ac_input" type="text" size="2000" id="emailSubject{idx}" name="subject{idx}" value="">' +
|
||||
' </div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' </table>' +
|
||||
' </div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' </table>' +
|
||||
' <div id="htmleditor{idx}" name="htmleditor{idx}"></div>' +
|
||||
' <div id="divAttachments{idx}" class="ylayout-inactive-content">' +
|
||||
' <div style="padding:5px;">' +
|
||||
' <table cellpadding="2" cellspacing="0" border="0">' +
|
||||
' <tr>' +
|
||||
' <th>' +
|
||||
' <b>{app_strings.LBL_EMAIL_ATTACHMENTS}</b>' +
|
||||
' <br />' +
|
||||
' ' +
|
||||
' </th>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' <input type="button" name="add_file_button" onclick="SUGAR.email2.composeLayout.addFileField();" value="{mod_strings.LBL_ADD_FILE}" class="button" />' +
|
||||
' <div id="addedFiles{idx}" name="addedFiles{idx}"></div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' ' +
|
||||
' <br />' +
|
||||
' ' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <th>' +
|
||||
' <b>{app_strings.LBL_EMAIL_ATTACHMENTS2}</b>' +
|
||||
' <br />' +
|
||||
' ' +
|
||||
' </th>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' <input type="button" name="add_document_button" onclick="SUGAR.email2.composeLayout.addDocumentField({idx});" value="{mod_strings.LBL_ADD_DOCUMENT}" class="button" />' +
|
||||
' <div id="addedDocuments{idx}"></div>' + //<input name="document{idx}0" id="document{idx}0" type="hidden" /><input name="documentId{idx}0" id="documentId{idx}0" type="hidden" /><input name="documentName{idx}0" id="documentName{idx}0" disabled size="30" type="text" /><input type="button" id="documentSelect{idx}0" onclick="SUGAR.email2.selectDocument({idx}0, this);" class="button" value="{app_strings.LBL_EMAIL_SELECT}" /><input type="button" id="documentRemove{idx}0" onclick="SUGAR.email2.deleteDocumentField({idx}0, this);" class="button" value="{app_strings.LBL_EMAIL_REMOVE}" /><br /></div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' ' +
|
||||
' <br />' +
|
||||
' ' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <th>' +
|
||||
' <div id="templateAttachmentsTitle{idx}" style="display:none"><b>{app_strings.LBL_EMAIL_ATTACHMENTS3}</b></div>' +
|
||||
' <br />' +
|
||||
' ' +
|
||||
' </th>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' <div id="addedTemplateAttachments{idx}"></div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' </table>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' <div id="divOptions{idx}" class="ylayout-inactive-content"' +
|
||||
' <div style="padding:5px;">' +
|
||||
' <table border="0" width="100%">' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <b>{app_strings.LBL_EMAIL_TEMPLATES}:</b>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <select name="email_template{idx}" id="email_template{idx}" onchange="SUGAR.email2.composeLayout.applyEmailTemplate(\'{idx}\', this.options[this.selectedIndex].value);"></select>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' </table>' +
|
||||
' <br />' +
|
||||
' <table border="0" width="100%">' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <b>{app_strings.LBL_EMAIL_SIGNATURES}:</b>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <select name="signatures{idx}" id="signatures{idx}" onchange="SUGAR.email2.composeLayout.setSignature(\'{idx}\');"></select>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' </table>' +
|
||||
' <br />' +
|
||||
' <table border="0" width="100%">' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <b>{app_strings.LBL_EMAIL_CHARSET}:</b>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <select name="charsetOptions{idx}" id="charsetOptions{idx}"></select>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
' </table>' +
|
||||
' <br />' +
|
||||
' <table border="0" width="100%">' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <b>{app_strings.LBL_EMAIL_COMMON}:</b>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <input type="checkbox" id="setEditor{idx}" name="setEditor{idx}" value="1" /> ' +
|
||||
' <b>{app_strings.LBL_EMAIL_HTML_RTF}:</b>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP style="padding:2px;">' +
|
||||
' <input class="checkbox" type="checkbox" id="saveOutbound{idx}" name="saveOutbound{idx}" value="1" /> ' +
|
||||
' <b>{app_strings.LBL_EMAIL_SETTINGS_SAVE_OUTBOUND}:</b>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' </table>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' </form>' +
|
||||
'</div>';
|
||||
88
modules/Emails/javascript/displayOneEmailTemplate.js
Executable file
88
modules/Emails/javascript/displayOneEmailTemplate.js
Executable file
@@ -0,0 +1,88 @@
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
SUGAR.email2.templates['displayOneEmail'] =
|
||||
'<div class="emailDetailTable" style="height:100%">' +
|
||||
'<div id="viewMenuDiv{idx}"></div>' +
|
||||
'<div width="100%" class="displayEmailValue">' +
|
||||
' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.c0_replyForwardEmail(\'{meta.ieId}\', \'{meta.uid}\', \'{meta.mbox}\', \'reply\');"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=icon_email_reply.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_REPLY}</button>' +
|
||||
' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.c0_replyForwardEmail(\'{meta.ieId}\', \'{meta.uid}\', \'{meta.mbox}\', \'replyAll\');"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=icon_email_replyall.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_REPLY_ALL}</button>' +
|
||||
' <button type="button" class="button" onclick="SUGAR.email2.composeLayout.c0_replyForwardEmail(\'{meta.ieId}\', \'{meta.uid}\', \'{meta.mbox}\', \'forward\');"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=icon_email_forward.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_FORWARD}</button>' +
|
||||
' <button type="button" class="button" onclick="SUGAR.email2.detailView.emailDeleteSingle(\'{meta.ieId}\', \'{meta.uid}\', \'{meta.mbox}\');"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=icon_email_delete.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_DELETE}</button>' +
|
||||
' <button type="button" class="button" onclick="SUGAR.email2.detailView.viewPrintable(\'{meta.ieId}\', \'{meta.uid}\', \'{meta.mbox}\');"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=Print_Email.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_PRINT}</button>' +
|
||||
' <button id="btnEmailView{idx}" type="button" class="button" onclick="SUGAR.email2.detailView.showViewMenu(\'{meta.ieId}\', \'{meta.uid}\', \'{meta.mbox}\');"><img src="index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=icon_email_view.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_VIEW} <img src="themes/default/images/more.gif" align="absmiddle" border="0"></button>' +
|
||||
' <button id="archiveEmail{idx}" type="button" class="button" onclick="SUGAR.email2.detailView.importEmail(\'{meta.ieId}\', \'{meta.uid}\', \'{meta.mbox}\');"><img src="themes/default/images/icon_email_archive.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_IMPORT_EMAIL}</button>' +
|
||||
' <button id="quickCreateSpan{meta.panelId}" type="button" class="button" onclick="SUGAR.email2.detailView.showQuickCreate(\'{meta.ieId}\', \'{meta.uid}\', \'{meta.mbox}\');"><img src="themes/default/images/icon_email_create.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_QUICK_CREATE} <img src="themes/default/images/more.gif" align="absmiddle" border="0"></button>' +
|
||||
' <button type="button" id="showDeialViewForEmail{meta.panelId}" class="button" onclick="SUGAR.email2.contextMenus.showEmailDetailViewInPopup(\'{meta.ieId}\', \'{meta.uid}\', \'{meta.mbox}\');"><img src="themes/default/images/icon_email_relate.gif" align="absmiddle" border="0"> {app_strings.LBL_EMAIL_VIEW_RELATIONSHIPS}</button>' +
|
||||
'</div>' +
|
||||
' <table cellpadding="0" cellspacing="0" border="0" width="100%" >' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP valign="top" width="1%" class="displayEmailLabel">' +
|
||||
' {app_strings.LBL_EMAIL_FROM}:' +
|
||||
' </td>' +
|
||||
' <td width="99%" class="displayEmailValue">' +
|
||||
' {email.from_addr}' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP valign="top" class="displayEmailLabel">' +
|
||||
' {app_strings.LBL_EMAIL_SUBJECT}:' +
|
||||
' </td>' +
|
||||
' <td NOWRAP valign="top" class="displayEmailValue">' +
|
||||
' <b>{email.name}</b>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP valign="top" class="displayEmailLabel">' +
|
||||
' {app_strings.LBL_EMAIL_DATE_SENT_BY_SENDER}:' +
|
||||
' </td>' +
|
||||
' <td class="displayEmailValue">' +
|
||||
' {email.date_start} {email.time_start}' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP valign="top" class="displayEmailLabel">' +
|
||||
' {app_strings.LBL_EMAIL_TO}:' +
|
||||
' </td>' +
|
||||
' <td class="displayEmailValue">' +
|
||||
' {email.toaddrs}' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>{meta.cc}</tr>' +
|
||||
' <tr>{email.attachments}</tr>' +
|
||||
' </table>' +
|
||||
' <div id="displayEmailFrameDiv{idx}" name="displayEmailFrameDiv{idx}"><iframe id="displayEmailFrame{idx}" src="modules/Emails/templates/_blank.html" width="100%" height="100%" frameborder="0"></iframe></div>' +
|
||||
//' {email.description}' +
|
||||
'</div>'
|
||||
;
|
||||
153
modules/Emails/javascript/email_popup_helper.js
Executable file
153
modules/Emails/javascript/email_popup_helper.js
Executable file
@@ -0,0 +1,153 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
function send_back_selected(module, form, field, error_message, field_to_name_array)
|
||||
{
|
||||
// cn: bug 12274 - stripping false-positive security envelope
|
||||
var temp_request_data = request_data;
|
||||
if(temp_request_data.jsonObject) {
|
||||
request_data = temp_request_data.jsonObject;
|
||||
} else {
|
||||
request_data = temp_request_data; // passed data that is NOT incorrectly encoded via JSON.encode();
|
||||
}
|
||||
// cn: end bug 12274 fix
|
||||
|
||||
var passthru_data = Object();
|
||||
if(typeof(request_data.passthru_data) != 'undefined')
|
||||
{
|
||||
passthru_data = request_data.passthru_data;
|
||||
}
|
||||
var form_name = request_data.form_name;
|
||||
var field_to_name_array = request_data.field_to_name_array;
|
||||
var call_back_function = eval("window.opener." + request_data.call_back_function);
|
||||
|
||||
var array_contents = Array();
|
||||
var j=0;
|
||||
for (i = 0; i < form.elements.length; i++){
|
||||
if(form.elements[i].name == field) {
|
||||
if (form.elements[i].checked == true) {
|
||||
++j;
|
||||
var id = form.elements[i].value;
|
||||
array_contents_row = Array();
|
||||
for(var the_key in field_to_name_array)
|
||||
{
|
||||
if(the_key != 'toJSON')
|
||||
{
|
||||
var the_name = field_to_name_array[the_key];
|
||||
var the_value = '';
|
||||
|
||||
if(/*module != '' && */id != '')
|
||||
{
|
||||
the_value = associated_javascript_data[id][the_key.toUpperCase()];
|
||||
}
|
||||
|
||||
array_contents_row.push('"' + the_name + '":"' + the_value + '"');
|
||||
}
|
||||
}
|
||||
eval("array_contents.push({" + array_contents_row.join(",") + "})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result_data = {"form_name":form_name,"name_to_value_array":array_contents};
|
||||
|
||||
if (array_contents.length ==0 ) {
|
||||
window.alert(error_message);
|
||||
return;
|
||||
}
|
||||
|
||||
call_back_function(result_data);
|
||||
var close_popup = window.opener.get_close_popup();
|
||||
|
||||
if(close_popup)
|
||||
{
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
||||
function send_back(module, id)
|
||||
{
|
||||
var associated_row_data = associated_javascript_data[id];
|
||||
|
||||
// cn: bug 12274 - stripping false-positive security envelope
|
||||
eval("var temp_request_data = " + window.document.forms['popup_query_form'].request_data.value);
|
||||
if(temp_request_data.jsonObject) {
|
||||
var request_data = temp_request_data.jsonObject;
|
||||
} else {
|
||||
var request_data = temp_request_data; // passed data that is NOT incorrectly encoded via JSON.encode();
|
||||
}
|
||||
// cn: end bug 12274 fix
|
||||
|
||||
var passthru_data = Object();
|
||||
if(typeof(request_data.passthru_data) != 'undefined')
|
||||
{
|
||||
passthru_data = request_data.passthru_data;
|
||||
}
|
||||
var form_name = request_data.form_name;
|
||||
var field_to_name_array = request_data.field_to_name_array;
|
||||
var call_back_function = eval("window.opener." + request_data.call_back_function);
|
||||
var array_contents = Array();
|
||||
|
||||
// constructs the array of values associated to the bean that the user clicked
|
||||
for(var the_key in field_to_name_array)
|
||||
{
|
||||
if(the_key != 'toJSON')
|
||||
{
|
||||
var the_name = field_to_name_array[the_key];
|
||||
var the_value = '';
|
||||
|
||||
if(module != '' && id != '')
|
||||
{
|
||||
the_value = associated_row_data[the_key.toUpperCase()];
|
||||
}
|
||||
|
||||
array_contents.push('"' + the_name + '":"' + the_value + '"');
|
||||
}
|
||||
}
|
||||
|
||||
eval("var name_to_value_array = {'0' : {" + array_contents.join(",") + "}}");
|
||||
|
||||
var result_data = {"form_name":form_name,"name_to_value_array":name_to_value_array,"passthru_data":passthru_data};
|
||||
var close_popup = window.opener.get_close_popup();
|
||||
|
||||
call_back_function(result_data);
|
||||
|
||||
if(close_popup)
|
||||
{
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
649
modules/Emails/javascript/grid.js
Executable file
649
modules/Emails/javascript/grid.js
Executable file
@@ -0,0 +1,649 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
function gridInit() {
|
||||
if(SUGAR.email2.grid) {
|
||||
SUGAR.email2.grid.destroy();
|
||||
}
|
||||
|
||||
e2Grid = {
|
||||
init : function() {
|
||||
|
||||
var Ck = YAHOO.util.Cookie;
|
||||
var widths = [ 10, 10, 150, 250, 175, 125 ];
|
||||
|
||||
if (Ck.get("EmailGridWidths")) {
|
||||
for (var i=0; i < widths.length; i++) {
|
||||
widths[i] = Ck.getSub("EmailGridWidths", i+ "", Number);
|
||||
}
|
||||
} else {
|
||||
for (var i=0; i < widths.length; i++) {
|
||||
Ck.setSub("EmailGridWidths", i + "", widths[i], {expires: SUGAR.email2.nextYear});
|
||||
}
|
||||
}
|
||||
|
||||
// changes "F" to an icon
|
||||
function flaggedIcon(cell, record, column, value) {
|
||||
if(value != "") {
|
||||
cell.innerHTML = "<span style='color: #f00; font-weight:bold;'>!</span>";
|
||||
}
|
||||
}
|
||||
// changes "A" to replied icon
|
||||
function repliedIcon(cell, record, column, value) {
|
||||
if(value != "") {
|
||||
cell.innerHTML = "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=export.gif' class='image' border='0' width='10' align='absmiddle'>";
|
||||
}
|
||||
}
|
||||
function attachIcon(cell, record, column, value) {
|
||||
if(value == "1") {
|
||||
cell.innerHTML = "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=attachment.gif' class='image' border='0' width='10' align='absmiddle'>";
|
||||
}
|
||||
}
|
||||
|
||||
var colModel =
|
||||
[
|
||||
{
|
||||
label: "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=attachment.gif' class='image' border='0' width='10' align='absmiddle'>",
|
||||
width: 10,
|
||||
sortable: false,
|
||||
fixed: true,
|
||||
resizeable: true,
|
||||
formatter: attachIcon,
|
||||
key: 'hasAttach'
|
||||
},
|
||||
{
|
||||
label: "<span style='color: #f00; font-weight:bold;'>!</span>",
|
||||
width: widths[0],
|
||||
sortable: true,
|
||||
fixed: true,
|
||||
resizeable: true,
|
||||
formatter: flaggedIcon,
|
||||
key: 'flagged'
|
||||
},
|
||||
{
|
||||
label: "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=export.gif' class='image' border='0' width='10' align='absmiddle'>",
|
||||
width: widths[1],
|
||||
sortable: true,
|
||||
fixed: true,
|
||||
resizeable: false,
|
||||
formatter: repliedIcon,
|
||||
key: 'status'
|
||||
},
|
||||
{
|
||||
label: app_strings.LBL_EMAIL_FROM,
|
||||
width: widths[2],
|
||||
sortable: true,
|
||||
resizeable: true,
|
||||
key: 'from'
|
||||
},
|
||||
{
|
||||
label: app_strings.LBL_EMAIL_SUBJECT,
|
||||
width: widths[3],
|
||||
sortable: true,
|
||||
resizeable: true,
|
||||
key: 'subject'
|
||||
},
|
||||
{
|
||||
label: mod_strings.LBL_LIST_DATE,
|
||||
width: widths[4],
|
||||
sortable: true,
|
||||
resizeable: true,
|
||||
key: 'date'
|
||||
},
|
||||
{
|
||||
label: app_strings.LBL_EMAIL_TO,
|
||||
width: widths[5],
|
||||
sortable: false,
|
||||
resizeable: true,
|
||||
key: 'to_addrs'
|
||||
},
|
||||
{
|
||||
label: 'uid',
|
||||
hidden: true,
|
||||
key: 'uid'
|
||||
},
|
||||
{
|
||||
label: 'mbox',
|
||||
hidden: true,
|
||||
key: 'mbox'
|
||||
},
|
||||
{
|
||||
label: 'ieId',
|
||||
hidden: true,
|
||||
key: 'ieId'
|
||||
},
|
||||
{
|
||||
label: 'site_url',
|
||||
hidden: true,
|
||||
key: 'site_url'
|
||||
},
|
||||
{ label: 'seen',
|
||||
hidden: true,
|
||||
key: 'seen'
|
||||
},
|
||||
{ label: 'type',
|
||||
hidden: true,
|
||||
key: 'type'
|
||||
}
|
||||
];
|
||||
|
||||
var dataModel = new YAHOO.util.DataSource(urlBase + "?", {
|
||||
responseType: YAHOO.util.DataSource.TYPE_JSON,
|
||||
responseSchema: {
|
||||
resultsList: 'Email',
|
||||
fields: ['flagged', 'status', 'from', 'subject', 'date','to_addrs', 'uid', 'mbox', 'ieId', 'site_url', 'seen', 'type', 'AssignedTo','hasAttach'],
|
||||
metaFields: {total: 'TotalCount', unread:"UnreadCount", fromCache: "FromCache"}
|
||||
}
|
||||
});
|
||||
var params = {
|
||||
to_pdf : "true",
|
||||
module : "Emails",
|
||||
action : "EmailUIAjax",
|
||||
emailUIAction : "getMessageList",
|
||||
mbox : "INBOX",
|
||||
ieId : "",
|
||||
forceRefresh : "false"
|
||||
};
|
||||
if(lazyLoadFolder != null) {
|
||||
params['mbox'] = lazyLoadFolder.folder;
|
||||
params['ieId'] = lazyLoadFolder.ieId;
|
||||
//Check if the folder is a Sugar Folder
|
||||
var test = new String(lazyLoadFolder.folder);
|
||||
if(test.match(/SUGAR\./)) {
|
||||
params['emailUIAction'] = 'getMessageListSugarFolders';
|
||||
params['mbox'] = test.substr(6);
|
||||
}
|
||||
}
|
||||
//dataModel.initPaging(urlBase, SUGAR.email2.userPrefs.emailSettings.showNumInList);
|
||||
|
||||
// create the Grid
|
||||
var grid = SUGAR.email2.grid = new YAHOO.SUGAR.SelectionGrid('emailGrid', colModel, dataModel, {
|
||||
MSG_EMPTY: SUGAR.language.get("Emails", "LBL_EMPTY_FOLDER"),
|
||||
dynamicData: true,
|
||||
paginator: new YAHOO.widget.Paginator({
|
||||
rowsPerPage:parseInt(SUGAR.email2.userPrefs.emailSettings.showNumInList),
|
||||
containers : ["dt-pag-nav"],
|
||||
template: "<div class='pagination'>{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}</div>",
|
||||
firstPageLinkLabel: "<button class='button'><div class='paginator-start'/></button>",
|
||||
previousPageLinkLabel: "<button class='button'><div class='paginator-previous'/></button>",
|
||||
nextPageLinkLabel: "<button class='button'><div class='paginator-next'/></button>",
|
||||
lastPageLinkLabel: "<button class='button'><div class='paginator-end'/></button>"
|
||||
}),
|
||||
initialRequest:SUGAR.util.paramsToUrl(params),
|
||||
width: "800px",
|
||||
height: "400px"
|
||||
});
|
||||
|
||||
initRowDD();
|
||||
|
||||
//Override Paging request construction
|
||||
grid.set("generateRequest", function(oState, oSelf) {
|
||||
oState = oState || {pagination:null, sortedBy:null};
|
||||
var sort = (oState.sortedBy) ? oState.sortedBy.key : oSelf.getColumnSet().keys[1].getKey();
|
||||
var dir = (oState.sortedBy && oState.sortedBy.dir === YAHOO.widget.DataTable.CLASS_DESC) ? "desc" : "asc";
|
||||
var startIndex = (oState.pagination) ? oState.pagination.recordOffset : 0;
|
||||
var results = (oState.pagination) ? oState.pagination.rowsPerPage : null;
|
||||
// Build the request
|
||||
var ret =
|
||||
SUGAR.util.paramsToUrl(oSelf.params) +
|
||||
"&sort=" + sort +
|
||||
"&dir=" + dir +
|
||||
"&start=" + startIndex +
|
||||
((results !== null) ? "&limit=" + results : "");
|
||||
return ret;
|
||||
});
|
||||
|
||||
|
||||
grid.handleDataReturnPayload = function(oRequest, oResponse, oPayload) {
|
||||
oPayload = oPayload || { };
|
||||
|
||||
oPayload.totalRecords = oResponse.meta.total;
|
||||
oPayload.unreadRecords = oResponse.meta.unread;
|
||||
|
||||
var tabObject = SE.innerLayout.get("tabs")[0];
|
||||
var mboxTitle = "";
|
||||
if (this.params.mbox != null) {
|
||||
mboxTitle = this.params.mbox;
|
||||
}
|
||||
var tabtext = mboxTitle + " (" + oResponse.meta.total + " " + app_strings.LBL_EMAIL_MESSAGES + " )";
|
||||
tabObject.get("labelEl").firstChild.data = tabtext;
|
||||
|
||||
if (SE.tree) {
|
||||
var node = SE.tree.getNodeByProperty('id', this.params.ieId) || SE.tree.getNodeByProperty('origText', this.params.mbox);
|
||||
if (node) {
|
||||
node.data.unseen = oResponse.meta.unread;
|
||||
SE.accounts.renderTree();
|
||||
}
|
||||
}
|
||||
return oPayload;
|
||||
}
|
||||
|
||||
var resize = grid.resizeGrid = function () {
|
||||
SUGAR.email2.grid.set("width", SUGAR.email2.grid.get("element").parentNode.clientWidth + "px");
|
||||
SUGAR.email2.grid.set("height", (SUGAR.email2.grid.get("element").parentNode.clientHeight - 47) + "px");
|
||||
}
|
||||
grid.convertDDRows = function() {
|
||||
var rowEl = this.getFirstTrEl();
|
||||
while (rowEl != null) {
|
||||
new this.DDRow(this, this.getRecord(rowEl), rowEl);
|
||||
rowEl = this.getNextTrEl(rowEl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
grid.on("columnResizeEvent", function(o) {
|
||||
//Find the index of the column
|
||||
var colSet = SUGAR.email2.grid.getColumnSet().flat;
|
||||
for (var i=0; i < colSet.length; i++) {
|
||||
if (o.column == colSet[i]) {
|
||||
//Store it in the cookie
|
||||
Ck.setSub("EmailGridWidths", i + "", o.width, {expires: SUGAR.email2.nextYear});
|
||||
}
|
||||
}
|
||||
//this.resizeGrid();
|
||||
}, null, grid);
|
||||
|
||||
grid.on("postRenderEvent", function() {this.convertDDRows()}, null, grid);
|
||||
grid.on("rowClickEvent", SUGAR.email2.listView.handleClick);
|
||||
grid.on("rowDblclickEvent", SUGAR.email2.listView.getEmail);
|
||||
grid.render();
|
||||
SUGAR.email2.listViewLayout.on("render", resize);
|
||||
resize();
|
||||
|
||||
//Setup the default load parameters
|
||||
SUGAR.email2.grid.params = params;
|
||||
|
||||
grid.on('postRenderEvent', SUGAR.email2.listView.setEmailListStyles);
|
||||
dataModel.subscribe("requestEvent", grid.disable, grid, true);
|
||||
dataModel.subscribe("responseParseEvent", grid.undisable, grid, true);
|
||||
}
|
||||
};
|
||||
e2Grid.init();
|
||||
};
|
||||
|
||||
|
||||
function initRowDD() {
|
||||
var sg = SUGAR.email2.grid,
|
||||
Dom = YAHOO.util.Dom;
|
||||
sg.DDRow = function(oDataTable, oRecord, elTr) {
|
||||
if(oDataTable && oRecord && elTr) {
|
||||
this.ddtable = oDataTable;
|
||||
this.table = oDataTable.getTableEl();
|
||||
this.row = oRecord;
|
||||
this.rowEl = elTr;
|
||||
this.newIndex = null;
|
||||
this.init(elTr);
|
||||
this.initFrame(); // Needed for DDProxy
|
||||
this.invalidHandleTypes = {};
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.extend(sg.DDRow, YAHOO.util.DDProxy, {
|
||||
_resizeProxy: function() {
|
||||
this.constructor.superclass._resizeProxy.apply(this, arguments);
|
||||
var dragEl = this.getDragEl(),
|
||||
el = this.getEl();
|
||||
var xy = Dom.getXY(el);
|
||||
|
||||
Dom.setStyle(dragEl, 'height', this.rowEl.offsetHeight + "px");
|
||||
Dom.setStyle(dragEl, 'width', (parseInt(Dom.getStyle(dragEl, 'width'),10) + 4) + 'px');
|
||||
Dom.setXY(dragEl, [xy[0] - 100, xy[1] - 20] );
|
||||
Dom.setStyle(dragEl, 'display', "");
|
||||
},
|
||||
|
||||
startDrag: function(x, y) {
|
||||
//Check if we should be dragging a set of rows rather than just the one.
|
||||
var selectedRows = this.ddtable.getSelectedRows();
|
||||
var iSelected = false;
|
||||
for (var i in selectedRows) {
|
||||
if (this.rowEl.id == selectedRows[i]) {
|
||||
iSelected = true;
|
||||
break
|
||||
}
|
||||
}
|
||||
if (iSelected) {
|
||||
this.rows = [];
|
||||
for (var i in selectedRows) {
|
||||
this.rows[i] = this.ddtable.getRecord(selectedRows[i]);
|
||||
}
|
||||
} else {
|
||||
this.rows = [this.row];
|
||||
this.ddtable.unselectAllRows();
|
||||
this.ddtable.selectRow(this.row);
|
||||
}
|
||||
|
||||
//Initialize the dragable proxy
|
||||
var dragEl = this.getDragEl();
|
||||
var clickEl = this.getEl();
|
||||
Dom.setStyle(clickEl, "opacity", "0.25");
|
||||
dragEl.innerHTML = "<table><tr>" + clickEl.innerHTML + "</tr></table>";
|
||||
Dom.addClass(dragEl, "yui-dt-liner");
|
||||
Dom.setStyle(dragEl, "opacity", "0.5");
|
||||
Dom.setStyle(dragEl, "height", (clickEl.clientHeight - 2) + "px");
|
||||
Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor"));
|
||||
Dom.setStyle(dragEl, "border", "2px solid gray");
|
||||
},
|
||||
|
||||
clickValidator: function(e) {
|
||||
if (this.row.getData()[0] == " ")
|
||||
return false;
|
||||
var target = YAHOO.util.Event.getTarget(e);
|
||||
return ( this.isValidHandleChild(target) &&
|
||||
(this.id == this.handleElId || this.DDM.handleWasClicked(target, this.id)) );
|
||||
},
|
||||
/**
|
||||
* This funciton checks that the target of the drag is a table row in this
|
||||
* DDGroup and simply moves the sourceEL to that location as a preview.
|
||||
*/
|
||||
onDragOver: function(ev, id) {
|
||||
var node = SUGAR.email2.tree.getNodeByElement(Dom.get(id));
|
||||
if (node && node != this.targetNode) {
|
||||
this.targetNode = node;
|
||||
SUGAR.email2.folders.unhighliteAll();
|
||||
node.highlight();
|
||||
}
|
||||
},
|
||||
|
||||
onDragOut: function(e, id) {
|
||||
if (this.targetNode) {
|
||||
SUGAR.email2.folders.unhighliteAll();
|
||||
this.targetNode = false;
|
||||
}
|
||||
},
|
||||
endDrag: function() {
|
||||
Dom.setStyle(this.getEl(), "opacity", "");
|
||||
Dom.setStyle(this.getDragEl(), "display", "none");
|
||||
if (this.targetNode) {
|
||||
SUGAR.email2.folders.handleDrop(this.rows, this.targetNode);
|
||||
}
|
||||
SUGAR.email2.folders.unhighliteAll();
|
||||
this.rows = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function AddressSearchGridInit() {
|
||||
function moduleIcon(elCell, oRecord, oColumn, oData) {
|
||||
elCell.innerHTML = "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=" + oData + ".gif' class='image' border='0' width='16' align='absmiddle'>";
|
||||
};
|
||||
function selectionCheckBox(elCell, oRecord, oColumn, oData) {
|
||||
elCell.innerHTML = '<input type="checkbox" onclick="SUGAR.email2.addressBook.grid.toggleSelectCheckbox(\'' + oRecord.getId() + '\', this.checked);">';
|
||||
};
|
||||
var checkHeader = '<input type="checkbox" ';
|
||||
if (SUGAR.email2.util.isIe()) {
|
||||
checkHeader += 'style="top:-5px" ';
|
||||
}
|
||||
checkHeader += 'onclick="SUGAR.email2.addressBook.grid.toggleSelectAll(this.checked);">';
|
||||
var colModel =
|
||||
[{
|
||||
label: checkHeader,
|
||||
width: 30,
|
||||
formatter: selectionCheckBox,
|
||||
key: 'bean_id'
|
||||
},
|
||||
{
|
||||
label: mod_strings.LBL_LIST_TYPE,
|
||||
width: 25,
|
||||
formatter: moduleIcon,
|
||||
key: 'bean_module'
|
||||
},
|
||||
{
|
||||
label: app_strings.LBL_EMAIL_ADDRESS_BOOK_NAME,
|
||||
width: 180,
|
||||
sortable: true,
|
||||
key: 'name'
|
||||
},
|
||||
{
|
||||
label: app_strings.LBL_EMAIL_ADDRESS_BOOK_EMAIL_ADDR,
|
||||
width: 300,
|
||||
sortable: true,
|
||||
key: 'email'
|
||||
}];
|
||||
|
||||
var dataModel = new YAHOO.util.DataSource(urlBase + "?", {
|
||||
responseType: YAHOO.util.XHRDataSource.TYPE_JSON,
|
||||
responseSchema: {
|
||||
resultsList: 'Person',
|
||||
fields: ['name', 'email', 'bean_id', 'bean_module'],
|
||||
metaFields: {total: 'TotalCount'}
|
||||
},
|
||||
//enable sorting on the server accross all data
|
||||
remoteSort: true
|
||||
});
|
||||
dataModel.params = {
|
||||
to_pdf : true,
|
||||
module : "Emails",
|
||||
action : "EmailUIAjax",
|
||||
emailUIAction:"getAddressSearchResults"
|
||||
}
|
||||
var rb = document.getElementById('hasRelatedBean').checked;
|
||||
if (rb) {
|
||||
var idx = SUGAR.email2.composeLayout.currentInstanceId;
|
||||
var relatedBeanId = document.getElementById('data_parent_id' + idx).value;
|
||||
var relatedBeanType = document.getElementById('data_parent_type' + idx).value;
|
||||
dataModel.params['related_bean_id'] = relatedBeanId;
|
||||
dataModel.params['related_bean_type'] = relatedBeanType;
|
||||
dataModel.params['person'] = document.getElementById('input_searchPerson').value;
|
||||
}
|
||||
SUGAR.email2.addressBook.addressBookDataModel = dataModel;
|
||||
|
||||
var grid = SUGAR.email2.addressBook.grid = new YAHOO.widget.ScrollingDataTable("addrSearchGrid", colModel, dataModel, {
|
||||
MSG_EMPTY: " ", //SUGAR.language.get("Emails", "LBL_EMPTY_FOLDER"),
|
||||
dynamicData: true,
|
||||
paginator: new YAHOO.widget.Paginator({
|
||||
rowsPerPage: 25,
|
||||
containers : ["dt-pag-nav-addressbook"],
|
||||
template: "<div class='pagination'>{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}</div>",
|
||||
firstPageLinkLabel: "<button class='button'><div class='paginator-start'/></button>",
|
||||
previousPageLinkLabel: "<button class='button'><div class='paginator-previous'/></button>",
|
||||
nextPageLinkLabel: "<button class='button'><div class='paginator-next'/></button>",
|
||||
lastPageLinkLabel: "<button class='button'><div class='paginator-end'/></button>"
|
||||
}),
|
||||
initialRequest:SUGAR.util.paramsToUrl(dataModel.params),
|
||||
width: "560px",
|
||||
height: "250px"
|
||||
});
|
||||
//Override Paging request construction
|
||||
grid.set("generateRequest", function(oState, oSelf) {
|
||||
oState = oState || {pagination:null, sortedBy:null};
|
||||
var sort = (oState.sortedBy) ? oState.sortedBy.key : oSelf.getColumnSet().keys[0].getKey();
|
||||
var dir = (oState.sortedBy && oState.sortedBy.dir === YAHOO.widget.DataTable.CLASS_DESC) ? "desc" : "asc";
|
||||
var startIndex = (oState.pagination) ? oState.pagination.recordOffset : 0;
|
||||
var results = (oState.pagination) ? oState.pagination.rowsPerPage : null;
|
||||
// Build the request
|
||||
var ret =
|
||||
SUGAR.util.paramsToUrl(oSelf.getDataSource().params) +
|
||||
"&sort=" + sort + "&dir=" + dir + "&start=" + startIndex +
|
||||
((results !== null) ? "&limit=" + results : "");
|
||||
return ret;
|
||||
});
|
||||
|
||||
grid.handleDataReturnPayload = function(oRequest, oResponse, oPayload) {
|
||||
oPayload = oPayload || { };
|
||||
oPayload.totalRecords = oResponse.meta.total;
|
||||
return oPayload;
|
||||
}
|
||||
|
||||
grid.clickToggleSelect= function(args) {
|
||||
var isIE = (args.event.target == null);
|
||||
var targetElement = isIE ? args.event.srcElement : args.event.target;
|
||||
if(targetElement.type == null || targetElement.type != 'checkbox') {
|
||||
SUGAR.email2.addressBook.grid.toggleSelect(args.target.id);
|
||||
}
|
||||
}
|
||||
|
||||
grid.reSelectRowsOnRender = function (){
|
||||
var rows = SUGAR.email2.addressBook.grid.getRecordSet().getRecords();
|
||||
for (var i = 0; i < rows.length; i++)
|
||||
{
|
||||
var emailAddress = rows[i].getData("email");
|
||||
var alreadyAdded = SUGAR.email2.addressBook.doesEmailAdddressExistInResultTable(emailAddress);
|
||||
if(alreadyAdded)
|
||||
{
|
||||
rows[i].setData("selected", true);
|
||||
SUGAR.email2.addressBook.grid.selectRow(rows[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rows[i].setData("selected", false);
|
||||
SUGAR.email2.addressBook.grid.unselectRow(rows[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
grid.subscribe("rowMouseoverEvent", grid.onEventHighlightRow);
|
||||
grid.subscribe("rowMouseoutEvent", grid.onEventUnhighlightRow);
|
||||
grid.subscribe("rowClickEvent", grid.clickToggleSelect);
|
||||
grid.subscribe("postRenderEvent", grid.reSelectRowsOnRender);
|
||||
|
||||
grid.render();
|
||||
dataModel.subscribe("requestEvent", grid.disable, grid, true);
|
||||
dataModel.subscribe("responseParseEvent", grid.undisable, grid, true);
|
||||
|
||||
grid.toggleSelectCheckbox = function(id,checked){
|
||||
var row = SUGAR.email2.addressBook.grid.getRecord(id);
|
||||
row.setData("checked",checked);
|
||||
};
|
||||
grid.toggleSelect = function(id, checked) {
|
||||
var row = SUGAR.email2.addressBook.grid.getRecord(id);
|
||||
checked = row.getData("selected");
|
||||
if (!checked)
|
||||
{
|
||||
SUGAR.email2.addressBook.grid.selectRow(row);
|
||||
SE.addressBook.insertContactRowToResultTable(id,null)
|
||||
} else
|
||||
{
|
||||
SUGAR.email2.addressBook.grid.unselectRow(row);
|
||||
SE.addressBook.removeRowFromGridResults(id,row.getData("email"));
|
||||
}
|
||||
row.setData("selected", !checked);
|
||||
};
|
||||
|
||||
grid.toggleSelectAll = function(checked) {
|
||||
rows = SUGAR.email2.addressBook.grid.getRecordSet().getRecords();
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
if (typeof(rows[i]) != "undefined")
|
||||
rows[i].setData("checked", checked);
|
||||
}
|
||||
var checkBoxes = SUGAR.email2.addressBook.grid.get("element").getElementsByTagName('input');
|
||||
for (var i = 0; i < checkBoxes.length; i++) {
|
||||
checkBoxes[i].checked = checked;
|
||||
}
|
||||
};
|
||||
|
||||
//Initialize the grid result table.
|
||||
AddressSearchResultsGridInit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Initalize the results table for the address book selection.
|
||||
*
|
||||
*/
|
||||
function AddressSearchResultsGridInit()
|
||||
{
|
||||
|
||||
/* Full name sort funciton to compare by last name if available */
|
||||
var fullNameSort = function(a, b, desc) {
|
||||
// Deal with empty values
|
||||
if(!YAHOO.lang.isValue(a))
|
||||
return (!YAHOO.lang.isValue(b)) ? 0 : 1;
|
||||
else if(!YAHOO.lang.isValue(b))
|
||||
return -1;
|
||||
|
||||
var aNames = a.getData("name").split(' ');
|
||||
var bNames = b.getData("name").split(' ');
|
||||
|
||||
var aSortField = (aNames.length == 2) ? aNames[1] : a.getData("name");
|
||||
var bSortField = (bNames.length == 2) ? bNames[1] : b.getData("name");
|
||||
|
||||
return YAHOO.util.Sort.compare(aSortField,bSortField, desc);
|
||||
|
||||
};
|
||||
|
||||
var typeDdOptions = [app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD_TO.replace(/:$/,'') ,
|
||||
app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD_CC.replace(/:$/,''),
|
||||
app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD_BCC.replace(/:$/,'')];
|
||||
|
||||
var ColumnDefs = [{key:'type',label:app_strings.LBL_EMAIL_ADDRESS_BOOK_ADRRESS_TYPE, width: 60, sortable: true, editor: new YAHOO.widget.RadioCellEditor({radioOptions:typeDdOptions,disableBtns:true})},
|
||||
{key:'name',label:app_strings.LBL_EMAIL_ACCOUNTS_NAME,width: 280,sortable: true, sortOptions:{sortFunction:fullNameSort}}];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource([]);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
myDataSource.responseSchema = {
|
||||
fields: ["name","type","email_address","display_email_address","bean_id","idx"]
|
||||
};
|
||||
|
||||
var gridResults = SUGAR.email2.addressBook.gridResults = new YAHOO.widget.ScrollingDataTable("addrSearchResultGrid", ColumnDefs, myDataSource, {
|
||||
width: "350px",height: "250px", MSG_EMPTY: " "});
|
||||
|
||||
var highlightEditableCell = function(oArgs) {
|
||||
var elCell = oArgs.target;
|
||||
if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
|
||||
this.highlightCell(elCell);
|
||||
}
|
||||
};
|
||||
|
||||
gridResults.subscribe("cellMouseoverEvent", highlightEditableCell);
|
||||
gridResults.subscribe("cellMouseoutEvent", gridResults.onEventUnhighlightCell);
|
||||
gridResults.subscribe("cellClickEvent", gridResults.onEventShowCellEditor);
|
||||
gridResults.subscribe("rowMouseoverEvent", gridResults.onEventHighlightRow);
|
||||
gridResults.subscribe("rowMouseoutEvent", gridResults.onEventUnhighlightRow);
|
||||
|
||||
//Setup the context menus
|
||||
var onContextMenuClick = function(p_sType, p_aArgs, p_myDataTable) {
|
||||
var task = p_aArgs[1];
|
||||
if(task)
|
||||
{
|
||||
var elRow = this.contextEventTarget;
|
||||
elRow = p_myDataTable.getTrEl(elRow);
|
||||
|
||||
if(elRow)
|
||||
{
|
||||
switch(task.index)
|
||||
{
|
||||
case 0:
|
||||
var oRecord = p_myDataTable.getRecord(elRow);
|
||||
p_myDataTable.deleteRow(elRow);
|
||||
SUGAR.email2.addressBook.grid.reSelectRowsOnRender();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var contextMenu = new YAHOO.widget.ContextMenu("contextmenu",
|
||||
{trigger:gridResults.getTbodyEl()});
|
||||
contextMenu.addItem(app_strings.LBL_EMAIL_DELETE);
|
||||
contextMenu.render("addrSearchResultGrid");
|
||||
contextMenu.clickEvent.subscribe(onContextMenuClick, gridResults);
|
||||
}
|
||||
460
modules/Emails/javascript/init.js
Executable file
460
modules/Emails/javascript/init.js
Executable file
@@ -0,0 +1,460 @@
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* Initialize Email 2.0 Application
|
||||
*/
|
||||
|
||||
//Override Sugar Languge so quick creates work properly
|
||||
|
||||
|
||||
function email2init() {
|
||||
|
||||
//Init Tiny MCE
|
||||
// var tinyConfig = "code,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull," +
|
||||
// "separator,bullist,numlist,outdent,indent,separator,forecolor,backcolor,fontselect,fontsizeselect";
|
||||
if (!SUGAR.util.isTouchScreen()) {
|
||||
tinyMCE.init({
|
||||
convert_urls : false,
|
||||
theme_advanced_toolbar_align : tinyConfig.theme_advanced_toolbar_align,
|
||||
width: tinyConfig.width,
|
||||
theme: tinyConfig.theme,
|
||||
theme_advanced_toolbar_location : tinyConfig.theme_advanced_toolbar_location,
|
||||
theme_advanced_buttons1 : tinyConfig.theme_advanced_buttons1,
|
||||
theme_advanced_buttons2 : tinyConfig.theme_advanced_buttons2,
|
||||
theme_advanced_buttons3 : tinyConfig.theme_advanced_buttons3,
|
||||
plugins : tinyConfig.plugins,
|
||||
elements : tinyConfig.elements,
|
||||
language : tinyConfig.language,
|
||||
extended_valid_elements : tinyConfig.extended_valid_elements,
|
||||
mode: tinyConfig.mode,
|
||||
strict_loading_mode : true,
|
||||
force_br_newlines : true,
|
||||
forced_root_block : ''
|
||||
});
|
||||
}
|
||||
//alert('loadedTiny');
|
||||
|
||||
// initialze message overlay
|
||||
SUGAR.email2.e2overlay = new YAHOO.widget.Dialog("SUGAR.email2.e2overlay", {
|
||||
//iframe : true,
|
||||
modal : false,
|
||||
autoTabs : true,
|
||||
width : 300,
|
||||
height : 120,
|
||||
shadow : true
|
||||
}
|
||||
);
|
||||
// Hide Sugar menu
|
||||
if (SUGAR.themes.tempHideLeftCol)
|
||||
SUGAR.themes.tempHideLeftCol();
|
||||
|
||||
// add key listener for kb shortcust - disable backspace nav in mozilla/ie
|
||||
// YAHOO.util.Event.addListener(window.document, 'keypress', SUGAR.email2.keys.overall);
|
||||
|
||||
// set defaults for YAHOO.util.DragDropManager
|
||||
YAHOO.util.DDM.mode = 0; // point mode, default is point (0)
|
||||
|
||||
SUGAR.email2.nextYear = new Date();
|
||||
SUGAR.email2.nextYear.setDate(SUGAR.email2.nextYear.getDate() + 360);
|
||||
|
||||
|
||||
// initialize and display UI framework (complexLayout.js)
|
||||
complexLayoutInit();
|
||||
|
||||
// initialize and display grid (grid.js)
|
||||
gridInit();
|
||||
|
||||
// initialize treeview for folders
|
||||
//onloadTreeinit();
|
||||
SUGAR.email2.folders.rebuildFolders(true);
|
||||
|
||||
|
||||
//Setup the Message Box overlay
|
||||
/*Ext.MessageBox.maxWidth = 350;
|
||||
Ext.MessageBox.minProgressWidth = 350;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//// CONTEXT MENUS
|
||||
// detailView array
|
||||
SUGAR.email2.contextMenus.detailViewContextMenus = new Object();
|
||||
*/
|
||||
var SEC = SUGAR.email2.contextMenus;
|
||||
|
||||
//Grid menu
|
||||
var emailMenu = SEC.emailListContextMenu = new YAHOO.widget.ContextMenu("emailContextMenu", {
|
||||
trigger: SUGAR.email2.grid.get("element"),
|
||||
lazyload: true
|
||||
});
|
||||
emailMenu.subscribe("beforeShow", function() {
|
||||
var oTarget = this.contextEventTarget;
|
||||
if (typeof(oTarget) == "undefined")
|
||||
return;
|
||||
var grid = SUGAR.email2.grid;
|
||||
var selectedRows = grid.getSelectedRows();
|
||||
var multipleSelected = (selectedRows.length > 1) ? true: false;
|
||||
if (!multipleSelected)
|
||||
{
|
||||
grid.unselectAllRows();
|
||||
grid.selectRow(oTarget);
|
||||
SUGAR.email2.contextMenus.showEmailsListMenu(grid, grid.getRecord(oTarget));
|
||||
}
|
||||
else if(multipleSelected)
|
||||
{
|
||||
SUGAR.email2.contextMenus.showEmailsListMenu(grid, grid.getRecord(oTarget));
|
||||
}
|
||||
});
|
||||
|
||||
//When we need to access menu items later we can only do so by indexes so we create a mapping to allow
|
||||
//us to access individual elements easier by name rather than by index
|
||||
emailMenu.itemsMapping = {'viewRelationships':0, 'openMultiple': 1, 'archive' : 2, 'reply' : 3,'replyAll' : 4,'forward' : 5,
|
||||
'delete' : 6,'print' : 7,'mark' : 8,'assignTo' : 9, 'relateTo' : 10};
|
||||
emailMenu.addItems([
|
||||
{
|
||||
text: "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=icon_email_relate.gif'/>" + app_strings.LBL_EMAIL_VIEW_RELATIONSHIPS,
|
||||
id: 'showDetailView',
|
||||
onclick: { fn: SEC.showDetailView }
|
||||
},
|
||||
{
|
||||
text: "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=open_multiple.gif'/>" + app_strings.LBL_EMAIL_OPEN_ALL,
|
||||
onclick: { fn: SEC.openMultiple }
|
||||
},
|
||||
{
|
||||
text: "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=icon_email_archive.gif'/>" + app_strings.LBL_EMAIL_ARCHIVE_TO_SUGAR,
|
||||
onclick: { fn: SEC.archiveToSugar }
|
||||
},
|
||||
{
|
||||
text: "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=icon_email_reply.gif'/>"+ app_strings.LBL_EMAIL_REPLY,
|
||||
id: 'reply',
|
||||
onclick: { fn: SEC.replyForwardEmailContext }
|
||||
},
|
||||
{
|
||||
text: "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=icon_email_replyall.gif'/>" + app_strings.LBL_EMAIL_REPLY_ALL,
|
||||
id: 'replyAll',
|
||||
onclick: { fn: SEC.replyForwardEmailContext }
|
||||
},
|
||||
{
|
||||
text: "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=icon_email_forward.gif'/>" + app_strings.LBL_EMAIL_FORWARD,
|
||||
id: 'forward',
|
||||
onclick: { fn: SEC.replyForwardEmailContext }
|
||||
},
|
||||
{
|
||||
text: "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=icon_email_delete.gif'/>" + app_strings.LBL_EMAIL_DELETE,
|
||||
id: 'delete',
|
||||
onclick: { fn: SEC.markDeleted }
|
||||
},
|
||||
{
|
||||
text: "<img src='themes/default/images/Print_Email.gif'/>" + app_strings.LBL_EMAIL_PRINT,
|
||||
id: 'print',
|
||||
onclick: { fn: SEC.viewPrintable }
|
||||
},
|
||||
// Mark... submenu
|
||||
{
|
||||
text: "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=icon_email_mark.gif'/>" + app_strings.LBL_EMAIL_MARK,
|
||||
submenu: {
|
||||
id: "markEmailMenu",
|
||||
itemdata : [
|
||||
{
|
||||
text: app_strings.LBL_EMAIL_MARK + " " + app_strings.LBL_EMAIL_MARK_UNREAD,
|
||||
onclick: { fn: SEC.markUnread }
|
||||
},
|
||||
{
|
||||
text: app_strings.LBL_EMAIL_MARK + " " + app_strings.LBL_EMAIL_MARK_READ,
|
||||
onclick: { fn: SEC.markRead }
|
||||
},
|
||||
{
|
||||
text: app_strings.LBL_EMAIL_MARK + " " + app_strings.LBL_EMAIL_MARK_FLAGGED,
|
||||
onclick: { fn: SEC.markFlagged }
|
||||
},
|
||||
{
|
||||
text: app_strings.LBL_EMAIL_MARK + " " + app_strings.LBL_EMAIL_MARK_UNFLAGGED,
|
||||
onclick: { fn: SEC.markUnflagged }
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=icon_email_assign.gif'/>" + app_strings.LBL_EMAIL_ASSIGN_TO,
|
||||
id: 'assignTo',
|
||||
onclick: { fn: SEC.assignEmailsTo }
|
||||
},
|
||||
{
|
||||
text: "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=icon_email_relate.gif'/>" + app_strings.LBL_EMAIL_RELATE_TO,
|
||||
id: 'relateTo',
|
||||
onclick: { fn: SEC.relateTo }
|
||||
}
|
||||
]);
|
||||
SEC.emailListContextMenu.render();
|
||||
|
||||
//Handle the Tree folder menu trigger ourselves
|
||||
YAHOO.util.Event.addListener(YAHOO.util.Dom.get("emailtree"), "contextmenu", SUGAR.email2.folders.handleRightClick)
|
||||
|
||||
|
||||
//Folder Menu
|
||||
SEC.frameFoldersContextMenu = new YAHOO.widget.ContextMenu("folderContextMenu", {
|
||||
trigger: "",
|
||||
lazyload: true
|
||||
});
|
||||
SEC.frameFoldersContextMenu.addItems([
|
||||
{ text: "<img src='index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=icon_email_check.gif'/>" + app_strings.LBL_EMAIL_CHECK,
|
||||
//helptext: "<i>" + app_strings.LBL_EMAIL_MENU_HELP_ADD_FOLDER + "</i>",
|
||||
onclick: { fn: function() {
|
||||
var node = SUGAR.email2.clickedFolderNode;
|
||||
if (node.data.ieId) {
|
||||
SUGAR.email2.folders.startEmailCheckOneAccount(node.data.ieId, false)};
|
||||
}}
|
||||
},
|
||||
{ text: app_strings.LBL_EMAIL_MENU_SYNCHRONIZE,
|
||||
//helptext: "<i>" + app_strings.LBL_EMAIL_MENU_HELP_ADD_FOLDER + "</i>",
|
||||
onclick: { fn: function() {
|
||||
var node = SUGAR.email2.clickedFolderNode;
|
||||
if (node.data.ieId) {
|
||||
SUGAR.email2.folders.startEmailCheckOneAccount(node.data.ieId, true)};
|
||||
}}
|
||||
},
|
||||
{
|
||||
text: app_strings.LBL_EMAIL_MENU_ADD_FOLDER,
|
||||
//helptext: "<i>" + app_strings.LBL_EMAIL_MENU_HELP_ADD_FOLDER + "</i>",
|
||||
onclick: { fn: SUGAR.email2.folders.folderAdd }
|
||||
},
|
||||
{
|
||||
text: app_strings.LBL_EMAIL_MENU_DELETE_FOLDER,
|
||||
//helptext: "<i>" + app_strings.LBL_EMAIL_MENU_HELP_DELETE_FOLDER + "</i>",
|
||||
onclick: { fn: SUGAR.email2.folders.folderDelete }
|
||||
},
|
||||
{
|
||||
text: app_strings.LBL_EMAIL_MENU_RENAME_FOLDER,
|
||||
//helptext: "<i>" + app_strings.LBL_EMAIL_MENU_HELP_RENAME_FOLDER + "</i>",
|
||||
onclick: { fn: SUGAR.email2.folders.folderRename }
|
||||
},
|
||||
{
|
||||
text: app_strings.LBL_EMAIL_MENU_EMPTY_TRASH,
|
||||
//helptext: "<i>" + app_strings.LBL_EMAIL_MENU_HELP_EMPTY_TRASH + "</i>",
|
||||
onclick: { fn: SUGAR.email2.folders.emptyTrash }
|
||||
},
|
||||
{
|
||||
text: app_strings.LBL_EMAIL_MENU_CLEAR_CACHE,
|
||||
onclick: { fn: function() {
|
||||
var node = SUGAR.email2.clickedFolderNode;
|
||||
if (node.data.ieId) {
|
||||
SUGAR.email2.folders.clearCacheFiles(node.data.ieId)};
|
||||
}}
|
||||
}
|
||||
]);
|
||||
SEC.frameFoldersContextMenu.render();
|
||||
|
||||
SEC.initContactsMenu = function() {
|
||||
// contacts
|
||||
SEC.contactsContextMenu = new YAHOO.widget.ContextMenu("contactsMenu", {
|
||||
trigger: "contacts",
|
||||
lazyload: true
|
||||
});
|
||||
SEC.contactsContextMenu.addItems([
|
||||
{
|
||||
text: app_strings.LBL_EMAIL_MENU_REMOVE,
|
||||
onclick:{ fn: SUGAR.email2.addressBook.removeContact }
|
||||
},
|
||||
{
|
||||
text: app_strings.LBL_EMAIL_MENU_COMPOSE,
|
||||
onclick:{ fn: function() {SUGAR.email2.addressBook.composeTo('contacts')}}
|
||||
}
|
||||
]);
|
||||
SEC.contactsContextMenu.subscribe("beforeShow", function() {
|
||||
var oTarget = this.contextEventTarget, grid = SUGAR.email2.contactView;
|
||||
if (oTarget && !grid.isSelected(oTarget)) {
|
||||
grid.unselectAllRows();
|
||||
grid.selectRow(oTarget);
|
||||
}
|
||||
});
|
||||
SEC.contactsContextMenu.render();
|
||||
}
|
||||
|
||||
|
||||
// set auto-check timer
|
||||
SUGAR.email2.folders.startCheckTimer();
|
||||
// check if we're coming from an email-link click
|
||||
setTimeout("SUGAR.email2.composeLayout.composePackage()", 2000);
|
||||
|
||||
YAHOO.util.Event.on(window, 'resize', SUGAR.email2.autoSetLayout);
|
||||
|
||||
//Init fix for YUI 2.7.0 datatable sort.
|
||||
SUGAR.email2.addressBook.initFixForDatatableSort();
|
||||
}
|
||||
|
||||
function createTreePanel(treeData, params) {
|
||||
var tree = new YAHOO.widget.TreeView(params.id);
|
||||
var root = tree.getRoot();
|
||||
|
||||
//if (treeData.nodes && treeData[0].id == "Home")
|
||||
// treeData = treeData[0];
|
||||
|
||||
addChildNodes(root, treeData);
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
function addChildNodes(parentNode, parentData) {
|
||||
var Ck = YAHOO.util.Cookie;
|
||||
var nextyear = SUGAR.email2.nextYear;
|
||||
var nodes = parentData.nodes || parentData.children;
|
||||
for (i in nodes) {
|
||||
if (typeof(nodes[i]) == 'object') {
|
||||
if (nodes[i].data) {
|
||||
nodes[i].data.href = '#';
|
||||
var node = new YAHOO.widget.TextNode(nodes[i].data, parentNode)
|
||||
node.action = nodes[i].data.action;
|
||||
} else {
|
||||
if (nodes[i].id == SUGAR.language.get('app_strings','LBL_EMAIL_HOME_FOLDER')) {
|
||||
addChildNodes(parentNode, nodes[i]);
|
||||
return;
|
||||
}
|
||||
nodes[i].expanded = Ck.getSub("EmailTreeLayout", nodes[i].id + "") == "true";
|
||||
Ck.setSub("EmailTreeLayout", nodes[i].id + "", nodes[i].expanded ? true : false, {expires: SUGAR.email2.nextYear});
|
||||
if (nodes[i].cls) {
|
||||
nodes[i].className = nodes[i].cls;
|
||||
}
|
||||
nodes[i].href = "#";
|
||||
if (nodes[i].text) nodes[i].label = nodes[i].text;
|
||||
//Override YUI child node creation
|
||||
if (nodes[i].children) {
|
||||
nodes[i].nodes = nodes[i].children;
|
||||
nodes[i].children = [ ];
|
||||
}
|
||||
var node = new YAHOO.widget.TextNode(nodes[i], parentNode);
|
||||
}
|
||||
|
||||
if (typeof(nodes[i].nodes) == 'object') {
|
||||
addChildNodes(node, nodes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom TreeView initialization sequence to setup DragDrop targets for every tree node
|
||||
*/
|
||||
function email2treeinit(tree, treedata, treediv, params) {
|
||||
//ensure the tree data is not corrupt
|
||||
if (!treedata) {
|
||||
return;
|
||||
}
|
||||
if (SUGAR.email2.tree) {
|
||||
SUGAR.email2.tree.destroy();
|
||||
SUGAR.email2.tree = null;
|
||||
}
|
||||
|
||||
var tree = SUGAR.email2.tree = createTreePanel({nodes : {}}, {
|
||||
id: 'emailtree'
|
||||
});
|
||||
|
||||
tree.subscribe("clickEvent", SUGAR.email2.folders.handleClick);
|
||||
tree.subscribe("collapseComplete", function(node){YAHOO.util.Cookie.setSub("EmailTreeLayout", node.data.id + "", false, {expires: SUGAR.email2.nextYear});});
|
||||
tree.subscribe("expandComplete", function(node){
|
||||
YAHOO.util.Cookie.setSub("EmailTreeLayout", node.data.id + "", true, {expires: SUGAR.email2.nextYear});
|
||||
for (var i in node.children) {
|
||||
SE.accounts.setupDDTarget(node.children[i]);
|
||||
}
|
||||
});
|
||||
tree.setCollapseAnim("TVSlideOut");
|
||||
tree.setExpandAnim("TVSlideIn");
|
||||
var root = tree.root;
|
||||
while (root.hasChildren()) {
|
||||
var node = root.children[0];
|
||||
node.destroy();
|
||||
tree.removeNode(root.children[0], false);
|
||||
}
|
||||
addChildNodes(root, treedata);
|
||||
tree.render();
|
||||
SUGAR.email2.accounts.renderTree();
|
||||
}
|
||||
|
||||
SUGAR.email2.folders.folderDD = function(id, sGroup, config) {
|
||||
SUGAR.email2.folders.folderDD.superclass.constructor.call(this, id, sGroup, config);
|
||||
};
|
||||
|
||||
|
||||
YAHOO.extend(SUGAR.email2.folders.folderDD, YAHOO.util.DDProxy, {
|
||||
startDrag: function(x, y) {
|
||||
var Dom = YAHOO.util.Dom;
|
||||
this.dragNode = SUGAR.email2.tree.getNodeByElement(this.getEl());
|
||||
|
||||
this.dragId = "";
|
||||
var dragEl = this.getDragEl();
|
||||
var clickEl = this.getEl();
|
||||
Dom.setStyle(clickEl, "color", "#AAA");
|
||||
Dom.setStyle(clickEl, "opacity", "0.25");
|
||||
dragEl.innerHTML = clickEl.innerHTML;
|
||||
|
||||
Dom.addClass(dragEl, "ygtvcell");
|
||||
Dom.addClass(dragEl, "ygtvcontent");
|
||||
Dom.addClass(dragEl, "folderDragProxy");
|
||||
Dom.setStyle(dragEl, "height", (clickEl.clientHeight - 5) + "px");
|
||||
Dom.setStyle(dragEl, "width", (clickEl.clientWidth - 5) + "px");
|
||||
Dom.setStyle(dragEl, "backgroundColor", "#FFF");
|
||||
Dom.setStyle(dragEl, "opacity", "0.5");
|
||||
Dom.setStyle(dragEl, "border", "1px solid #AAA");
|
||||
},
|
||||
|
||||
onDragOver: function(ev, id) {
|
||||
var Dom = YAHOO.util.Dom;
|
||||
if (id != this.dragId)
|
||||
{
|
||||
var node = SUGAR.email2.tree.getNodeByElement(YAHOO.util.Dom.get(id));
|
||||
if(node.data.cls != "sugarFolder") {
|
||||
SUGAR.email2.folders.unhighliteAll();
|
||||
return;
|
||||
}
|
||||
this.dragId = id;
|
||||
this.targetNode = node;
|
||||
SUGAR.email2.folders.unhighliteAll();
|
||||
node.highlight();
|
||||
}
|
||||
},
|
||||
|
||||
onDragOut: function(e, id) {
|
||||
if (this.targetNode) {
|
||||
SUGAR.email2.folders.unhighliteAll();
|
||||
this.targetNode = false;
|
||||
this.dragId = false;
|
||||
}
|
||||
},
|
||||
|
||||
endDrag: function() {
|
||||
YAHOO.util.Dom.setStyle(this.getEl(), "opacity", "1.0");
|
||||
if (this.targetNode) {
|
||||
SUGAR.email2.folders.moveFolder(this.dragNode.data.id, this.targetNode.data.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
595
modules/Emails/javascript/prototypeOverloads.js
vendored
Executable file
595
modules/Emails/javascript/prototypeOverloads.js
vendored
Executable file
@@ -0,0 +1,595 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU 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 General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU 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 General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU 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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
YAHOO.util.Connect.uploadFile = function(id, callback, uri, postData){
|
||||
// Each iframe has an id prefix of "yuiIO" followed
|
||||
// by the unique transaction id.
|
||||
var frameId = 'yuiIO' + id;
|
||||
var io = document.getElementById(frameId);
|
||||
|
||||
|
||||
/*
|
||||
* SUGAR - adding try/catch to this block as IE7 has some issue with this the first time it is called.
|
||||
*/
|
||||
// Initialize the HTML form properties in case they are
|
||||
// not defined in the HTML form.
|
||||
try {
|
||||
this._formNode.action = null;
|
||||
this._formNode.action = uri;
|
||||
} catch(e) {
|
||||
|
||||
}
|
||||
this._formNode.method = 'POST';
|
||||
this._formNode.target = frameId;
|
||||
|
||||
if(this._formNode.encoding){
|
||||
// IE does not respect property enctype for HTML forms.
|
||||
// Instead use property encoding.
|
||||
this._formNode.encoding = 'multipart/form-data';
|
||||
}
|
||||
else{
|
||||
this._formNode.enctype = 'multipart/form-data';
|
||||
}
|
||||
|
||||
if(postData){
|
||||
var oElements = this.appendPostData(postData);
|
||||
}
|
||||
|
||||
this._formNode.submit();
|
||||
|
||||
if(oElements && oElements.length > 0){
|
||||
try
|
||||
{
|
||||
for(var i=0; i < oElements.length; i++){
|
||||
this._formNode.removeChild(oElements[i]);
|
||||
}
|
||||
}
|
||||
catch(e){}
|
||||
}
|
||||
|
||||
// Reset HTML form status properties.
|
||||
this.resetFormState();
|
||||
|
||||
// Create the upload callback handler that fires when the iframe
|
||||
// receives the load event. Subsequently, the event handler is detached
|
||||
// and the iframe removed from the document.
|
||||
|
||||
var uploadCallback = function()
|
||||
{
|
||||
var obj = {};
|
||||
obj.tId = id;
|
||||
obj.argument = callback.argument;
|
||||
|
||||
try
|
||||
{
|
||||
obj.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
|
||||
obj.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
|
||||
}
|
||||
catch(e){}
|
||||
|
||||
if(callback.upload){
|
||||
if(!callback.scope){
|
||||
callback.upload(obj);
|
||||
}
|
||||
else{
|
||||
callback.upload.apply(callback.scope, [obj]);
|
||||
}
|
||||
}
|
||||
|
||||
if(YAHOO.util.Event){
|
||||
YAHOO.util.Event.removeListener(io, "load", uploadCallback);
|
||||
}
|
||||
else if(window.detachEvent){
|
||||
io.detachEvent('onload', uploadCallback);
|
||||
}
|
||||
else{
|
||||
io.removeEventListener('load', uploadCallback, false);
|
||||
}
|
||||
setTimeout(function(){ document.body.removeChild(io); }, 100);
|
||||
};
|
||||
|
||||
|
||||
// Bind the onload handler to the iframe to detect the file upload response.
|
||||
if(YAHOO.util.Event){
|
||||
YAHOO.util.Event.addListener(io, "load", uploadCallback);
|
||||
}
|
||||
else if(window.attachEvent){
|
||||
io.attachEvent('onload', uploadCallback);
|
||||
}
|
||||
else{
|
||||
io.addEventListener('load', uploadCallback, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Need by autocomplete library?
|
||||
*/
|
||||
YAHOO.register = function(name,mainClass,data) {
|
||||
var mods = YAHOO.env.modules;
|
||||
if(!mods[name]) {
|
||||
mods[name] = {versions:[],builds:[]};
|
||||
}
|
||||
|
||||
var m = mods[name], v = data.version, b = data.build, ls = YAHOO.env.listeners;
|
||||
m.name = name;
|
||||
m.version = v;
|
||||
m.build = b;
|
||||
m.versions.push(v);
|
||||
m.builds.push(b);
|
||||
m.mainClass = mainClass;
|
||||
|
||||
for(var i = 0; i<ls.length; i = i+1) {
|
||||
ls[i](m);
|
||||
}
|
||||
|
||||
if(mainClass) {
|
||||
mainClass.VERSION = v;
|
||||
mainClass.BUILD = b;
|
||||
} else {
|
||||
YAHOO.log("mainClass is undefined for module "+name,"warn");
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.lang = {
|
||||
isArray : function(obj) {
|
||||
if(obj && obj.constructor && obj.constructor.toString().indexOf('Array')>-1) {
|
||||
return true;
|
||||
} else {
|
||||
return YAHOO.lang.isObject(obj) && obj.constructor == Array;
|
||||
}
|
||||
},
|
||||
|
||||
isBoolean : function(obj) {
|
||||
return typeof obj == 'boolean';
|
||||
},
|
||||
|
||||
isFunction : function(obj) {
|
||||
return typeof obj == 'function';
|
||||
},
|
||||
|
||||
isNull : function(obj) {
|
||||
return obj == null;
|
||||
},
|
||||
|
||||
isNumber : function(obj) {
|
||||
return typeof obj == 'number' && isFinite(obj);
|
||||
},
|
||||
|
||||
isObject : function(obj) {
|
||||
return obj && (typeof obj == 'object'||YAHOO.lang.isFunction(obj));
|
||||
},
|
||||
|
||||
isString : function(obj) {
|
||||
return typeof obj == 'string';
|
||||
},
|
||||
|
||||
isUndefined : function(obj) {
|
||||
return typeof obj == 'undefined';
|
||||
},
|
||||
|
||||
hasOwnProperty : function(obj,prop) {
|
||||
if(Object.prototype.hasOwnProperty) {
|
||||
return obj.hasOwnProperty(prop);
|
||||
}
|
||||
return !YAHOO.lang.isUndefined(obj[prop]) && obj.constructor.prototype[prop] !== obj[prop];
|
||||
},
|
||||
|
||||
extend : function(subc,superc,overrides) {
|
||||
if(!superc||!subc) {
|
||||
throw new Error("YAHOO.lang.extend failed, please check that "+"all dependencies are included.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Adding some error checking since we're immediately transitioning to a modal dialogue in QuickCreate
|
||||
* and much of this class is unavailable
|
||||
|
||||
YAHOO.widget.Menu.prototype._getOffsetWidth = function() {
|
||||
if(this.element) {
|
||||
var oClone = this.element.cloneNode(true);
|
||||
|
||||
if(typeof(Dom) != 'undefined') {
|
||||
Dom.setStyle(oClone, "width", "");
|
||||
document.body.appendChild(oClone);
|
||||
var sWidth = oClone.offsetWidth;
|
||||
document.body.removeChild(oClone);
|
||||
return sWidth;
|
||||
}
|
||||
}
|
||||
};*/
|
||||
|
||||
|
||||
Ext.Template.prototype.applyTemplate = function(values){
|
||||
var myRE = /\{(\w+\.*\w*)\}/g;
|
||||
if(this.compiled){
|
||||
return this.compiled(values);
|
||||
}
|
||||
var useF = this.disableFormats !== true;
|
||||
var fm = Ext.util.Format, tpl = this;
|
||||
var fn = function(m, name, format, args){
|
||||
if(name.match(/\./g)) {
|
||||
var temp = name.split(".");
|
||||
values[name] = eval(temp[0] + "." + temp[1]);
|
||||
return values[name];
|
||||
}
|
||||
else if(format && useF && typeof(format) == "string") {
|
||||
if(format.substr(0, 5) == "this."){
|
||||
return tpl.call(format.substr(5), values[name], values);
|
||||
}else{
|
||||
if(args){
|
||||
var re = /^\s*['"](.*)["']\s*$/;
|
||||
args = args.split(',');
|
||||
for(var i = 0, len = args.length; i < len; i++){
|
||||
args[i] = args[i].replace(re, "$1");
|
||||
}
|
||||
args = [values[name]].concat(args);
|
||||
}else{
|
||||
args = [values[name]];
|
||||
}
|
||||
return fm[format].apply(fm, args);
|
||||
}
|
||||
}else{
|
||||
return values[name] !== undefined ? values[name] : "";
|
||||
}
|
||||
};
|
||||
return this.html.replace(myRE, fn);
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Fixes an IE7 issue where this.dom.parentNode is null
|
||||
*/
|
||||
Ext.Element.prototype.remove = function() {
|
||||
if(this.dom.parentNode) {
|
||||
this.dom.parentNode.removeChild(this.dom);
|
||||
delete Ext.Element.cache[this.dom.id];
|
||||
}
|
||||
};
|
||||
|
||||
//Adds translated strings to message boxes
|
||||
Ext.onReady(function(){Ext.MessageBox.buttonText = {
|
||||
ok: app_strings.LBL_EMAIL_OK,
|
||||
cancel: app_strings.LBL_EMAIL_CANCEL,
|
||||
yes: app_strings.LBL_EMAIL_YES,
|
||||
no: app_strings.LBL_EMAIL_NO
|
||||
}});
|
||||
|
||||
ContactsDragZone = function(view, config){
|
||||
this.view = view;
|
||||
this.view.dragz = this;
|
||||
this.contacts = [ ];
|
||||
ContactsDragZone.superclass.constructor.call(this, view.el, config);
|
||||
};
|
||||
//This Class recognizes what elements in
|
||||
//the contacts view are drag dropable and when
|
||||
Ext.extend(ContactsDragZone, Ext.dd.DragZone, {
|
||||
setContacts : function(contactArray) {
|
||||
this.contacts = contactArray;
|
||||
},
|
||||
addContact : function(contactObject) {
|
||||
this.contacts.push(contactObject);
|
||||
},
|
||||
getContact : function(index) {
|
||||
return this.contacts[index];
|
||||
},
|
||||
getContactFromEmail : function(emailId) {
|
||||
for(i in this.contacts) {
|
||||
var contact = this.contacts[i];
|
||||
for(j in contact.email) {
|
||||
if (contact.email[j].id && contact.email[j].id == emailId) {
|
||||
return contact;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
getPrimaryEmail : function(contactId) {
|
||||
var contact = this.contacts[contactId];
|
||||
for(j in contact.email) {
|
||||
if (contact.email[j].id && contact.email[j].primary_address == "1") {
|
||||
return contact.email[j];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
toggleContact : function(view, index, node, e) {
|
||||
e = Ext.EventObject.setEvent(e);
|
||||
e.preventDefault();
|
||||
if (node.className.indexOf('address-contact') > -1) {
|
||||
var expNode = view.getNode('ex' + node.id);
|
||||
expNode.style.display = "";
|
||||
var contact = view.dragz.getContact(node.id);
|
||||
for(i in contact.email) {
|
||||
if (contact.email[i].id) {
|
||||
view.getNode(contact.email[i].id).style.display = "";
|
||||
}
|
||||
}
|
||||
var i = 0;
|
||||
node.style.display="none";
|
||||
view.clearSelections(true);
|
||||
view.select(expNode);
|
||||
}
|
||||
//Collapse Expanded Contact
|
||||
else if (node.className.indexOf('address-exp-contact') > -1) {
|
||||
var origId = node.id.substring(2);
|
||||
var colNode = view.getNode(origId);
|
||||
colNode.style.display = "";
|
||||
var contact = view.dragz.getContact(origId);
|
||||
for(i in contact.email) {
|
||||
if (contact.email[i].id) {
|
||||
view.getNode(contact.email[i].id).style.display = "none";
|
||||
}
|
||||
}
|
||||
node.style.display="none";
|
||||
view.clearSelections(true);
|
||||
view.select(colNode);
|
||||
}
|
||||
},
|
||||
toggleList : function(view, index, node, e) {
|
||||
e = Ext.EventObject.setEvent(e);
|
||||
e.preventDefault();
|
||||
if (node.className.indexOf('address-list') > -1) {
|
||||
var length = node.getAttribute('size');
|
||||
if (length > 0) {
|
||||
var emails = view.getNodes(index + 1, index + parseInt(length));
|
||||
for(var i=0; i < emails.length; i++) {
|
||||
if (emails[i]) {
|
||||
emails[i].style.display = (emails[i].style.display == 'none') ? '' : 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
view.clearSelections(true);
|
||||
view.select(node);
|
||||
},
|
||||
//initizlized Drag-Drop objects and proxies.
|
||||
getDragData : function(e){
|
||||
e = Ext.EventObject.setEvent(e);
|
||||
e.preventDefault();
|
||||
var target = e.getTarget('.address-contact') || e.getTarget('.address-email');
|
||||
if(target){
|
||||
var view = this.view;
|
||||
if(!view.isSelected(target)){
|
||||
view.select(target, e.ctrlKey);
|
||||
}
|
||||
var selNodes = view.getSelectedNodes();
|
||||
var dragData = { }
|
||||
if(selNodes.length == 1){
|
||||
dragData.nodes = target;
|
||||
var proxy = document.createElement('div');
|
||||
if (target.className.indexOf('address-contact') != -1) {
|
||||
var email = view.getNode(view.dragz.getPrimaryEmail(target.id).id);
|
||||
proxy.innerHTML = target.innerHTML + email.innerHTML;
|
||||
} else {
|
||||
var id = view.dragz.getContactFromEmail(target.id).id;
|
||||
proxy.innerHTML = view.getNode(id).innerHTML + target.innerHTML;
|
||||
}
|
||||
dragData.ddel = proxy;
|
||||
dragData.single = true;
|
||||
|
||||
}else{
|
||||
dragData.nodes = [];
|
||||
var div = document.createElement('div'); // create the multi element drag "ghost"
|
||||
div.className = 'contacts-multi-proxy';
|
||||
for(var i = 0, len = selNodes.length; i < len; i++){
|
||||
if (selNodes[i].className.indexOf('address-exp-contact') < 0 && selNodes[i].style.display != "none") {
|
||||
//Append the default email to a contact drag proxy
|
||||
var proxy = document.createElement('div');
|
||||
if (selNodes[i].className.indexOf('address-contact') != -1) {
|
||||
var email = view.getNode(view.dragz.getPrimaryEmail(selNodes[i].id).id);
|
||||
proxy.innerHTML = selNodes[i].innerHTML + email.innerHTML;
|
||||
} else {
|
||||
var id = view.dragz.getContactFromEmail(selNodes[i].id).id;
|
||||
proxy.innerHTML = view.getNode(id).innerHTML + selNodes[i].innerHTML;
|
||||
}
|
||||
div.appendChild(proxy);
|
||||
dragData.nodes.push(selNodes[i]);
|
||||
}
|
||||
}
|
||||
dragData.ddel = div;
|
||||
dragData.multi = true;
|
||||
}
|
||||
return dragData;
|
||||
}
|
||||
var target = e.getTarget('.address-list');
|
||||
if (target) {
|
||||
var view = this.view;
|
||||
if(!view.isSelected(target)){
|
||||
view.select(target, e.ctrlKey);
|
||||
}
|
||||
var selNodes = view.getSelectedNodes();
|
||||
var dragData = { }
|
||||
if(selNodes.length == 1){
|
||||
dragData.nodes = target;
|
||||
dragData.ddel = target;
|
||||
dragData.single = true;
|
||||
}
|
||||
else {
|
||||
dragData.nodes = [];
|
||||
var div = document.createElement('div'); // create the multi element drag "ghost"
|
||||
div.className = 'contacts-multi-proxy';
|
||||
for(var i = 0, len = selNodes.length; i < len; i++){
|
||||
if (selNodes[i].className.indexOf('address-list') > -1) {
|
||||
//Append the default email to a contact drag proxy
|
||||
var proxy = document.createElement('div');
|
||||
proxy.innerHTML = selNodes[i].innerHTML;
|
||||
div.appendChild(proxy);
|
||||
dragData.nodes.push(selNodes[i]);
|
||||
}
|
||||
}
|
||||
dragData.ddel = div;
|
||||
dragData.multi = true;
|
||||
}
|
||||
return dragData;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
ListDropZone = function(view, config){
|
||||
this.view = view;
|
||||
ListDropZone.superclass.constructor.call(this, view.el, config);
|
||||
};
|
||||
//This Class handels contacts dropped onto Mailing Lists
|
||||
Ext.extend(ListDropZone, Ext.dd.DropZone, {
|
||||
getTargetFromEvent : function(e){
|
||||
e = Ext.EventObject.setEvent(e);
|
||||
//e.preventDefault();
|
||||
var target = e.getTarget('.address-list');
|
||||
if(target){
|
||||
var view = this.view;
|
||||
if(!view.isSelected(target)){
|
||||
view.select(target, e.ctrlKey);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onNodeOver : function(node, source, e, data ) {
|
||||
if (source.id == 'contacts') {
|
||||
return "x-dd-drop-ok-add";
|
||||
} else {
|
||||
return this.dropNotAllowed;
|
||||
}
|
||||
},
|
||||
onNodeDrop : function(node, source, e, data) {
|
||||
if (source.id == 'contacts') {
|
||||
SUGAR.email2.addressBook.addContactsToMailinglist(node, data);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Workaround for sliding panel noted here: http://extjs.com/forum/showthread.php?t=11899
|
||||
*/
|
||||
Ext.override(Ext.SplitLayoutRegion, {
|
||||
initAutoHide: function(){
|
||||
if (this.autoHide !== false) {
|
||||
if (!this.autoHideHd) {
|
||||
var st = new Ext.util.DelayedTask(this.slideIn, this);
|
||||
this.autoHideHd = {
|
||||
"mouseout": function(e){
|
||||
if (!e.within(this.el, true)) {
|
||||
var box = this.el.getBox();
|
||||
if (e.getPageX() > -1 && e.getPageY() > -1 &&
|
||||
(e.getPageX() < box.x || e.getPageX() > box.right ||
|
||||
e.getPageY() < box.y || e.getPageY() > box.bottom)) {
|
||||
st.delay(500);
|
||||
}
|
||||
}
|
||||
},
|
||||
"mouseover": function(e){
|
||||
st.cancel();
|
||||
},
|
||||
scope: this
|
||||
};
|
||||
}
|
||||
this.el.on(this.autoHideHd);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* override tinyMCE methods for IE7 (specific to SugarCRM, since the normal code works fine in their examples)
|
||||
*/
|
||||
tinyMCE.loadScript = function(url) {
|
||||
var i;
|
||||
|
||||
for (i=0; i<this.loadedFiles.length; i++) {
|
||||
if (this.loadedFiles[i] == url)
|
||||
return;
|
||||
}
|
||||
|
||||
if (tinyMCE.settings.strict_loading_mode) {
|
||||
this.pendingFiles[this.pendingFiles.length] = url;
|
||||
} else if(this.isIE) {
|
||||
/*
|
||||
* SUGARCRM - added this else if() clause
|
||||
*/
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = url;
|
||||
document.getElementsByTagName('head')[0].appendChild(script);
|
||||
} else {
|
||||
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></script>');
|
||||
}
|
||||
|
||||
this.loadedFiles[this.loadedFiles.length] = url;
|
||||
}
|
||||
|
||||
tinyMCE.loadCSS = function(url) {
|
||||
var ar = url.replace(/\s+/, '').split(',');
|
||||
var lflen = 0, csslen = 0;
|
||||
var skip = false;
|
||||
var x = 0, i = 0, nl, le;
|
||||
|
||||
for (x = 0,csslen = ar.length; x<csslen; x++) {
|
||||
if (ar[x] != null && ar[x] != 'null' && ar[x].length > 0) {
|
||||
/* Make sure it doesn't exist. */
|
||||
for (i=0, lflen=this.loadedFiles.length; i<lflen; i++) {
|
||||
if (this.loadedFiles[i] == ar[x]) {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!skip) {
|
||||
/*
|
||||
* SUGARCRM - added "this.isIE || ..."
|
||||
*/
|
||||
if (this.isIE || tinyMCE.settings.strict_loading_mode) {
|
||||
nl = document.getElementsByTagName("head");
|
||||
|
||||
le = document.createElement('link');
|
||||
le.setAttribute('href', ar[x]);
|
||||
le.setAttribute('rel', 'stylesheet');
|
||||
le.setAttribute('type', 'text/css');
|
||||
|
||||
nl[0].appendChild(le);
|
||||
} else
|
||||
document.write('<link href="' + ar[x] + '" rel="stylesheet" type="text/css" />');
|
||||
|
||||
this.loadedFiles[this.loadedFiles.length] = ar[x];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
52
modules/Emails/javascript/vars.js
Executable file
52
modules/Emails/javascript/vars.js
Executable 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 req;
|
||||
var target;
|
||||
var flexContentOld = "";
|
||||
var forcePreview = false;
|
||||
var inCompose = false;
|
||||
|
||||
/* globals for Callback functions */
|
||||
var email; // AjaxObject.showEmailPreview
|
||||
var ieId;
|
||||
var ieName;
|
||||
var focusFolder;
|
||||
var meta; // AjaxObject.showEmailPreview
|
||||
var sendType;
|
||||
var targetDiv;
|
||||
var urlBase = 'index.php';
|
||||
var urlStandard = 'sugar_body_only=true&to_pdf=true&module=Emails&action=EmailUIAjax';
|
||||
|
||||
var lazyLoadFolder = null;
|
||||
104
modules/Emails/javascript/viewPrintable.js
Executable file
104
modules/Emails/javascript/viewPrintable.js
Executable file
@@ -0,0 +1,104 @@
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
SUGAR.email2.templates['viewPrintable'] = '<html>' +
|
||||
'<body onload="javascript:window.print();">' +
|
||||
'<style>' +
|
||||
'body {' +
|
||||
' margin: 0px;' +
|
||||
' font-family: helvetica, impact, sans-serif;' +
|
||||
' font-size : 12pt;' +
|
||||
'} ' +
|
||||
'table {' +
|
||||
' padding:10px;' +
|
||||
'}' +
|
||||
'</style>' +
|
||||
'<div>' +
|
||||
'<table cellpadding="0" cellspacing="0" border="0" width="100%">' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' <table cellpadding="0" cellspacing="0" border="0" width="100%">' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP valign="top" width="1%" class="displayEmailLabel">' +
|
||||
' {app_strings.LBL_EMAIL_FROM}:' +
|
||||
' </td>' +
|
||||
' <td width="99%" class="displayEmailValue">' +
|
||||
' {email.from_name} <{email.from_addr}>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP valign="top" class="displayEmailLabel">' +
|
||||
' {app_strings.LBL_EMAIL_SUBJECT}:' +
|
||||
' </td>' +
|
||||
' <td NOWRAP valign="top" class="displayEmailValue">' +
|
||||
' <b>{email.name}</b>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP valign="top" class="displayEmailLabel">' +
|
||||
' {app_strings.LBL_EMAIL_DATE_SENT_BY_SENDER}:' +
|
||||
' </td>' +
|
||||
' <td class="displayEmailValue">' +
|
||||
' {email.date_start} {email.time_start}' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td NOWRAP valign="top" class="displayEmailLabel">' +
|
||||
' {app_strings.LBL_EMAIL_TO}:' +
|
||||
' </td>' +
|
||||
' <td class="displayEmailValue">' +
|
||||
' {email.toaddrs}' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' {email.cc}' +
|
||||
' {email.attachments}' +
|
||||
' </table>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' <tr>' +
|
||||
' <td>' +
|
||||
' <table cellpadding="0" cellspacing="0" border="0" style="width:100%;">' +
|
||||
' <tr>' +
|
||||
' <td style="border-top: 1px solid #333;">' +
|
||||
' <div style="padding:5px;">' +
|
||||
'{email.description}' +
|
||||
' </div>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
' </table>' +
|
||||
' </td>' +
|
||||
' </tr>' +
|
||||
'</table>' +
|
||||
'</div>' +
|
||||
'</body></html>';
|
||||
Reference in New Issue
Block a user