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

📄 studio.js

📁 SugarCRM5.1 开源PHP客户关系管理系统
💻 JS
📖 第 1 页 / 共 2 页
字号:
/** * SugarCRM is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004 - 2007 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". */var yahooSlots = new Array();function addNewRowToView(id){    var curRow = document.getElementById(id);    var parent = curRow.parentNode;    var newRow = document.createElement('tr');    var newRow = parent.insertRow(parent.rows.length);    var re = /studiorow[0-9]+/g;    var cell = newRow.insertCell(0);    cell.innerHTML = curRow.cells[0].innerHTML.replace(re, 'studiorow' + slotCount);    cell.className = curRow.cells[0].className;    for(var j = 1; j < curRow.cells.length ; j++){        var cell = newRow.insertCell(j);        cell.innerHTML = '&nbsp;';        cell.className = curRow.cells[j].className;    }    var index = parent.rows.length;    for(var i = 0; i < parent.rows.length ; i++){        if(parent.rows[i].id == id){            index = i + 1;        }    }    newRow.id = 'studiorow' + slotCount;    if(typeof(curRow.parentId) == 'undefined'){        newRow.parentId = id;    }else{        newRow.parentId = curRow.parentId;    }    if(index < parent.rows.length){        parent.insertBefore(newRow, parent.rows[index]);    }else{        parent.appendChild(newRow);    }    document.getElementById('add_' + newRow.parentId).value = 1 + parseInt(document.getElementById('add_' + newRow.parentId).value);    slotCount++;}function deleteRowFromView(id, index){    var curRow = document.getElementById(id);    curRow.parentNode.removeChild(curRow);    if(typeof(curRow.parentId) == 'undefined'){        document.getElementById('form_' + id).value=-1;    }else{        document.getElementById('add_' + curRow.parentId).value =  parseInt(document.getElementById('add_' + curRow.parentId).value) - 1;    }}function addNewColToView(id, index){        var curCol = document.getElementById(id);    var index = curCol.cellIndex;    var parent = curCol.parentNode;    var cell = parent.insertCell(index + 1);    if(parent.parentNode.rows[parent.rowIndex + 1])parent.parentNode.rows[parent.rowIndex + 1].insertCell(index + 1)    var re = /studiocol[0-9]+/g;    cell.innerHTML = '[NEW]';    cell.className = curCol.className;    if(typeof(curCol.parentId) == 'undefined'){        cell.parentId = id;    }else{        cell.parentId = curCol.parentId;    }      document.getElementById('add_' + cell.parentId).value = 1 + parseInt(document.getElementById('add_' + cell.parentId).value);    slotCount++;}function deleteColFromView(id, index){    var curCol = document.getElementById(id);    var row = curCol.parentNode;     var index = curCol.cellIndex;    if(typeof(row.cells[index + 1].parentId) == 'undefined'){       row.deleteCell(index);       row.deleteCell(index - 1);       if(row.parentNode.rows[row.rowIndex + 1]){       	row.parentNode.rows[row.rowIndex + 1].deleteCell(index );      	 row.parentNode.rows[row.rowIndex + 1].deleteCell(index - 1);       }                }else{       row.deleteCell(index + 1);        if(row.parentNode.rows[row.rowIndex + 1])row.parentNode.rows[row.rowIndex + 1].deleteCell(index +1);            }     document.getElementById('add_' + curCol.id).value =  parseInt(document.getElementById('add_' + curCol.id).value) - 1;    }var field_count_MSI = 0;var studioLoaded = false;var dyn_field_count = 0;function addNewFieldType(type){    var select = document.getElementById('studio_display_type').options;    for(var i = 0; i < select.length; i++){        if(select[i].value == type){            return;        }    }    select[i] = new Option(type, type);}function filterStudioFields(type){    var table = document.getElementById('studio_fields');    for(var i = 0; i < table.rows.length; i++){        children = table.rows[i].cells[0].childNodes;        for(var j = 0; j < children.length; j++){            child = children[j];            if(child.nodeName == 'DIV' && typeof(child.fieldType) != 'undefined'){                if(type == 'all'){                    table.rows[i].style.display = '';                }else if(type == 'custom'){                    if(child.isCustom){                        table.rows[i].style.display = ''                    }else{                        table.rows[i].style.display = 'none';                    }                }else{                    if(child.fieldType == type){                        table.rows[i].style.display = ''                    }else{                        table.rows[i].style.display = 'none';                    }                }            }        }    }}function addNewField(id, name, label, html, fieldType,isCustom, table_id, top){        html = replaceAll(html, "&qt;", '"');    html = replaceAll(html, "&sqt;", "'");    var table = document.getElementById(table_id);    var row = false;    if(top){         row = table.insertRow(1);    }else{         row = table.insertRow(table.rows.length);    }       var cell = row.insertCell(0);    var div = document.createElement('div');    div.className = 'slot';    div.setAttribute('id', id);    div.fieldType = fieldType;    addNewFieldType(fieldType);    div.isCustom = isCustom;    div.style.width='100%';    var textEl = document.createElement('input');    textEl.setAttribute('type', 'hidden')    textEl.setAttribute('name',  'slot_field_' + field_count_MSI );    textEl.setAttribute('id', 'slot_field_' + field_count_MSI  );    textEl.setAttribute('value', 'add:' + name );    field_list_MSI['form_' + name] = textEl;    document.studio.appendChild(textEl);    div.innerHTML = label;    var cell2 = row.insertCell(1);    var div2 = document.createElement('div');    setMouseOverForField(div, true);    div2.style.display = 'none';    div2.setAttribute('id',  id + 'b' );    html = html.replace(/(<input)([^>]*)/g, '$1 disabled readonly $2');    html = html.replace(/(<select)([^>]*)/g, '$1 disabled readonly $2');    html = html.replace(/(onclick=')([^']*)/g, '$1'); // to strip {} from after a JS onclick call    div2.innerHTML += html;    cell.appendChild(div);    cell2.appendChild(div2);    field_count_MSI++;    if(top){        yahooSlots[id] = new ygDDSlot(id, "studio");    }else{        dyn_field_count++;    }    return name;}function removeFieldFromTable(field, table){    var table = document.getElementById(table);    var rows = table.rows;    for(i = 0 ; i < rows.length; i++){        cells = rows[i].cells;        for(j = 0; j < cells.length; j++){            cell = rows[i].cells[j];            children = cell.childNodes;            for(k = 0; k < children.length; k++){                child = children[k];                if(child.nodeType == 1){                    if(child.getAttribute('id') == 'slot_' + field){                        table.deleteRow(i);                        return;                    }                }            }        }    }}function setMouseOverForField(field, on){    if(on){        field.onmouseover = function(){            return overlib(document.getElementById(this.id + 'b').innerHTML,  FGCLASS, 'olFgClass',            CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass');        };        field.onmouseout = function(){            return nd();        };    }else{        field.onmouseover = function(){};        field.onmouseout = function(){};    }}var lastIDClick = '';var lastIDClickTime = 0;var dblDelay = 500;function wasDoubleClick(id) {    var d = new Date();    var now = d.getTime();    if (lastIDClick == id && (now - lastIDClickTime) < dblDelay) {        lastIDClick = '';        return true;    }    lastIDClickTime = now;    lastIDClick = id;    return false;}

⌨️ 快捷键说明

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