/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ /** * @class a YAHOO.util.DDProxy implementation. During the drag over event, the * dragged element is inserted before the dragged-over element. * * @extends YAHOO.util.DDProxy * @constructor * @param {String} id the id of the linked element * @param {String} sGroup the group of related DragDrop objects */ function ygDDList(id, sGroup) { if (id) { this.init(id, sGroup); this.initFrame(); //this.logger = new ygLogger("ygDDList"); } var s = this.getDragEl().style; s.borderColor = "transparent"; s.backgroundColor = "#f6f5e5"; s.opacity = 0.76; s.filter = "alpha(opacity=76)"; } ygDDList.prototype = new YAHOO.util.DDProxy(); ygDDList.prototype.borderDiv = null; ygDDList.prototype.originalDisplayProperties = Array(); ygDDList.prototype.startDrag = function(x, y) { //this.logger.debug(this.id + " startDrag"); var dragEl = this.getDragEl(); var clickEl = this.getEl(); dragEl.innerHTML = clickEl.innerHTML; dragElObjects = dragEl.getElementsByTagName('object'); dragEl.className = clickEl.className; dragEl.style.color = clickEl.style.color; dragEl.style.border = "1px solid #aaa"; // save the style of the object clickElRegion = YAHOO.util.Dom.getRegion(clickEl); this.borderDiv = document.createElement('div'); // create a div to display border this.borderDiv.style.height = (clickElRegion.bottom - clickElRegion.top) + 'px'; this.borderDiv.style.border = '2px dashed #cccccc'; for(i in clickEl.childNodes) { // hide contents of the target elements contents if(typeof clickEl.childNodes[i].style != 'undefined') { this.originalDisplayProperties[i] = clickEl.childNodes[i].style.display; clickEl.childNodes[i].style.display = 'none'; } } clickEl.appendChild(this.borderDiv); }; ygDDList.prototype.endDrag = function(e) { // disable moving the linked element var clickEl = this.getEl(); clickEl.removeChild(this.borderDiv); // remove border div for(i in clickEl.childNodes) { // show target elements contents if(typeof clickEl.childNodes[i].style != 'undefined') { clickEl.childNodes[i].style.display = this.originalDisplayProperties[i]; } } if(this.clickHeight) clickEl.style.height = this.clickHeight; else clickEl.style.height = ''; if(this.clickBorder) clickEl.style.border = this.clickBorder; else clickEl.style.border = ''; dragEl = this.getDragEl(); dragEl.innerHTML = ''; this.afterEndDrag(e); }; ygDDList.prototype.afterEndDrag = function(e) { } ygDDList.prototype.onDrag = function(e, id) { }; ygDDList.prototype.onDragOver = function(e, id) { // this.logger.debug(this.id.toString() + " onDragOver " + id); var el; if ("string" == typeof id) { el = YAHOO.util.DDM.getElement(id); } else { el = YAHOO.util.DDM.getBestMatch(id).getEl(); } dragEl = this.getDragEl(); elRegion = YAHOO.util.Dom.getRegion(el); // this.logger.debug('id: ' + el.id); // this.logger.debug('size: ' + (elRegion.bottom - elRegion.top)); // this.logger.debug('getPosY: ' + YAHOO.util.DDM.getPosY(el)); var mid = YAHOO.util.DDM.getPosY(el) + (Math.floor((elRegion.bottom - elRegion.top) / 2)); // this.logger.debug('mid: ' + mid); // this.logger.debug(YAHOO.util.DDM.getPosY(dragEl) + " < " + mid); // this.logger.debug("Y: " + YAHOO.util.Event.getPageY(e)); if (YAHOO.util.DDM.getPosY(dragEl) < mid ) { // insert on top triggering item var el2 = this.getEl(); var p = el.parentNode; p.insertBefore(el2, el); } if (YAHOO.util.DDM.getPosY(dragEl) >= mid ) { // insert below triggered item var el2 = this.getEl(); var p = el.parentNode; p.insertBefore(el2, el.nextSibling); } }; ygDDList.prototype.onDragEnter = function(e, id) { // this.logger.debug(this.id.toString() + " onDragEnter " + id); // this.getDragEl().style.border = "1px solid #449629"; }; ygDDList.prototype.onDragOut = function(e, id) { // I need to know when we are over nothing // this.getDragEl().style.border = "1px solid #964428"; } ///////////////////////////////////////////////////////////////////////////// function ygDDListBoundary(id, sGroup) { if (id) { this.init(id, sGroup); //this.logger = new ygLogger("ygDDListBoundary"); this.isBoundary = true; } } ygDDListBoundary.prototype = new YAHOO.util.DDTarget(); // End of File include/javascript/yui/ygDDList.js /********************************************************************************* * SugarCRM is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 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(){if(SUGAR.EmailAddressWidget)return;var Dom=YAHOO.util.Dom;SUGAR.EmailAddressWidget=function(module){if(!SUGAR.EmailAddressWidget.count[module])SUGAR.EmailAddressWidget.count[module]=0;this.count=SUGAR.EmailAddressWidget.count[module];SUGAR.EmailAddressWidget.count[module]++;this.module=module;this.id=this.module+this.count;if(document.getElementById(module+'_email_widget_id')) document.getElementById(module+'_email_widget_id').value=this.id;SUGAR.EmailAddressWidget.instances[this.id]=this;} SUGAR.EmailAddressWidget.instances={};SUGAR.EmailAddressWidget.count={};SUGAR.EmailAddressWidget.prototype={emailTemplate:''+''+' '+''+''+''+''+'',numberEmailAddresses:0,replyToFlagObject:new Object(),verifying:false,enterPressed:false,tabPressed:false,emailView:"",emailIsRequired:false,tabIndex:-1,prefillEmailAddresses:function(tableId,o){for(i=0;i1){verifyElementFlag.parentNode.removeChild(verifyElementFlag.parentNode.lastChild);} var verifiedTextNode=document.createElement('span');verifiedTextNode.innerHTML='';verifyElementFlag.parentNode.appendChild(verifiedTextNode);verifyElementFlag.value="true";this.verifyElementValue=Dom.get(this.id+'emailAddressVerifiedValue'+index);this.verifyElementValue.value=Dom.get(this.id+'emailAddress'+index).value;this.verifying=false;var savePressed=false;if(event){var elm=document.activeElement||event.explicitOriginalTarget;if(typeof elm.type!='undefined'&&/submit|button/.test(elm.type.toLowerCase())){savePressed=true;}} if(savePressed||this.enterPressed){setTimeout("SUGAR.EmailAddressWidget.instances."+this.id+".forceSubmit()",2100);}else if(this.tabPressed){Dom.get(this.id+'emailAddressPrimaryFlag'+index).focus();}} var event=this.getEvent(event);var targetEl=this.getEventElement(event);var index=/[a-z]*\d?emailAddress(\d+)/i.exec(targetEl.id)[1];var verifyElementFlag=Dom.get(this.id+'emailAddressVerifiedFlag'+index);this.verifyElementValue=Dom.get(this.id+'emailAddressVerifiedValue'+index);verifyElementFlag.value=(trim(targetEl.value)==''||targetEl.value==this.verifyElementValue.value)?"true":"false" if(verifyElementFlag.parentNode.childNodes.length>1){verifyElementFlag.parentNode.removeChild(verifyElementFlag.parentNode.lastChild);} if(/emailAddress\d+$/.test(targetEl.id)&&isValidEmail(targetEl.value)&&!this.verifying&&verifyElementFlag.value=="false"){verifiedTextNode=document.createElement('span');verifyElementFlag.parentNode.appendChild(verifiedTextNode);verifiedTextNode.innerHTML=SUGAR.language.get('app_strings','LBL_VERIFY_EMAIL_ADDRESS');this.verifying=true;var cObj=YAHOO.util.Connect.asyncRequest('GET','index.php?module=Contacts&action=RetrieveEmail&target='+targetEl.id+'&email='+targetEl.value,{success:callbackFunction,failure:callbackFunction,scope:this});}},handleKeyDown:function(event){var e=this.getEvent(event);var eL=this.getEventElement(e);if((kc=e["keyCode"])){this.enterPressed=(kc==13)?true:false;this.tabPressed=(kc==9)?true:false;if(this.enterPressed||this.tabPressed){this.retrieveEmailAddress(e);if(this.enterPressed);this.freezeEvent(e);}}},getEvent:function(event){return(event?event:window.event);},getEventElement:function(e){return(e.srcElement?e.srcElement:(e.target?e.target:e.currentTarget));},freezeEvent:function(e){if(e.preventDefault)e.preventDefault();e.returnValue=false;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();return false;},addEmailAddress:function(tableId,address,primaryFlag,replyToFlag,optOutFlag,invalidFlag){if(this.addInProgress) return;this.addInProgress=true;if(!address) address="";var insertInto=Dom.get(tableId);var parentObj=insertInto.parentNode;var newContent=document.createElement("input");var nav=new String(navigator.appVersion);var newContentPrimaryFlag;if(SUGAR.isIE){newContentPrimaryFlag=document.createElement("");}else{newContentPrimaryFlag=document.createElement("input");} var newContentReplyToFlag=document.createElement("input");var newContentOptOutFlag=document.createElement("input");var newContentInvalidFlag=document.createElement("input");var newContentVerifiedFlag=document.createElement("input");var newContentVerifiedValue=document.createElement("input");var removeButton=document.createElement("img");var tbody=document.createElement("tbody");var tr=document.createElement("tr");var td1=document.createElement("td");var td2=document.createElement("td");var td3=document.createElement("td");var td4=document.createElement("td");var td5=document.createElement("td");var td6=document.createElement("td");var td7=document.createElement("td");var td8=document.createElement("td");newContent.setAttribute("type","text");newContent.setAttribute("name",this.id+"emailAddress"+this.numberEmailAddresses);newContent.setAttribute("id",this.id+"emailAddress"+this.numberEmailAddresses);newContent.setAttribute("tabindex",this.tabIndex);newContent.setAttribute("size","30");if(address!=''){newContent.setAttribute("value",address);} removeButton.setAttribute("id",this.id+"removeButton"+this.numberEmailAddresses);removeButton.setAttribute("class","id-ff-remove");removeButton.setAttribute("name",this.numberEmailAddresses);removeButton.eaw=this;removeButton.setAttribute("src","index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=id-ff-remove.png");removeButton.onclick=function(){this.eaw.removeEmailAddress(this.name);};newContentPrimaryFlag.setAttribute("type","radio");newContentPrimaryFlag.setAttribute("name",this.id+"emailAddressPrimaryFlag");newContentPrimaryFlag.setAttribute("id",this.id+"emailAddressPrimaryFlag"+this.numberEmailAddresses);newContentPrimaryFlag.setAttribute("value",this.id+"emailAddress"+this.numberEmailAddresses);newContentPrimaryFlag.setAttribute("enabled","true");newContentReplyToFlag.setAttribute("type","radio");newContentReplyToFlag.setAttribute("name",this.id+"emailAddressReplyToFlag");newContentReplyToFlag.setAttribute("id",this.id+"emailAddressReplyToFlag"+this.numberEmailAddresses);newContentReplyToFlag.setAttribute("value",this.id+"emailAddress"+this.numberEmailAddresses);newContentReplyToFlag.setAttribute("enabled","true");newContentReplyToFlag.eaw=this;newContentReplyToFlag['onclick']=function(){var form=document.forms[this.eaw.emailView];if(!form){form=document.forms['editContactForm'];} var nav=new String(navigator.appVersion);if(nav.match(/MSIE/gim)){for(i=0;i='A'&&b<='Z')||(b>='a'&&b<='z')?Rot13.map[b]:b);} return s;},init:function(){if(Rot13.map!=null) return;var map=new Array();var s="abcdefghijklmnopqrstuvwxyz";for(i=0;i0){fragment1=word.substr(0,word.indexOf('&'));fragment2=word.substr(word.indexOf('&')+1,word.length);newWord=fragment1+'::amp::'+fragment2;words[i]=newWord;word=newWord;fragment1='';fragment2='';} if(word.indexOf('+')>0){fragment1=word.substr(0,word.indexOf('+'));fragment2=word.substr(word.indexOf('+')+1,word.length);newWord=fragment1+'::plus::'+fragment2;words[i]=newWord;word=newWord;fragment1='';fragment2='';} if(word.indexOf('%')>0){fragment1=word.substr(0,word.indexOf('%'));fragment2=word.substr(word.indexOf('%')+1,word.length);newWord=fragment1+'::percent::'+fragment2;words[i]=newWord;word=newWord;fragment1='';fragment2='';}} return words;} function ie_test_open_popup_with_submit(module_name,action,pageTarget,width,height,mail_server,protocol,port,login,password,mailbox,ssl,personal,formName) {if(!formName)formName="testSettingsView";var words=getEncryptedPassword(login,password,mailbox);var isPersonal=(personal)?'true':'false';if(!isDataValid(formName,true)){return;} URL='index.php?' +'module='+module_name +'&to_pdf=1' +'&action='+action +'&target='+pageTarget +'&target1='+pageTarget +'&server_url='+mail_server +'&email_user='+words[0] +'&protocol='+protocol +'&port='+port +'&email_password='+words[1] +'&mailbox='+words[2] +'&ssl='+ssl +'&personal='+isPersonal;var SI=SUGAR.inboundEmail;if(!SI.testDlg){SI.testDlg=new YAHOO.widget.SimpleDialog("testSettingsDiv",{width:width+"px",draggable:true,dragOnly:true,close:true,constraintoviewport:true,modal:true,loadingText:SUGAR.language.get("app_strings","LBL_EMAIL_LOADING")});SI.testDlg._updateContent=function(o){var w=this.cfg.config.width.value+"px";this.setBody(o.responseText);if(this.evalJS) SUGAR.util.evalScript(o.responseText);if(!SUGAR.isIE) this.body.style.width=w}} var title=SUGAR.language.get('Emails','LBL_TEST_SETTINGS');if(typeof(title)=="undefined"||title=="undefined") title=SUGAR.language.get('InboundEmail','LBL_TEST_SETTINGS');SI.testDlg.setHeader(title);SI.testDlg.setBody(SUGAR.language.get("app_strings","LBL_EMAIL_LOADING"));SI.testDlg.render(document.body);var Connect=YAHOO.util.Connect;if(Connect.url)URL=Connect.url+"&"+url;Connect.asyncRequest("GET",URL,{success:SI.testDlg._updateContent,failure:SI.testDlg.hide,scope:SI.testDlg});SI.testDlg.show();} function isDataValid(formName,validateMonitoredFolder){var formObject=document.getElementById(formName);var errors=new Array();var out=new String();if(trim(formObject.server_url.value)==""){errors.push(SUGAR.language.get('app_strings','LBL_EMAIL_ERROR_SERVER'));} if(trim(formObject.email_user.value)==""){errors.push(SUGAR.language.get('app_strings','LBL_EMAIL_ERROR_USER'));} if(trim(formObject.email_password.value)==""){errors.push(SUGAR.language.get('app_strings','LBL_EMAIL_ERROR_PASSWORD'));} if(formObject.protocol.protocol==""){errors.push(SUGAR.language.get('app_strings','LBL_EMAIL_ERROR_PROTOCOL'));} if(formObject.protocol.value=='imap'&&validateMonitoredFolder){if(trim(formObject.mailbox.value)==""){errors.push(SUGAR.language.get('app_strings','LBL_EMAIL_ERROR_MONITORED_FOLDER'));}} if(formObject.port.value==""){errors.push(SUGAR.language.get('app_strings','LBL_EMAIL_ERROR_PORT'));} if(errors.length>0){out=SUGAR.language.get('app_strings','LBL_EMAIL_ERROR_DESC');for(i=0;i'; } }; this.showBoolean = function(el, oRecord, oColumn, oData) { var is_group = oRecord.getData("is_group"); var bChecked = oData; bChecked = (bChecked) ? " checked" : ""; if(!is_group) { el.innerHTML = ""; } }; YAHOO.widget.DataTable.Formatter.customImage = this.customImageFormatter; YAHOO.widget.DataTable.Formatter.showBoolean = this.showBoolean; var typeHoverHelp = ' '; this.ieColumnDefs = [{key:'name',label:app_strings.LBL_EMAIL_SETTINGS_NAME }, {key:'server_url',label:ie_mod_strings.LBL_SERVER_URL}, {key:'is_active',label:ie_mod_strings.LBL_STATUS_ACTIVE,formatter:"checkbox",className:'yui-cstm-cntrd-liner'}, {key:'is_default',label:app_strings.LBL_EMAIL_ACCOUNTS_SMTPDEFAULT,formatter:"showBoolean",className:'yui-cstm-cntrd-liner'}, {key:'type',label:mod_strings.LBL_LIST_TYPE + typeHoverHelp }, {key:'edit',label:mod_strings.LBL_BUTTON_EDIT,formatter:"customImage",className:'yui-cstm-cntrd-liner'}, {key:'delete',label:app_strings.LBL_EMAIL_DELETE,formatter:"customImage",className:'yui-cstm-cntrd-liner'}]; var query = "index.php?module=Emails&action=EmailUIAjax&to_pdf=true&emailUIAction=rebuildShowAccount"; this.ieDataSource = new YAHOO.util.DataSource(query); this.ieDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; this.ieDataSource.responseSchema = { resultsList: "account_list", fields: [{key:'id'},{key:'name'},'is_active',{key:'server_url'},'is_group','group_id','is_default','has_groupfolder','type'] }; this.inboundAccountsSettingsTable = new YAHOO.widget.DataTable("inboundAccountsTable", this.ieColumnDefs, this.ieDataSource); this.inboundAccountsSettingsTable.subscribe("checkboxClickEvent", function(oArgs){ var elCheckbox = oArgs.target; var oColumn = this.getColumn(elCheckbox); if(oColumn.key == 'is_active') { var oRecord = this.getRecord(elCheckbox); oRecord.setData("is_active",elCheckbox.checked); var t_id = oRecord.getData('id'); var isGroupFolder = oRecord.getData('has_groupfolder'); if(isGroupFolder) SUGAR.email2.folders.updateSubscriptions(); else SUGAR.email2.folders.setFolderSelection(); } }); var lastDefaultSelectedId = ""; this.inboundAccountsSettingsTable.subscribe("radioClickEvent", function(oArgs){ var elRadio = oArgs.target; var oColumn = this.getColumn(elRadio); if(oColumn.key == 'is_default') { var oRecord = this.getRecord(elRadio); var t_id = oRecord.getData('id'); var t_isGroup = oRecord.getData('is_group'); if(t_id != lastDefaultSelectedId && !t_isGroup) { SUGAR.default_inbound_accnt_id = t_id; //Set in the global space for access during compose lastDefaultSelectedId = t_id; AjaxObject.startRequest(callbackDefaultOutboundSave, urlStandard + "&emailUIAction=saveDefaultOutbound&id="+ t_id); } else if(t_isGroup) YAHOO.util.Event.preventDefault(oArgs.event); //Do not allow users to select group mailboxes as a default. } }); this.inboundAccountsSettingsTable.subscribe("rowMouseoverEvent", this.inboundAccountsSettingsTable.onEventHighlightRow); this.inboundAccountsSettingsTable.subscribe("rowMouseoutEvent", this.inboundAccountsSettingsTable.onEventUnhighlightRow); } }, _setupOutboundAccountTable: function() { if(!this.outboundAccountsSettingsTable) { this.obImageFormatter = function(elLiner, oRecord, oColumn, oData) { var clckEvent = oColumn.key; var imgSrc = ""; var isEditable = oRecord.getData("is_editable"); var type = oRecord.getData("type"); if(isEditable) { if(oColumn.key == 'edit') { clckEvent = "SUGAR.email2.accounts.editOutbound('"+ oRecord.getData('id') +"')"; imgSrc = 'index.php?entryPoint=getImage&themeName=Sugar&imageName='+oColumn.key+'_inline.gif'; } else if(oColumn.key == 'delete' && type == 'user') { clckEvent = "SUGAR.email2.accounts.deleteOutbound('"+ oRecord.getData('id')+"')"; imgSrc = 'index.php?entryPoint=getImage&themeName=Sugar&imageName='+oColumn.key+'_inline.gif'; } if(imgSrc != '') elLiner.innerHTML = ''; } }; //Custom formatter to display any error messages. this.messageDisplay = function(elLiner, oRecord, oColumn, oData) { if(SUGAR.email2.composeLayout.outboundAccountErrors == null) SUGAR.email2.composeLayout.outboundAccountErrors = {}; var id = oRecord.getData('id'); var message = oRecord.getData("errors"); if(message != '') { elLiner.innerHTML = '' + message + ''; //Add the id and message for all outbound accounts. SUGAR.email2.composeLayout.outboundAccountErrors[id] = message; } else { if(typeof(SUGAR.email2.composeLayout.outboundAccountErrors[id]) != 'undefined' ) delete SUGAR.email2.composeLayout.outboundAccountErrors[id]; } }; YAHOO.widget.DataTable.Formatter.actionsImage = this.obImageFormatter; YAHOO.widget.DataTable.Formatter.messageDisplay = this.messageDisplay; this.obAccntsColumnDefs = [{key:'name',label:app_strings.LBL_EMAIL_ACCOUNTS_NAME }, {key:'mail_smtpserver',label:app_strings.LBL_EMAIL_ACCOUNTS_SMTPSERVER}, {key:'edit',label:mod_strings.LBL_BUTTON_EDIT,formatter:"actionsImage",className:'yui-cstm-cntrd-liner'}, {key:'delete', label:app_strings.LBL_EMAIL_DELETE,formatter:"actionsImage",className:'yui-cstm-cntrd-liner'}, {key:'messages',label:'', formatter:"messageDisplay",className:'yui-cstm-cntrd-liner'}]; var query = "index.php?module=Emails&action=EmailUIAjax&to_pdf=true&emailUIAction=retrieveAllOutbound"; this.obDataSource = new YAHOO.util.DataSource(query); this.obDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; this.obDataSource.responseSchema = { resultsList: "outbound_account_list", fields: ['id','name','is_editable','mail_smtpserver','type','errors'] }; this.outboundAccountsSettingsTable = new YAHOO.widget.DataTable("outboundAccountsTable", this.obAccntsColumnDefs, this.obDataSource); this.outboundAccountsSettingsTable.subscribe("rowMouseoverEvent", this.outboundAccountsSettingsTable.onEventHighlightRow); this.outboundAccountsSettingsTable.subscribe("rowMouseoutEvent", this.outboundAccountsSettingsTable.onEventUnhighlightRow); this.outboundAccountsSettingsTable.subscribe("postRenderEvent",this.rebuildMailerOptions); } }, /** * Displays a modal diaglogue to edit outbound account settings */ showEditInboundAccountDialogue : function(clear) { if(!this.inboundAccountEditDialog) { var EAD = this.inboundAccountEditDialog = new YAHOO.widget.Dialog("editAccountDialogue", { modal:true, visible:true, fixedcenter:true, constraintoviewport: true, width : "600px", shadow : true }); EAD.showEvent.subscribe(function() { var el = this.element; var viewH = YAHOO.util.Dom.getViewportHeight(); if (this.header && el && viewH - 50 < el.clientHeight) { var body = this.header.nextElementSibling; body.style.overflow = "auto"; body.style.height = (viewH - 50) + "px"; } }, EAD); EAD.setHeader(mod_strings.LBL_EMAIL_ACCOUNTS_INBOUND); Dom.removeClass("editAccountDialogue", "yui-hidden"); } // end lazy load if(clear == undefined || clear == true) { SE.accounts.clearInboundAccountEditScreen(); //Set default protocol to IMAP when creating new records document.forms['ieAccount'].elements['protocol'].value = "imap"; SE.accounts.setPortDefault(); } //Check if we should display username/password fields for outbound account if errors were detected. this.checkOutBoundSelection(); this.inboundAccountEditDialog.render(); this.inboundAccountEditDialog.show(); }, /** * Set all fields on the outbound edit form to either enabled/disabled * except for the username/password. * */ toggleOutboundAccountDisabledFields: function(disable) { var fields = ['mail_name', 'mail_smtpserver','mail_smtpport','mail_smtpauth_req']; for(var i=0;iAccounts */ fillIeAccount:function(jsonstr) { var o = JSON.parse(jsonstr); document.getElementById('ie_id').value = o.id; document.getElementById('ie_name').value = o.name; if (o.stored_options != null) { document.getElementById('ie_from_name').value = o.stored_options.from_name == 'undefined' ? '' : o.stored_options.from_name; document.getElementById('ie_from_addr').value = o.stored_options.from_addr == 'undefined' ? '' : o.stored_options.from_addr; document.getElementById('reply_to_addr').value = typeof(o.stored_options.reply_to_addr) == 'undefined' ? '' : o.stored_options.reply_to_addr; if (o.stored_options.trashFolder != null) { document.getElementById('trashFolder').value = o.stored_options.trashFolder; } if (o.stored_options.sentFolder != null) { document.getElementById('sentFolder').value = o.stored_options.sentFolder; } } document.getElementById('server_url').value = o.server_url; document.getElementById('email_user').value = o.email_user; document.getElementById('email_password').value = o.email_password; document.getElementById('port').value = o.port; document.getElementById('group_id').value = o.group_id; document.getElementById('mailbox').value = o.mailbox; var i = 0; // handle SSL if(typeof(o.service[2]) != 'undefined') { document.getElementById('ssl').checked = true; } // handle protocol if(document.getElementById('protocol').value != o.protocol) { var prot = document.getElementById('protocol'); for(i=0; i"; } if(trim(smtpServer) == '') { isError = true; errorMessage += app_strings.LBL_EMAIL_ACCOUNTS_SMTPSERVER + "
"; } if(trim(smtpPort) == '') { isError = true; errorMessage += app_strings.LBL_EMAIL_ACCOUNTS_SMTPPORT + "
"; } if(mailsmtpauthreq.checked) { if(trim(document.getElementById('mail_smtpuser').value) == '') { isError = true; errorMessage += app_strings.LBL_EMAIL_ACCOUNTS_SMTPUSER + "
"; } if(trim(document.getElementById('mail_smtppass').value) == '') { isError = true; errorMessage += app_strings.LBL_EMAIL_ACCOUNTS_SMTPPASS + "
"; } } } if(isError) { overlay(mod_strings.ERR_MISSING_REQUIRED_FIELDS, errorMessage, 'alert'); return false; } else { return true; } }, testOutboundSettings: function() { var errorMessage = ''; var isError = false; var fromAddress = document.getElementById("outboundtest_from_address").value; if (trim(fromAddress) == "") { errorMessage += app_strings.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR + "
"; overlay(mod_strings.ERR_MISSING_REQUIRED_FIELDS, errorMessage, 'alert'); return false; } else if (!isValidEmail(fromAddress)) { errorMessage += app_strings.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR + "
"; overlay(mod_strings.ERR_INVALID_REQUIRED_FIELDS, errorMessage, 'alert'); return false; } //Hide the dialogue and show an in progress indicator. SE.accounts.testOutboundDialog.hide(); overlay(app_strings.LBL_EMAIL_PERFORMING_TASK, app_strings.LBL_EMAIL_ONE_MOMENT, 'plain'); //If the outbound mail type is a system override we need to re-enable the post fields otherwise //nothing is sent in the request. var outboundType = document.forms['outboundEmailForm'].elements['type'].value; SUGAR.email2.accounts.toggleOutboundAccountDisabledFields(false); YAHOO.util.Connect.setForm(document.getElementById("outboundEmailForm")); if(outboundType == 'system-override') SUGAR.email2.accounts.toggleOutboundAccountDisabledFields(true); var data = "&emailUIAction=testOutbound&outboundtest_from_address=" + fromAddress; AjaxObject.startRequest(callbackOutboundTest, urlStandard + data); }, testOutboundSettingsDialog: function() { //Ensure that all settings are correct before proceeding to send test email. if(!SE.accounts.checkOutboundSettings()) return; // lazy load dialogue if(!SE.accounts.testOutboundDialog) { SE.accounts.testOutboundDialog = new YAHOO.widget.Dialog("testOutboundDialog", { modal:true, visible:true, fixedcenter:true, constraintoviewport: true, width : 600, shadow : true }); SE.accounts.testOutboundDialog.setHeader(app_strings.LBL_EMAIL_TEST_OUTBOUND_SETTINGS); Dom.removeClass("testOutboundDialog", "yui-hidden"); } // end lazy load SE.accounts.testOutboundDialog.render(); SE.accounts.testOutboundDialog.show(); }, /** * Saves Outbound email settings */ saveOutboundSettings : function() { if(SE.accounts.checkOutboundSettings()) { //Enable the form fields for the post. SUGAR.email2.accounts.toggleOutboundAccountDisabledFields(false); YAHOO.util.Connect.setForm(document.getElementById("outboundEmailForm")); AjaxObject.startRequest(callbackOutboundSave, urlStandard + "&emailUIAction=saveOutbound"); } else { return false; } }, saveIeAccount : function() { //Before saving check if there are any error messages associated with the outbound account. var outboundID = document.getElementById('outbound_email').value; if( SE.accounts.checkIeCreds({'valiateTrash': true,'validateFromAddr': true,'validateOutbound' :true, 'validateSMTPCreds':true}) ) { document.getElementById('saveButton').disabled = true; overlay(app_strings.LBL_EMAIL_IE_SAVE, app_strings.LBL_EMAIL_ONE_MOMENT); var formObject = document.getElementById('ieAccount'); YAHOO.util.Connect.setForm(formObject); AjaxObject._reset(); AjaxObject.target = 'frameFlex'; AjaxObject.startRequest(callbackAccount, urlStandard + '&emailUIAction=saveIeAccount'); } }, testSettings : function() { form = document.getElementById('ieAccount'); if(SE.accounts.checkIeCreds()) { ie_test_open_popup_with_submit("InboundEmail", "Popup", "Popup", 400, 300, trim(form.server_url.value), form.protocol.value, trim(form.port.value), trim(form.email_user.value), Rot13.write(form.email_password.value), trim(form.mailbox.value), form.ssl.checked, true, "ieAccount"); } }, getFoldersListForInboundAccountForEmail2 : function() { form = document.getElementById('ieAccount'); if(SE.accounts.checkIeCreds()) { var mailBoxValue = form.mailbox.value; if (form.searchField.value.length > 0) { mailBoxValue = ""; } // if getFoldersListForInboundAccount("InboundEmail", "ShowInboundFoldersList", "Popup", 400, 300, form.server_url.value, form.protocol.value, form.port.value, form.email_user.value, Rot13.write(form.email_password.value), mailBoxValue, form.ssl.checked, true, form.searchField.value ); } // if }, checkIeCreds : function(validateRules) { if(typeof(validateRules) == 'undefined') validateRules = {}; var errors = new Array(); var out = new String(); var ie_name = Dom.get('ie_name').value; var fromAddress = Dom.get('ie_from_addr').value; var server_url = Dom.get('server_url').value; var email_user = Dom.get('email_user').value; var email_password = Dom.get('email_password').value; var protocol = Dom.get('protocol').value; var port = Dom.get('port').value; var oe = Dom.get('outbound_email'); var oe_value = typeof(oe.options[oe.selectedIndex]) == 'undefined' ? "" : oe.options[oe.selectedIndex].value; var outboundUserName = Dom.get('inbound_mail_smtpuser').value; var outboundPass = Dom.get('inbound_mail_smtppass').value; //If the username and password were provided then ignore the error messge var outboundCredentialsFound = false; if(outboundUserName != "" && outboundPass != "") outboundCredentialsFound = true; var validateSMTPCreds = (typeof(validateRules.validateSMTPCreds) != 'undefined' && validateRules.validateSMTPCreds); if ( SE.composeLayout.outboundAccountErrors != null && SE.composeLayout.outboundAccountErrors[oe_value] != null && validateSMTPCreds) { if(trim(outboundUserName) == "") { errors.push(app_strings.LBL_EMAIL_ACCOUNTS_SMTPUSER); } if(trim(outboundPass) == "") { errors.push(app_strings.LBL_EMAIL_ACCOUNTS_SMTPPASS); } } if(trim(ie_name) == "") { errors.push(app_strings.LBL_EMAIL_ERROR_NAME); } if ( typeof(validateRules.validateFromAddr) != 'undefined' && validateRules.validateFromAddr) { if(trim(fromAddress) == "" || !isValidEmail(fromAddress) ) { errors.push(app_strings.LBL_EMAIL_ERROR_FROM_ADDRESS); } } if( (typeof(validateRules.validateOutbound) != 'undefined' && validateRules.validateOutbound) && ( trim(oe_value) == "" || trim(oe_value) == "SYSTEM_ADD") ) { errors.push(app_strings.LBL_EMAIL_ERROR_NO_OUTBOUND); } if(trim(server_url) == "") { errors.push(app_strings.LBL_EMAIL_ERROR_SERVER); } if(trim(email_user) == "") { errors.push(app_strings.LBL_EMAIL_ERROR_USER); } if(trim(email_password) == "") { errors.push(app_strings.LBL_EMAIL_ERROR_PASSWORD); } if(protocol == "") { errors.push(app_strings.LBL_EMAIL_ERROR_PROTOCOL); } if (protocol == 'imap') { var mailbox = document.getElementById('mailbox').value; if (trim(mailbox) == "") { errors.push(app_strings.LBL_EMAIL_ERROR_MONITORED_FOLDER); } // if if (typeof(validateRules.valiateTrash) != 'undefined' && validateRules.valiateTrash) { var trashFolder = document.getElementById('trashFolder').value; if (trim(trashFolder) == "") { errors.push(app_strings.LBL_EMAIL_ERROR_TRASH_FOLDER); } // if } // if } if(port == "") { errors.push(app_strings.LBL_EMAIL_ERROR_PORT); } if(errors.length > 0) { out = app_strings.LBL_EMAIL_ERROR_DESC; for(i=0; i 0) { node.setUpLabel('' + node.data.origText + '(' + node.data.unseen + ')'); } else { node.setUpLabel(node.data.origText); } } else { node.setUpLabel('' + node.data.origText + ''); } SE.accounts.setupDDTarget(node); }, setupDDTarget : function(node) { if (node.ddTarget) { node.ddTarget.removeFromGroup(); delete node.ddTarget; } var id = node.getElId(); var num = id.substring(4); if (node.data.origText != SUGAR.language.get("Emails", "LNK_MY_INBOX") && node.data.origText != SUGAR.language.get("Emails", "LNK_MY_DRAFTS") && node.data.origText != SUGAR.language.get("Emails", "LNK_SENT_EMAIL_LIST")) { node.ddTarget = new SUGAR.email2.folders.folderDD("ygtvcontentel" + num); } else if (node.data.origText == SUGAR.language.get("Emails", "LNK_MY_INBOX")){ node.ddTarget = new YAHOO.util.DDTarget("ygtvcontentel" + num); } }, /** * Async call to rebuild the folder list. After a folder delete or account delete */ rebuildFolderList : function() { overlay(app_strings.LBL_EMAIL_REBUILDING_FOLDERS, app_strings.LBL_EMAIL_ONE_MOMENT); AjaxObject.startRequest(callbackFolders, urlStandard + '&emailUIAction=rebuildFolders'); }, /** * Returns the number of remote accounts the user has active. */ getAccountCount : function() { var tree = SE.tree; var count = 0; for(i=0; i 25) { tabLabel = tabLabel.substring(0, 25) + "..."; } // if targetDiv.set("label", tabLabel); targetDiv.set("content", out); var displayEmailFrameDiv = document.getElementById('displayEmailFrameDiv' + targetDiv.id); if (SUGAR.email2.util.isIe()) { displayEmailFrameDiv.style.height = "390px"; } else { displayEmailFrameDiv.style.height = "410px"; } var displayFrame = document.getElementById('displayEmailFrame' + targetDiv.id); displayFrame.contentWindow.document.write(email.description); displayFrame.contentWindow.document.close(); // hide archive links if(ret.meta.is_sugarEmail) { document.getElementById("archiveEmail" + targetDiv.id).style.display = "none"; document.getElementById("btnEmailView" + targetDiv.id).style.display = "none"; } else { if (document.getElementById("showDeialViewForEmail" + targetDiv.id)) document.getElementById("showDeialViewForEmail" + targetDiv.id).style.display = "none"; } // else }, consumeMetaPreview : function(ret) { // cache contents browser-side SE._setDetailCache(ret); var currrow = SE.grid.getLastSelectedRecord(); currrow = SE.grid.getRecord(currrow); if (!currrow) { document.getElementById('_blank').innerHTML = ''; return; } // handling if the Email drafts if(ret.type == 'draft'){ if (currrow.getData().uid == ret.uid) { SE.composeLayout.c0_composeDraft(); } return; } if (currrow.getData().uid != ret.meta.uid) { return; } // remove loading sprite document.getElementById('_blank').innerHTML = '' + //' {email.description}' + '' ;// End of File modules/Emails/javascript/displayOneEmailTemplate.js /********************************************************************************* * SugarCRM is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 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'] = '' + '' + '' + '
' + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '
' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' {email.cc}' + ' {email.attachments}' + '
' + ' {app_strings.LBL_EMAIL_FROM}:' + ' ' + ' {email.from_name} <{email.from_addr}>' + '
' + ' {app_strings.LBL_EMAIL_SUBJECT}:' + ' ' + ' {email.name}' + '
' + ' {app_strings.LBL_EMAIL_DATE_SENT_BY_SENDER}:' + ' ' + ' {email.date_start} {email.time_start}' + '
' + ' {app_strings.LBL_EMAIL_TO}:' + ' ' + ' {email.toaddrs}' + '
' + '
' + ' ' + ' ' + ' ' + ' ' + '
' + '
' + '{email.description}' + '
' + '
' + '
' + '
' + ''; // End of File modules/Emails/javascript/viewPrintable.js /********************************************************************************* * SugarCRM is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2011 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 enableQS(noReload){YAHOO.util.Event.onDOMReady(function(){if(typeof sqs_objects=='undefined'){return;} var Dom=YAHOO.util.Dom;var qsFields=Dom.getElementsByClassName('sqsEnabled');for(qsField in qsFields){if(typeof qsFields[qsField]=='function'||typeof qsFields[qsField].id=='undefined'){continue;} form_id=qsFields[qsField].form.getAttribute('id');if(typeof form_id=='object'&&qsFields[qsField].form.getAttribute('real_id')){form_id=qsFields[qsField].form.getAttribute('real_id');} qs_index_id=form_id+'_'+qsFields[qsField].name;if(typeof sqs_objects[qs_index_id]=='undefined'){qs_index_id=qsFields[qsField].name;if(typeof sqs_objects[qs_index_id]=='undefined'){continue;}} if(QSProcessedFieldsArray[qs_index_id]){continue;} var qs_obj=sqs_objects[qs_index_id];var loaded=false;if(!document.forms[qs_obj.form]){continue;} if(!document.forms[qs_obj.form].elements[qsFields[qsField].id].readOnly&&qs_obj['disable']!=true){combo_id=qs_obj.form+'_'+qsFields[qsField].id;if(Dom.get(combo_id+"_results")){loaded=true} if(!loaded){QSProcessedFieldsArray[qs_index_id]=true;qsFields[qsField].form_id=form_id;var sqs=sqs_objects[qs_index_id];var resultDiv=document.createElement('div');resultDiv.id=combo_id+"_results";Dom.insertAfter(resultDiv,qsFields[qsField]);var fields=qs_obj.field_list.slice();fields[fields.length]="module";var ds=new YAHOO.util.DataSource("index.php?",{responseType:YAHOO.util.XHRDataSource.TYPE_JSON,responseSchema:{resultsList:'fields',total:'totalCount',fields:fields,metaNode:"fields",metaFields:{total:'totalCount',fields:"fields"}},connMethodPost:true});var forceSelect=!((qsFields[qsField].form&&typeof(qsFields[qsField].form)=='object'&&qsFields[qsField].form.name=='search_form')||qsFields[qsField].className.match('sqsNoAutofill')!=null);var search=new YAHOO.widget.AutoComplete(qsFields[qsField],resultDiv,ds,{typeAhead:forceSelect,forceSelection:forceSelect,fields:fields,sqs:sqs,animSpeed:0.25,qs_obj:qs_obj,generateRequest:function(sQuery){var out=SUGAR.util.paramsToUrl({to_pdf:'true',module:'Home',action:'quicksearchQuery',data:encodeURIComponent(YAHOO.lang.JSON.stringify(this.sqs)),query:sQuery});return out;},setFields:function(data,filter){for(var i in this.fields){for(var key in this.qs_obj.field_list){if(this.fields[i]==this.qs_obj.field_list[key]&&document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]&&this.qs_obj.populate_list[key].match(filter)){document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value=data[i];}}}},clearFields:function(){for(var key in this.qs_obj.field_list){if(document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]){document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value="";}} this.oldValue="";}});if(typeof(SUGAR.config.quicksearch_querydelay)!='undefined'){search.queryDelay=SUGAR.config.quicksearch_querydelay;} search.itemSelectEvent.subscribe(function(e,args){var data=args[2];var fields=this.fields;this.setFields(data,/\S/);if(typeof(this.qs_obj['post_onblur_function'])!='undefined'){collection_extended=new Array();for(var i in fields){for(var key in this.qs_obj.field_list){if(fields[i]==this.qs_obj.field_list[key]){collection_extended[this.qs_obj.field_list[key]]=data[i];}}} eval(this.qs_obj['post_onblur_function']+'(collection_extended, this.qs_obj.id)');}});search.textboxFocusEvent.subscribe(function(){this.oldValue=this.getInputEl().value;});search.selectionEnforceEvent.subscribe(function(e,args){if(this.oldValue!=args[1]){this.clearFields();}else{this.getInputEl().value=this.oldValue;}});search.dataReturnEvent.subscribe(function(e,args){if(this.getInputEl().value.length==0&&args[2].length>0){var data=[];for(var key in this.qs_obj.field_list){data[data.length]=args[2][0][this.qs_obj.field_list[key]];} this.getInputEl().value=data[this.key];this.itemSelectEvent.fire(this,"",data);}});if(typeof QSFieldsArray[combo_id]=='undefined'&&qsFields[qsField].id){QSFieldsArray[combo_id]=search;}}}}});} function registerSingleSmartInputListener(input){if((c=input.className)&&(c.indexOf("sqsEnabled")!=-1)){enableQS(true);}} if(typeof QSFieldsArray=='undefined'){QSFieldsArray=new Array();QSProcessedFieldsArray=new Array();}// End of File include/javascript/quicksearch.js