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

📄 isc_databinding.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 5 页
字号:
_4.append(this.xmlSerializeField(_8,_12,_2,_3))}if(!_5&&_1[_8]!=null)delete _1[_8]}if(!_5){for(var _8 in _1){_4.append(this.xmlSerializeField(_8,_1[_8],_2,_3))}}return _4.toString()},isc.A.xmlSerializeField=function(_1,_2,_3,_4){var _5=isc.SB.create(),_6=this.getField(_1);if(_6==null&&(_1.startsWith("_")||_1.startsWith("$")))return;var _7=(_6?_6.type:null),_8=_3&&_3.flatData,_9=_3&&_3.spoofData,_4=_4||"";if(_9)_2=this.getSpoofedData(_6);if(this.logIsDebugEnabled("xmlSerialize")){this.logDebug("serializing fieldName: "+_1+" with type: "+_7+" with value: "+this.echo(_2))}var _10=((_6&&_6.mustQualify)||_3.qualifyAll?this.getSchemaSet().schemaNamespace:null);var _11=_3.textContentProperty||this.textContentProperty,_12=this.getTextContentField();if(_1==_11&&(_12!=null||!this.hasXMLElementFields(_11))){this.$45z=true;return this.$38f(_12,_2)}if(_7==this.$41v&&_2!=null){if(_2.iscAction){_2=_2.iscAction}else if(isc.isA.StringMethod(_2)){_2=_2.value}}var _13=isc.Comm.$36u(_1,_6?_6.type:null,_10,_3.nsPrefixes),_14=isc.Comm.$36v(_1,_10,_3.nsPrefixes);var _15=isc.isAn.Array(_2)?_2:[_2];if(this.fieldIsComplexType(_1)){var _16=_3.parentSchemaNamespace;_3.parentSchemaNamespace=this.schemaNamespace;var _17=this.getSchema(_7,_6&&_6.xsElementRef?"element":null);if(_6.multiple){_5.append("\r",_4,_13);for(var i=0;i<_15.length;i++){_5.append(_17.xmlSerialize(_15[i],_3,_4+"    ",_6.childTagName))}_5.append("\r",_4,_14)}else if(_17.canBeArrayValued&&isc.isAn.Array(_2)){_5.append(_17.xmlSerialize(_2,_3,_4,_1))}else{for(var i=0;i<_15.length;i++){if(_15[i]==null){_5.append("\r",_4)_5.append(_13,_14)}else if(isc.DS.isSimpleTypeValue(_15[i])){this.logWarn("simple type value "+this.echoLeaf(_15[i])+" passed to complex field '"+_6.name+"'","xmlSerialize");_5.append("\r",_4)_5.append(isc.Comm.xmlSerialize(_1,_15[i]))}else{_5.append(_17.xmlSerialize(_15[i],_3,_4,_1))}}}_3.parentSchemaNamespace=_16}else if(_6!=null){if(_6.multiple){_5.append("\r",_4,_13,"\r");for(var i=0;i<_15.length;i++){_5.append(this.$38g(null,_6,_15[i],_10,_3),"\r",_4)}_5.append("\r",_4,_14,"\r")}else{for(var i=0;i<_15.length;i++){_5.append("\r",_4,this.$38g(_1,_6,_15[i],_10,_3))}}}else{for(var i=0;i<_15.length;i++){if(_15[i]==null||isc.isAn.emptyObject(_15[i])){_5.append("\r",_4,_13,_14)}else{_5.append("\r",_4,isc.Comm.$ew(_1,_15[i],_4,{isRoot:false}))}}}return _5.toString()},isc.A.$38g=function(_1,_2,_3,_4,_5){var _6=_2.type,_5=_5||{};if(isc.isAn.Object(_3)&&!isc.isA.Function(_3.$ew)){return isc.Comm.xmlSerialize(_1||null,_3)}else{var _6=this.$38h(_6);if(_3==null&&_2.nillable){var _7=_1||"value";return isc.Comm.$36u(_7,null,_4,_5.nsPrefixes,true)+" xsi:nil=\"true\"/>"}if(isc.isA.Date(_3)){_3=_3.toSchemaDate(_2.type=="date")}else if(_3!=null&&_3.$ew){return _3.$ew(_1,_6,_4)}else{_3=isc.makeXMLSafe(_3)}return isc.Comm.$ex(_1||"value",_3,_6,_4,_5.nsPrefixes)}},isc.A.$38f=function(_1,_2){if(isc.isA.Date(_2)){return _2.toSchemaDate(_1&&_1.type=="date")}else{return isc.makeXMLSafe(_2)}},isc.A.$38h=function(_1){switch(_1){case"integer":return"int";case"number":return"long";default:return _1}},isc.A.xmlSerializeSample=function(){return this.xmlSerialize({},{spoofData:true})},isc.A.getSpoofedData=function(_1){if(!_1)return"textValue";if(this.getSchema(_1.type)!=null)return{};if(_1.multiple){_1={type:_1.type};return[this.getSpoofedData(_1),this.getSpoofedData(_1)]}if(_1.valueMap){var _2=!isc.isAn.Array(_1.valueMap)?isc.getKeys(_1.valueMap):_1.valueMap;return _2[Math.round(Math.random()*(_2.length-1))]}var _3=isc.SimpleType.getBaseType(_1.type);switch(_3){case"boolean":return(Math.random()>0.5);case"integer":case"int":case"number":var _4=0,_5=10;if(_1.validators){var _6=_1.validators.find("type","integerRange");if(_6){this.logWarn(_1.name+" has "+_6.type+" validator "+" with min "+_6.min+" and max "+_6.max);_4=_6.min||0;_5=_6.max||Math.min(_4,10);if(_4>_5)_4=_5}}return Math.round(_4+(Math.random()*(_5-_4)));case"float":case"decimal":case"double":var _4=0,_5=10,_7=2;if(_1.validators){var _6=_1.validators.find("type","floatRange");if(_6){this.logWarn(_1.name+" has "+_6.type+" validator "+" with min "+_6.min+" and max "+_6.max);_4=_6.min||0;_5=_6.max||Math.min(_4,10);if(_4>_5)_4=_5}var _8=_1.validators.find("type","floatPrecision");if(_8){_7=_8.precision||2}}return(_4+(Math.random()*(_5-_4))).toFixed(_7);case"date":case"time":case"datetime":var _9=new Date();if(_1.validators){var _6=_1.validators.find("type","dateRange");if(_6){this.logWarn(_1.name+" has "+_6.type+" validator "+" with min "+_6.min+" and max "+_6.max);if(_6.min)_9=_6.min;else if(_6.max)_9=_6.max}}return _9;default:return"textValue"}},isc.A.getSerializeableFields=function(_1,_2){var _3=this.Super("getSerializeableFields",arguments);var _4=_3.fields;_4=isc.getValues(_4);for(var i=0;i<_4.length;i++){var _6=_4[i]=isc.addProperties({},_4[i]);var _7=_6.validators;if(_7){_6.validators=_7.findAll("_generated",null);if(_6.validators==null)delete _6.validators}}_3.fields=_4;return _3},isc.A.$378=function(_1,_2,_3,_4){var _5=_1,_6=_4.$374,_7=this.getOperationBinding(_6),_8;if(_5){if(_7.wsOperation){var _9=this.getWebService(_6),_8=_9.getOutputNamespaces(_7.wsOperation);_5.addNamespaces(_8)}_5.addNamespaces(this.xmlNamespaces);_5.addNamespaces(_7.xmlNamespaces)}var _10=this.xmlNamespaces;this.xmlNamespaces=isc.addProperties({},_8,this.xmlNamespaces,_7.xmlNamespaces);var _11=this.dsResponseFromXML(_5,_6);this.xmlNamespaces=_10;this.$38b(_5,_11,_6,_3,_4)},isc.A.dsResponseFromXML=function(_1,_2){var _3=_1?this.selectRecords(_1,_2):[];var _4={data:_3,startRow:_2.startRow||0,status:0};_4.endRow=_4.startRow+Math.max(0,_3.length-1);_4.totalRows=Math.max(_4.endRow,_3.length);if(!_1)return _4;if(this.totalRowsXPath){_4.totalRows=isc.xml.selectNumber(_1,this.totalRowsXPath,this.xmlNamespaces,true)}if(this.startRowXPath){_4.startRow=isc.xml.selectNumber(_1,this.startRowXPath,this.xmlNamespaces,true);_4.endRow=_4.startRow+Math.max(0,_3.length-1)}if(this.endRowXPath){_4.endRow=isc.xml.selectNumber(_1,this.endRowXPath,this.xmlNamespaces,true);if(!this.startRowXPath){_4.startRow=_4.endRow-Math.max(0,_3.length-1)}}if(this.statusXPath){_4.status=parseInt(isc.xml.selectScalar(_1,this.statusXPath,this.xmlNamespaces,true))}if(this.errorSchema){_4.errors=this.errorSchema.selectRecords(_1,_2)}return _4},isc.A.selectRecords=function(_1,_2){var _3=this.selectRecordElements(_1,_2);var _4=this.getOperationBinding(_2),_5=this.getSchema(_4.responseDataSchema)||this;return _5.recordsFromXML(_3)},isc.A.recordsFromXML=function(_1){if(!isc.isAn.Array(_1)){if(_1.length!=null)_1=isc.xml.$37m(_1);else _1=[_1]}if(this.transformResponseToJS){var _2=this.dropExtraFields?this.getFieldNames():null;_1=isc.xml.toJS(_1,_2,this);if(this.logIsDebugEnabled("xmlBinding")){this.logDebug("transformed response: "+isc.Comm.serialize(_1,true)+"xmlBinding")}}return _1},isc.A.selectRecordElements=function(_1,_2){if(isc.isA.String(_1))_1=isc.xml.parseXML(_1);var _3=this.getOperationBinding(_2);var _4=_3==this?null:_3.recordXPath,_5=_3==this?null:_3.recordName,_6=this.recordXPath,_7=this.recordName;if(_4==null&&(_5!=null||(_6==null&&_7!=null))&&this.hasWSDLService(_2)){var _8=this.getWebService(_2);return _8.selectByType(_1,_3.wsOperation||this.wsOperation,_5||_7)}var _9=_4||_6,_10;if(_9){_10=isc.xml.selectNodes(_1,_9,this.xmlNamespaces);this.logDebug("applying XPath: "+_9+(this.xmlNamespaces?" with namespaces: "+this.echo(this.xmlNamespaces):"")+" got "+_10.length+" elements","xmlBinding")}else{_10=[];var _11=_5||_7||this.ID;var _12=_1.getElementsByTagName(_11);for(var i=0;i<_12.length;i++)_10.add(_12[i]);this.logDebug("getting elements of tag name: "+_11+" got "+_10.length+" elements","xmlBinding")}return _10},isc.A.$38b=function(_1,_2,_3,_4,_5){_2.httpResponseCode=_4.httpResponseCode;_2.transactionNum=_4.transactionNum;_2.clientContext=_5.clientContext;if(this.logIsInfoEnabled("xmlBinding")){this.logInfo("dsResponse is: "+this.echo(_2),"xmlBinding")}_2.context=_5;var _6=this.transformResponse(_2,_3,_1);_2=_6||_2;_2.startRow=this.$52v(_2.startRow);_2.endRow=this.$52v(_2.endRow);_2.totalRows=this.$52v(_2.totalRows);if(_2.status>=0){isc.DataSource.handleUpdate(_2,_3)}else if(!_3.willHandleError){isc.RPCManager.$a0(_2,_3)}var _7=[_3.$376,_3.afterFlowCallback],_8=[];for(var i=0;i<_7.length;i++){var _10=_7[i];if(_8.contains(_10)){this.logWarn("Suppressed duplicate callback: "+_10);continue}var _11=this.fireCallback(_10,"dsResponse,data,dsRequest",[_2,_2.data,_3]);if(_5.willHandleError&&_11===false){this.logDebug("performOperationReply: Further processing cancelled by callback");break}var _12=isc.RPCManager.getTransaction(_4.transactionNum);if(_12.suspended)return}},isc.A.$52v=function(_1){if(_1==null||!isc.isA.String(_1))return _1;var _2=parseInt(_1);if(isNaN(_2))return _1;else return _2},isc.A.transformResponse=function(_1,_2,_3){return _1},isc.A.getFieldValue=function(_1,_2,_3){var _4=isc.xml.getFieldValue(_1,_2,_3,this,this.xmlNamespaces);if(!_3.getFieldValue)return _4;if(!isc.isA.Function(_3.getFieldValue)){isc.Func.replaceWithMethod(_3,"getFieldValue","record,value,field,fieldName")}return _3.getFieldValue(_1,_4,_3,_2)},isc.A.validateFieldValue=function(_1,_2){var _3=_1.validators;if(!_3)return _2;if(!isc.isAn.Array(_3)){this.$2j[0]=_3;_3=this.$2j}var _4=_2;for(var i=0;i<_3.length;i++){var _6=_3[i];var _7=isc.Validator.processValidator(_1,_6,_2);if(!_7){this.logWarn(this.ID+"."+_1.name+": value: "+this.echoLeaf(_2)+" failed on validator: "+this.echo(_6));return _2}var _8;if(_6.resultingValue!==_8){_2=_6.resultingValue;_6.resultingValue=_8}if(!_7&&_6.stopIfFalse)break}this.$2j.length=0;return _2},isc.A.fetchData=function(_1,_2,_3){this.performDSOperation("fetch",_1,_2,_3)},isc.A.filterData=function(_1,_2,_3){if(!_3)_3={};if(_3.textMatchStyle==null)_3.textMatchStyle="substring";this.performDSOperation("fetch",_1,_2,_3)},isc.A.addData=function(_1,_2,_3){this.performDSOperation("add",_1,_2,_3)},isc.A.updateData=function(_1,_2,_3){this.performDSOperation("update",_1,_2,_3)},isc.A.removeData=function(_1,_2,_3){var _4=this.getPrimaryKeyFields(),_1=isc.applyMask(_1,_4);this.performDSOperation("remove",_1,_2,_3)},isc.A.performDSOperation=function(_1,_2,_3,_4){if(isc.$cv)arguments.$cw=this;var _5=isc.addProperties({operationType:_1,dataSource:this.ID,data:_2,callback:_3},_4);return this.sendDSRequest(_5)},isc.A.sendDSRequest=function(_1){isc.addDefaults(_1,this.getOperationBinding(_1.operationType).requestProperties);isc.addDefaults(_1,this.requestProperties);var _2=this.getDataFormat(_1);if(_2=="iscServer"&&!this.clientOnly&&!isc.hasOptionalModule("SCServer")){if(this.dataURL==null&&this.testFileName==null){this.logError("DataSource: "+this.ID+": attempt to use DataSource of type iscServer without SmartClient Server option."+" Please either set clientOnly: true for one-time fetch against"+" dataURL/testFileName or download the edition with SmartClient Server");return}this.logInfo("Switching to clientOnly - no SmartClient Server installed.");this.clientOnly=true}if(_1.showPrompt==null){_1.showPrompt=this.showPrompt}if(this.fetchingClientOnlyData(_1))return;if(this.logIsDebugEnabled()){this.logDebug("Outbound DSRequest: "+this.echo(_1))}_1.$376=_1.callback;if(_2=="iscServer"&&!this.clientOnly){return this.performSCServerOperation(_1)}var _3=this.getServiceInputs(_1);var _4=isc.addProperties({},_1,_3);_4.$374=_1;if(_3.data==null)_4.data=null;if(this.clientOnly){_4.callback={target:this,methodName:"$50e"};isc.RPC.sendRequest(_4);return}var _5=this.getOperationBinding(_1);_4.transport=_5.dataTransport||this.dataTransport;if(_4.transport=="scriptInclude"){_4.callback={target:this,methodName:"$377"};if(!_4.callbackParam){_4.callbackParam=_5.callbackParam||this.callbackParam}isc.RPC.sendRequest(_4);return}var _2=this.getDataFormat(_1);if(_2=="xml"){_4.callback={target:this,method:this.$378};isc.xml.getXMLResponse(_4)}else if(_2=="json"){_4.callback={target:this,method:this.$379};isc.rpc.sendProxied(_4)}else{_4.serverOutputAsString=true;_4.callback={target:this,method:this.$38a};isc.rpc.sendProxied(_4)}},isc.A.performSCServerOperation=function(_1,_2){this.logWarn("Attempt to perform iscServer request requires options SmartClient server "+"support - not present in this build.\nRequest details:"+this.echo(_1));return},isc.A.getSchema=function(_1,_2){var _3=this.getSchemaSet();if(_3!=null){var _4=_3.getSchema(_1,_2);if(_4!=null)return _4}var _5=this.getWebService();if(isc.isA.WebService(_5))return _5.getSchema(_1,_2);return isc.DS.get(_1,null,null,_2)},isc.A.getTitle=function(){return this.title||this.ID},isc.A.getPluralTitle=function(){return this.pluralTitle||(this.getTitle()+"s")},isc.A.getTitleField=function(){if(this.titleField==null){var _1=isc.getKeys(this.getFields());this.titleField=_1.contains("title")?"title":_1.contains("name")?"name":_1.contains("id")?"id":_1.first()}return this.titleField},isc.A.initViewSources=function(){var _1=this.fields={};for(var _2 in this.sources){var _3=isc.DS.get(_2);if(!_3)continue;var _4=this.sources[_2].fields;for(var _5 in _4){var _6=_4[_5],_7=null;if(_6=="*"){_7=_3.fields[_5]}else if(isc.isA.String(_6)){_7=_3.fields[_6]}else if(isc.isAn.Object(_6)){_7=isc.addProperties({},_3.fields[_3.fields[_6.field]]);isc.addProperties(_7,_6)}if(_7)_1[_5]=_7}}},isc.A.inheritsSchema=function(_1){if(_1==null)return false;if(isc.isA.String(_1))

⌨️ 快捷键说明

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