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

📄 studio.js

📁 SugarCRM5.1 开源PHP客户关系管理系统
💻 JS
📖 第 1 页 / 共 2 页
字号:
function confirmNoSave(){    return confirm(SUGAR.language.get('Studio', 'LBL_CONFIRM_UNSAVE'));}var labelEdit = false; SUGAR.Studio = function(){    this.labelEdit = false;    this.lastLabel = false;} SUGAR.Studio.prototype.endLabelEdit =  function(id){     if(id == 'undefined')return;    document.getElementById('span' + id).style.display = 'none';    jstransaction.record('studioLabelEdit', {'id':id, 'new': document.getElementById(id).value , 'old':document.getElementById('label' + id).innerHTML});    document.getElementById('label' + id).innerHTML = document.getElementById(id).value;    document.getElementById('label_' + id).value = document.getElementById(id).value;     document.getElementById('label' + id).style.display = '';    this.labelEdit = false;    YAHOO.util.DragDropMgr.unlock();}; SUGAR.Studio.prototype.undoLabelEdit =  function (transaction){    var id = transaction['id'];    document.getElementById('span' + id).style.display = 'none';    document.getElementById('label' + id).innerHTML = transaction['old'];    document.getElementById('label_' + id).value = transaction['old'];}; SUGAR.Studio.prototype.redoLabelEdit=  function  (transaction){    var id = transaction['id'];    document.getElementById('span' + id).style.display = 'none';    document.getElementById('label' + id).innerHTML = transaction['new'];    document.getElementById('label_' + id).value = transaction['new'];}; SUGAR.Studio.prototype.handleLabelClick =  function(id, count){    if(this.lastLabel != ''){        //endLabelEdit(lastLabel);    }    if(wasDoubleClick(id) || count == 1){        document.getElementById('span' + id).style.display = '';        document.getElementById(id).focus();        document.getElementById(id).select();        document.getElementById('label' + id).style.display = 'none';        this.lastLabel = id;        YAHOO.util.DragDropMgr.lock();    }        }jstransaction.register('studioLabelEdit', SUGAR.Studio.prototype.undoLabelEdit, SUGAR.Studio.prototype.redoLabelEdit);SUGAR.Studio.prototype.save = function(formName, publish){    ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_SAVING'));    var formObject = document.forms[formName];     YAHOO.util.Connect.setForm(formObject);     var cObj = YAHOO.util.Connect.asyncRequest('POST','index.php',            {success: SUGAR.Studio.prototype.saved, failure: SUGAR.Studio.prototype.saved,timeout:5000, argument: publish});}SUGAR.Studio.prototype.saved= function(o){    if(o){    ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_SAVED'));    window.setTimeout('ajaxStatus.hideStatus();', 2000);        if(o.argument){               studiojs.publish();    }else{    	document.location.reload();    }    }else{        ajaxStatus.showStatus(SUGAR.language.get('Studio', 'LBL_FAILED_TO_SAVE'));        window.setTimeout('ajaxStatus.hideStatus();', 2000);    }}    SUGAR.Studio.prototype.publish = function(){    ajaxStatus.showStatus(SUGAR.language.get('Studio', 'LBL_PUBLISHING'));    var cObj = YAHOO.util.Connect.asyncRequest('GET','index.php?to_pdf=1&module=Studio&action=Publish',            {success: SUGAR.Studio.prototype.published, failure: SUGAR.Studio.prototype.published}, null);}SUGAR.Studio.prototype.published= function(o){    if(o){    ajaxStatus.showStatus(SUGAR.language.get('Studio', 'LBL_PUBLISHED'));    window.setTimeout('ajaxStatus.hideStatus();', 2000);    document.location.reload();    }else{        ajaxStatus.showStatus(SUGAR.language.get('Studio', 'LBL_FAILED_PUBLISHED'));        window.setTimeout('ajaxStatus.hideStatus();', 2000);    }    }var studiopopup = function() {    return {        // covers the page w/ white overlay        display: function() {            if(studiojs.popupVisible)return false;           studiojs.popupVisible = true;            var cObj = YAHOO.util.Connect.asyncRequest('GET','index.php?to_pdf=1&module=Studio&action=wizard&wizard=EditCustomFieldsWizard&option=CreateCustomFields&popup=true',            {success: studiopopup.render, failure: studiopopup.render}, null);              },        destroy:function(){            studiojs.popup.hide();        },        evalScript:function(text){            SUGAR.util.evalScript(text);                     },        render: function(obj){            if(obj){                                studiojs.popup = new YAHOO.widget.Dialog("dlg", {  effect:{effect:YAHOO.widget.ContainerEffect.SLIDE,duration:.5}, fixedcenter: false, constraintoviewport: false, underlay:"shadow",modal:true, close:true, visible:false, draggable:true, monitorresize:true} );                                studiojs.popup.setBody(obj.responseText);                 studiojs.popupAvailable = true;          	    studiojs.popup.render(document.body);          	    studiojs.popup.center();          	    studiojs.popup.beforeHideEvent.fire = function(e){          	        studiojs.popupVisible = false;          	    }          	      studiopopup.evalScript(obj.responseText);                                            }                    }            };}();var studiojs = new SUGAR.Studio();studiojs.popupAvailable = false;studiojs.popupVisible = false;var popupSave = function(o){    var errorIndex = o.responseText.indexOf('[ERROR]');        if(errorIndex > -1){    	var error = o.responseText.substr(errorIndex + 7, o.responseText.length);   		ajaxStatus.showStatus(error);    	window.setTimeout('ajaxStatus.hideStatus();', 2000);    	return;    }    var typeIndex = o.responseText.indexOf('[TYPE]') ;   var labelIndex = o.responseText.indexOf('[LABEL]') ;    var dataIndex = o.responseText.indexOf('[DATA]');    var errorIndex = o.responseText.indexOf('[ERROR]');    var name = o.responseText.substr(6, typeIndex - 6);    var type =  o.responseText.substr(typeIndex + 6,labelIndex - (typeIndex + 6));   var label =  o.responseText.substr(labelIndex + 7,dataIndex - (labelIndex + 7));   var data = o.responseText.substr(dataIndex + 6, o.responseText.length);       addNewField('dyn_field_' + field_count_MSI, name, label, data, type, 1, 'studio_fields', true)      };function submitCustomFieldForm(isPopup){		    if(typeof(document.popup_form.presave) != 'undefined'){        document.popup_form.presave();    }       if(!check_form('popup_form'))return;    if(isPopup){                        var callback =        {            success: popupSave ,            failure: popupSave ,            argument: ''        }        YAHOO.util.Connect.setForm('popup_form');        var cObj = YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback);        studiopopup.destroy();    }else{                document.popup_form.submit();    }}function deleteCustomFieldForm(isPopup){		          if(confirm("WARNING\nDeleting a custom field will delete all data related to that custom field. \nYou will still need to remove the field from any layouts you have added it to.")){    	document.popup_form.option.value = 'DeleteCustomField';  		document.popup_form.submit();    }}function dropdownChanged(value){    if(typeof(app_list_strings[value]) == 'undefined')return;    var select = document.getElementById('default_value').options;    select.length = 0;    var count = 0;    for(var key  in app_list_strings[value]){        select[count] = new Option(app_list_strings[value][key], key);        count++;    }}function customFieldChanged(){}var populateCustomField = function(response){    var div = document.getElementById('customfieldbody');    if(response.status = 0){        div.innerHTML = 'Server Connection Failed';    }else{    		validate['popup_form'] = new Array();    		inputsWithErrors = new Array();        div.innerHTML = response.responseText;        studiopopup.evalScript(response.responseText);        if(studiojs.popupAvailable){                   var region = YAHOO.util.Dom.getRegion('custom_field_table') ;        studiojs.popup.cfg.setProperty('width', region.right - region.left + 30 + 'px');        studiojs.popup.cfg.setProperty('height', region.bottom - region.top + 30 + 'px');                studiojs.popup.render(document.body);        studiojs.popup.center();        studiojs.popup.show();        }          }};var populateCustomFieldCallback = {    success: populateCustomField ,    failure: populateCustomField,    argument: 1};var COBJ = false;function changeTypeData(type){    document.getElementById('customfieldbody').innerHTML = '<h2>Loading...</h2>';    COBJ = YAHOO.util.Connect.asyncRequest('GET','index.php?module=Studio&popup=true&action=index&&ajax=editcustomfield&to_pdf=true&type=' + type,populateCustomFieldCallback,null);}function typeChanged(obj){    changeTypeData(obj.options[obj.selectedIndex].value);}function handle_duplicate(){    document.popup_form.action.value  = 'EditView';    document.popup_form.duplicate.value = 'true';    document.popup_form.submit();}function forceRange(field, min, max){	field.value = parseInt(field.value);	if(field.value == 'NaN')field.value = max;	if(field.value > max) field.value = max;	if(field.value < min) field.value = min;}function changeMaxLength(field, length){	field.maxLength = parseInt(length);	field.value = field.value.substr(0, field.maxLength);}

⌨️ 快捷键说明

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