⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 emailui.js

📁 SugarCRM5.1 开源PHP客户关系管理系统
💻 JS
📖 第 1 页 / 共 5 页
字号:
        if(errors.length > 0) {            out = app_strings.LBL_EMAIL_ERROR_DESC;            for(i=0; i<errors.length; i++) {                if(out != "") {                    out += "\n";                }                out += errors[i];            }            alert(out);            return false;        } else {            return true;        }    },    getIeAccount : function(ieId) {        if(ieId == '')            return;        overlay(app_strings.LBL_EMAIL_SETTINGS_RETRIEVING_ACCOUNT, app_strings.LBL_EMAIL_ONE_MOMENT);        var formObject = document.getElementById('ieSelect');        formObject.emailUIAction.value = 'getIeAccount';        YAHOO.util.Connect.setForm(formObject);        AjaxObject.startRequest(callbackIeAccountRetrieve, null);    },    /**     * Iterates through TreeView nodes to apply styles dependent nature of node     */    renderTree:function() {        var tree = SUGAR.email2.tree;        tree.root.cascade(SUGAR.email2.accounts.setNodeStyle);    },        //Sets the style for any nodes that need it.    setNodeStyle : function(node) {       //Set unread       if (typeof(node.attributes.unseen) != 'undefined') {           if (!node.attributes.origText) {                  node.attributes.origText = node.attributes.text;           }           if (node.attributes.unseen > 0) {               node.setText('<b>' + node.attributes.origText + '(' + node.attributes.unseen + ')<b>');           }           else {               node.setText(node.attributes.origText);           }       }    },    /**     * selects or creates the IE element in the multi-select     */    focusOrCreateIeEl : function(jsonstr) {        var o = JSON.parse(jsonstr);        var ms = document.getElementById('ieAccountList');        var found = false;        for(i=0; i<ms.options.length; i++) {            if(ms.options[i].value == o.id) {                found = true;                var newOpt = new Option(o.name, o.id);                document.ieSelect.ieId.options[i] = newOpt;                newOpt.selected = true;            } else {                ms.options[i].selected = false;            }        }        if(found == false) {            var newO = new Option(o.name, o.id);            document.ieSelect.ieId.options[i] = newO;        }        // rebuild        this.rebuildAccountList();    },    /**     * Rebuilds the drop-down selector for available email accounts     */    rebuildAccountList:function() {        var ms = document.getElementById('ieAccountList');        for(j=0; j<ms.options.length; j++) {            var newOpt = new Option(ms.options[j].text, ms.options[j].value);            if(ms.options[j].disabled == true)                newOpt.disabled = true;            document.ieSelect.ieId.options[j] = newOpt;        }        this.rebuildShowAccountList();    },    /**     * rebuilds the select options for mailer options     */    rebuildMailerOptions : function() {        var select = document.forms['ieAccount'].elements['outbound_email'];        SUGAR.email2.util.emptySelectOptions(select);        for(var key in SUGAR.mailers) {            var display = SUGAR.mailers[key].name;            var opt = new Option(display, key);            select.options.add(opt);        }    },    /**     * rebuilds the multiselect list of "active" or viewed I-E accounts in the Options->Accounts screen     */    rebuildShowAccountList:function() {        var formObject = document.getElementById('ieSelect');        YAHOO.util.Connect.setForm(formObject);        AjaxObject.startRequest(callbackRebuildShowAccountList, urlStandard + '&emailUIAction=rebuildShowAccount');    },    /**     * 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 = SUGAR.email2.tree;        var count = 0;        for(i=0; i<tree._nodes.length; i++) {            var node = tree._nodes[i];            if(typeof(node) != 'undefined' && node.data.ieId) {                count++;            }        }        return count;    }};////    END ACCOUNTS//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    ADDRESS BOOKSUGAR.email2.addressBook = {    _contactCache : new Array(), // cache of contacts    _dd : new Array(), // filtered list, same format as _contactCache    _ddLists : new Array(), // list of Lists    _dd_mlUsed : new Array(), // contacts in mailing list edit view column1    _dd_mlAvailable : new Array(), // contacts in mailing list edit view column2    clickBubble : true, // hack to get around onclick event bubbling    itemSpacing : 'white-space:nowrap; padding:2px;',    reGUID : SUGAR.email2.reGUID,    /**     * sets up the async call to add a Person to the address book     * @param String elId     */    addContact : function(elId) {        var form = document.getElementById(elId);        var get = "&bean_module=" + form.bean_module.value + "&bean_id=" + form.bean_id.value;        AjaxObject.startRequest(callbackGetUserContacts, urlStandard + "&emailUIAction=addContact" + get);    },    /**     * takes an array of data (usually from an async call) and builds the SugarContacts list     */    buildContactList : function(contactCache) {         //Initalize the view if we haven't yet        if (!SUGAR.email2.contactView) {             var contactTemplate = new Ext.Template(                "<div id='{id}' class='{cls}' nowrap style='cursor:pointer; white-space: nowrap;display:{disp}' unselectable='on'>" +                "{innerHTML}</div>"            );                        SUGAR.email2.contactView = new Ext.View('contacts', contactTemplate, {multiSelect: true});            SUGAR.email2.contactView.on('contextmenu', function (view, index, target, e) {                e.stopEvent();                if(!view.isSelected(target)){                    view.select(target, e.ctrlKey);                }                var isContact = (target.className.indexOf('-contact') > -1);                var selections = view.getSelectedNodes();                var matchClass = (selections[0].className.indexOf("address-contact") > -1) ? "address-contact" : "address-email";                for (var i=0; i < selections.length; i++) {                    if (selections[i].className.indexOf(matchClass) == -1 && selections[i].style.display != "none") {                        view.clearSelections(true);                        view.select(target);                        break;                    }                }                SUGAR.email2.contextMenus.contactsContextMenu.items.items[0][isContact ? 'show' : 'hide']();                SUGAR.email2.contextMenus.contactsContextMenu.show(target);            });        }            var target = document.getElementById("contacts");        target.innerHTML = "";        var contactsData = [];        for (var i in contactCache) {            var person = contactCache[i];            var innerHTML = "<img src='themes/default/images/" + person.module + ".gif' class='img' align='absmiddle'>"                          + "&nbsp;" + person.name;            //Create the collapsed node            contactsData.push([i, 'address-contact', "", innerHTML]);            //Create the expanded node            contactsData.push(['ex' + i, 'address-exp-contact', "none", "<i>" + innerHTML + "</i>"]);            for (var j in person.email) {                if (person.email[j].email_address) {                    var emailHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&lt;" + person.email[j].email_address + "&gt;";                    var emailPrimary = "";                    if (person.email[j].primary_address == "1") {emailPrimary = " address-primary";}                    contactsData.push([person.email[j].id, 'address-email' + emailPrimary, "none",  emailHTML]);                }            }        }                var ds = new Ext.data.Store({                proxy: new Ext.data.MemoryProxy(contactsData),                reader: new Ext.data.ArrayReader({}, [                    {name: 'id'},                    {name: 'cls'},                    {name: 'disp'},                    {name: 'innerHTML'}                ])            });        SUGAR.email2.contactView.setStore(ds);        ds.load()        this._dd = new ContactsDragZone(SUGAR.email2.contactView, {containerScroll: true, ddGroup: 'addressBookDD'});        SUGAR.email2.contactView.on('dblclick', this._dd.toggleContact);        this._dd.setContacts(contactCache);    },    cancelEdit : function() {        if(this.editContactDialog)            this.editContactDialog.hide();        if(this.editMailingListDialog)            this.editMailingListDialog.hide();    },    /**     * Clears filter form     */    clear : function() {        var t = document.getElementById('contactsFilter');        t.value = '';        this.filter(t);    },    /**     * handle context-menu Compose-to call     * @param string type 'contacts' or 'lists'     */    composeTo : function(type, waited) {        var activePanel = SUGAR.email2.innerLayout.getRegion('center').activePanel.getId();        if (activePanel.substring(0, 13) != "composeLayout") {            SUGAR.email2.composeLayout.c0_composeNewEmail();            setTimeout("SUGAR.email2.addressBook.composeTo('" + type + "', true);");	        SUGAR.email2.contextMenus.contactsContextMenu.hide();            return;        }        var idx = activePanel.substring(13);        var nodes = [ ];        var id = '';        // determine if we have a selection to work with        if(type == 'contacts') {            nodes = SUGAR.email2.contactView.getSelectedNodes();        } 		else { return; }                //Remove hidden nodes        removeHiddenNodes(nodes);        if(nodes.length > 0) {            //var idx = SUGAR.email2.composeLayout.currentInstanceId;            SUGAR.email2.composeLayout.handleDrop(                (type == 'contacts') ? SUGAR.email2.contactView.el : SUGAR.email2.emailListsView.el,                 null, nodes, 'addressTo' + idx );        } else {            alert(app_strings.LBL_EMAIL_MENU_MAKE_SELECTION);        }    },    /**     * builds one row in the listView     * @param int index     * @param Object AssocArray     */    displaySearchResultRow : function(idx, obj) {        var imgPath = "themes/default/images/" + obj.module + ".gif";        Ext.DomHelper.append("peopleTable", {            tag : 'tr',            id : 'resultRow' + idx        }, true);        tmp = Ext.DomHelper.append('resultRow' + idx, {            tag : 'td',            cls : ''        }, true);        var tdId = tmp.dom.id;        Ext.DomHelper.append(tdId, {            tag : 'img',            cls : 'img',            src : imgPath        });        Ext.DomHelper.append('resultRow' + idx, {            tag : 'td',            cls : '',            width : '1%',            nowrap : "NOWRAP",            html : obj.full_name        });        Ext.DomHelper.append('resultRow' + idx, {            tag : 'td',            cls : '',            width : '1%',            nowrap : "NOWRAP",            html : obj.email_address        });

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -