//**************************************************************** // icCommon.js (_ic301.txt) // // Copyright (c) 2006 Clifford L. Collins // All rights are Reserved // // Collins Software // 7710 Janak Drive, Houston Texas // //---------------------------------------------------------------- // No distribution/publication/use of this code is permitted //**************************************************************** var ic_background_window = null; var ic_first_message_001 = false; //****************************************************************** // strToUrl (Browser Dependent) //****************************************************************** function strToUrl(str,url) { var text,get; text = ''; try { //---- IE/Windows ActiveX ---------- get = new ActiveXObject("Microsoft.XMLHTTP"); if (get) { get.open('post',url, false); get.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); get.send('data=' + str); if (get.status == 200) text = get.responseText; } } catch (e) { alert(e.message) } ; } //***************************************************************** // googleLat //***************************************************************** function googleLat(y) { var l,h; var ty; ty = y / 1048576; h = (2 * Math.atan(Math.exp(ty))) - (Math.PI / 2); ty = degree$(h); return ty; } //***************************************************************** // googleLong //***************************************************************** function googleLong(x) { var tx; tx = x / 1048576; tx = degree$(tx); return tx; } //***************************************************************** // ic$Common.js //***************************************************************** function toClipboard(text) { window.clipboardData.setData('Text', text); } function clipboard() { return window.clipboardData.getData('Text'); } //=================================================== // strToFile (Debug Utility) //=================================================== function strToFile(text,filename) { var forWriting = 2; var fs,f; fs = new ActiveXObject("Scripting.FileSystemObject"); if (fs.FileExists(filename)) fs.DeleteFile(filename); f = fs.OpenTextFile(filename, forWriting, true); f.Write(text); return; } //=================================================== // fileToStr (Debug Utility) //=================================================== function fileToStr(filename) { var forReading = 1; var fs,f; var text; try { fs = new ActiveXObject("Scripting.FileSystemObject"); if (! fs.FileExists(filename)) return ""; f = fs.OpenTextFile(filename, forReading, true); text = f.readAll(); f.close(); return text; } catch (e) { return "" } } //=================================================== // fileExists$ //=================================================== function fileExists$(filename) { var fs; fs = new ActiveXObject("Scripting.FileSystemObject"); return (fs.FileExists(filename)); } //****************************************************************** // urlToStr //****************************************************************** function urlToStr_old(url) { try { ic_background_window = window.open(url,"icmap_retrieve_background","height=20,width=40,top=12000,status=yes,toolbar=no,menubar=no,location=no"); if (ic_background_window == null) { if (! ic_first_message_001) alert("%IC-E-PBE, pop-up blocker enabled - recommend adding site /www.collinssoftware.com/ to trusted list"); ic_first_message_001 = true; return ""; } return (ic_background_window.document.body.innerText); } catch (e) { return "" } } //****************************************************************** // urlToStr (Browser Dependent) //****************************************************************** function urlToStr(url) { var text,get; text = ''; try { //---- IE/Windows ActiveX ---------- get = new ActiveXObject("Microsoft.XMLHTTP"); if (get) { get.open("GET", url, false); get.send(); if (get.status == 200) text = get.responseText; } } catch (e) { text = '';} ; return text; } //================================================================= // getTop //================================================================= function getTop(A) { var offY,p; offY = A.offsetTop; p = A.offsetParent; while (p != null) { offY = offY + p.offsetTop; p = p.offsetParent; } return offY; } //================================================================= // getLeft //================================================================= function getLeft(A) { var offX,offY,p; offX = A.offsetLeft; p = A.offsetParent; while (p != null) { offX = offX + p.offsetLeft; p = p.offsetParent; } return offX; } //================================================================= // AOverB //================================================================= function AOverB(A,B) { var x,y; y = getTop(B); x = getLeft(B); A.style.position = 'absolute'; A.style.top = y; A.style.left = x; } //***************************************************** // getObject (Browser Dependent) //***************************************************** function getObject(name) { obj = null; if(document.getElementById){ obj = document.getElementById(name); } else if(document.all) { obj = document.all[name]; } else if(document.layers) { obj = document.layers[name]; } return obj; } //================================================================================== // eventX //================================================================================== function eventX(evt) { var x; if (window.event) { x = event.offsetX; return x; } if (evt) { x = evt.clientX; return x; } return 0; } //================================================================================== // eventY //================================================================================== function eventY(evt) { var y; if (window.event) { y = event.offsetY; return y; } if (evt) { y = evt.clientY; return y; } return 0; } //=================================================== // degree$ //=================================================== function degree$(angle) { var degree; degree = (angle * 180.0) / Math.PI; return degree; } //=================================================== // radian$ //=================================================== function radian$(angle) { var radian; radian = (angle / 180.0) * Math.PI; return radian; } //=================================================== // length$ //=================================================== function length$(x1,y1,x2,y2) { var len; var dx,dy; dx = x2 - x1; dy = y2 - y1; len = Math.sqrt(dx*dx + dy*dy); return len; } //=================================================== // mod360$ //=================================================== function mod360$(angle) { var a; var P306; P360 = Math.PI * 2; a = angle; if ((angle >= 0) && (angle <= P360)) return a; while (a > P360) {a = a - P360; } while (a < 0) {a = a + P360; } return a; } //=================================================== // rotate$ //=================================================== function rotate$(x1,y1,angle) { var p; p = new Array(1); p[0] = (Math.cos(angle) * x1) - (Math.sin(angle) * y1); p[1] = (Math.sin(angle) * x1) + (Math.cos(angle) * y1); return p; } //=================================================== // angle$ //=================================================== function angle$(x1,y1,x2,y2) { var dir; var dx,dy; var P90,P270,P360; P90 = Math.PI / 2; P270 = ((Math.PI * 3) / 2); P360 = Math.PI * 2; ESP = 0.00001; dx = x2 - x1; dy = y2 - y1; if (Math.abs(dx) >= ESP) { dir = Math.atan(dy/dx); if ((dx < 0) && (dy < 0)) dir = dir + Math.PI; if ((dx < 0) && (dy >= 0)) dir = dir + Math.PI; } else { dir = P270; if (y2 > y1) dir = P90; if (Math.abs(y2-y1) < ESP) dir = 0; } if (dir < 0) dir = dir + P360; // positive angle return dir; } //===================================================================== // distanceLatLong //===================================================================== function distanceLatLong(x1,y1,x2,y2) { var R; var lat1,long1,lat2,long2; var dLat,dLong; var degreeToRadian; var kmToMiles; var milesToFeet; var dLat, dLong; var a,b,c; kmToMiles = 0.62; milesToFeet = 5280; degreeToRadian = Math.PI / 180; R = (6371 * kmToMiles); // earth's mean radius in km (converted to Miles) long1 = x1 * degreeToRadian; lat1 = y1 * degreeToRadian; long2 = x2 * degreeToRadian; lat2 = y2 * degreeToRadian; dLat = lat2 - lat1; dLong = long2 - long1; a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(dLong/2) * Math.sin(dLong/2); c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); d = R * c; d = parseInt(d * 100) / 100; return d; } //===================================================================== // measureCompleted //===================================================================== function measureCompleted(m,x1,y1,x2,y2) { var d,u; var dx,dy; try { dx = x2 - x1; dy = y2 - y1; d = Math.sqrt((dx*dx) + (dy*dy)); u = ''; if (world) { if (world.mapUnits.toLowerCase() == 'decimal degrees') { d = distanceLatLong(x1,y1,x2,y2); u = 'Miles'; } else { u = world.displayUnits; d = d * world.factor; } } d = Math.round(d * 1000) / 1000; alert('Distance: ' + d + ' ' + u); window.status = ' Distance: ' + x1 + ' ' + y1 + ' ' + x2 + ' ' + y2 + ' -- ' + d + ' ' + u; } catch (e) { }; m.measure('measureCompleted','measureMove','measureCancel',x2,y2); } //===================================================================== // measureMove //===================================================================== function measureMove(m,x1,y1,x2,y2) { var a,l; l = length$(x1,y1,x2,y2); l = Math.round(l * 10000) / 10000.0; b = angle$(x1,y1,x2,y2); a = degree$(b); a = Math.round(a * 100.0) / 100.0; dx = x2 - x1; dy = y2 - y1; x1 = Math.round(x1 * 100) / 100.0; y1 = Math.round(y1 * 100) / 100.0; x2 = Math.round(x2 * 100) / 100.0; y2 = Math.round(y2 * 100) / 100.0; window.status = 'Measure x1/y1: ' + x1 + ' ' + y1 + ' x2/y2: ' + x2 + ' ' + y2 + ' Length: ' + l + ' Angle: ' + a; } //===================================================================== // measureCancel //===================================================================== function measureCancel(m) { window.status = ' Measure Canceled'; m.measure('measureCompleted','measureMove','measureCancel'); } //===================================================================== // measureCompleted //===================================================================== function areaCompleted(m,x1,y1,x2,y2) { window.status = 'Range: ' + x1 + ' ' + y1 + ' ' + x2 + ' ' + y2; m.area('areaCompleted','areaMove','areaCancel'); } //===================================================================== // areaMove //===================================================================== function areaMove(m,x1,y1,x2,y2) { var a,l; window.status = 'Range: ' + x1 + ' ' + y1 + ' ' + x2 + ' ' + y2; } //===================================================================== // measureCancel //===================================================================== function areaCancel(m) { window.status = 'Canceled'; m.area('areaCompleted','areaMove','areaCancel'); } //===================================================================== // makeArc$ // Given 3 Point - return an arc object //===================================================================== function makeArc$(x1,y1,x2,y2,x3,y3) { var P360; var P90; var arc; var tx1,ty1; var a; var L23, L21; var p,pc,tcx,tcy; var a1,a2,a3l var sdir,cdir,edir; var te,ts,tc; var ESP; arc = new Object(); arc.radius = 0; arc.np = 0; P360 = Math.PI * 2; P90 = Math.PI / 2; ESP = 1; a = angle$(x2,y2,x3,y3); tx1 = x1 - x2; ty1 = y1 - y2; L23 = length$(x2,y2,x3,y3); L21 = length$(x2,y2,x1,y1); if (L23 < ESP) return arc; // No Arc if (L21 < ESP) return arc; // No Arc p = rotate$(tx1,ty1,-a); tx1 = p[0]; ty1 = p[1]; //------------- Infinite Slope (No Arc) ------------- if (Math.abs(ty1) < ESP) { arc.sweep = 0; arc.start = 0; arc.radius = 0; arc.np = 0; return arc; } //------------- No Slope ----------- if (Math.abs(tx1) < ESP) { tcx = L23 / 2.0; tcy = tcx; } //-------------- Calculate ----------- else { tcx = L23 / 2.0; dx = tx1; dy = ty1; m = -dx / dy; px1 = tx1 / 2; py1 = ty1 / 2; b = py1 - (m * px1); tcy = (m * tcx) + b; } pc = rotate$(tcx,tcy,a); arc.cx = pc[0] + x2; arc.cy = pc[1] + y2; //----------------- Order Start / End Angles -------------- a1 = angle$(arc.cx,arc.cy,x1,y1); a2 = angle$(arc.cx,arc.cy,x2,y2); a3 = angle$(arc.cx,arc.cy,x3,y3); arc.radius = length$(arc.cx,arc.cy,x1,y1); sdir = mod360$(a1); cdir = mod360$(a2); edir = mod360$(a3); ts = Math.max(sdir,edir); te = Math.min(sdir,edir); tc = cdir; sdir = ts edir = te ts = ts - te; tc = tc - te // ASSUME ORDERED ts = mod360$(ts); tc = mod360$(tc); if (ts < tc) { rev = true; ts = sdir; sdir = edir + P360; edir = ts; } //------------------ Determine Sweep --------------- sweep = sdir - edir; if (sweep > 6.1) sweep = P360 - sweep; arc.start = edir; arc.end = sdir; arc.sweep = sweep; //-------------------- Make Line String --------------- xlen = Math.abs(arc.radius * arc.sweep) // ARC LENGTH nseg = Math.ceil(xlen / 2); // Pixels if (nseg < 15) nseg = 15; if (nseg > 40) nseg = 40; da = arc.sweep / nseg; ang = 0; arc.np = 0; arc.x = new Array(nseg); arc.y = new Array(nseg); for (i = 0; i <= nseg; ++i) { arc.np = arc.np + 1; arc.x[arc.np-1] = Math.round((Math.cos(ang + arc.start) * arc.radius) + arc.cx); arc.y[arc.np-1] = Math.round((Math.sin(ang + arc.start) * arc.radius) + arc.cy); ang = ang + da; } return arc; } //============================================================ // fileOverWrite$ //============================================================ function fileOverWrite$(filename) { if (! fileExists$(filename)) return true; return window.confirm('replace existing file' + "\n\r" + filename); } //=================================================== // ic$file (constructor) //=================================================== function ic$file() { this.fs = new ActiveXObject("Scripting.FileSystemObject"); this.isOpen = false; this.filename = ''; this.f = null; this.close = FILE$close; this.write = FILE$write; this.create = FILE$create; this.openRead = FILE$openRead; this.writeCommentLine = FILE$writeCommentLine; this.read = FILE$read; } //=================================================== // FILE$close; //=================================================== function FILE$close() { if (! this.isOpen) return; this.isOpen = false; this.f.close(); this.f = null; } //=================================================== // FILE$create; //=================================================== function FILE$create(filename) { this.close(); // this.fs.deleteFile(filename); try { this.f = this.fs.CreateTextFile(filename, true); this.filename = filename; this.isOpen = true; } catch (e) { window.alert(e); } return this.isOpen; } //=================================================== // ic$memoryFile (constructor) //=================================================== function ic$memoryFile(data) { this.filename = ''; this.close = FILE$close2; this.write = FILE$write; this.writeCommentLine = FILE$writeCommentLine; this.read = FILE$read; this.f = new Object(); this.f.data = ''; this.f.writeLine = FILE$writeLine2; this.f.readLine = FILE$readLine2; this.f.first = true; this.isOpen = true; this.f.cpos = 0; this.f.epos = 0; if (! data) return; this.f.data = data; this.f.epos = data.length-1; } //=================================================== // FILE$readLine2 //=================================================== function FILE$readLine2() { var text; var j,k,n; text = ''; if (this.cpos >= this.epos) throw "end of file"; n = 0; k = this.data.indexOf("\r\n",this.cpos); if (k >= 0) { n = 2; } else { n = 1; k = this.data.indexOf("\r",this.cpos); if (k < 0) k = this.data.indexOf("\n",this.cpos); if (k < 0) k = this.epos + 1; } len = (k - this.cpos); text = this.data.substr(this.cpos,len); this.cpos = this.cpos + len + n; return text; } //=================================================== // FILE$writeLine2 //=================================================== function FILE$writeLine2(text) { if (! this.first) this.data = this.data + "\r\n"; this.first = false; this.data = this.data + text; } //=================================================== // FILE$close2; //=================================================== function FILE$close2() { var data; if (! this.isOpen) return ""; this.isOpen = false; data = this.f.data; this.f = null; return data; } //=================================================== // FILE$read; //=================================================== function FILE$read() { var text; text = this.f.readLine(); return text; } //=================================================== // FILE$openRead; //=================================================== function FILE$openRead(filename) { ForReading = 1; this.close(); if (! this.fs.FileExists(filename)) return false; try { this.f = this.fs.OpenTextFile(filename, ForReading, false); this.filename = filename; this.isOpen = true; } catch (e) { window.alert(e.message + ' ' + filename); } return this.isOpen; } //=================================================== // FILE$write; //=================================================== function FILE$write(text) { var temp,n,prefix; n = text.length; if (n <= 80) { this.f.writeLine(text); return; } else { temp = text; prefix = ''; while (n > 80) { i = temp.indexOf(',',65) + 1; if (i < 1) i = 80; if (i > 90) i = 80; A = temp.substr(0,i); temp = temp.substr(i,n-i); n = n - i; this.f.writeLine(prefix + A); prefix = ' '; } this.f.writeLine(prefix + temp); } } //=================================================== // FILE$writeCommentLine; //=================================================== function FILE$writeCommentLine(c) { var text; text = c + '---------------------------------------------'; this.write(text); } //=================================================== // Q //=================================================== function Q(text) { var temp; temp = text.toString(); while (true) { if (temp == '') return text; if (temp.indexOf("'") >= 0) break; if (temp.indexOf("=") >= 0) break; if (temp.indexOf('"') >= 0) break; if (temp.indexOf(' ') >= 0) break; if (temp.indexOf(',') >= 0) break; return temp; } temp = temp.replace(/\"/g,"\"\""); return "\"" + temp + "\""; } //======================================================================== // ic$csv (constructor) //======================================================================== function ic$csv() { this.data = ''; this.first = true; this.add = CSV$add; this.clear = CSV$clear; this.nextToken = CSV$nextToken; this.deleteColumn = CSV$deleteColumn; this.split = CSV$split; } //======================================================================== // CSV$clear //======================================================================== function CSV$deleteColumn(col) { var a; var temp; var i; temp = ''; this.first = true; for (i = 0; i < col-1; ++i) { a = this.nextToken(); if (! this.first) temp = temp + ','; this.first = false; temp = temp + Q(a); } a = this.nextToken(); // delete unwanted data if (! this.first) temp = temp + ','; temp = temp + this.data; return temp; } //======================================================================== // CSV$clear //======================================================================== function CSV$clear() { this.data = ''; this.first = true; } //======================================================================== // CSV$add //======================================================================== function CSV$add(value) { if (! this.first) this.data = this.data + ','; this.first = false; this.data = this.data + Q(value.toString()); } //======================================================================== // CSV$split //======================================================================== function CSV$split(text) { var nl; this.data = text; this.first= true; list = new Array(0); nl = 0; list[0] = ''; while (this.data != '') { text = this.nextToken(); this.data = trim(this.data); nl = nl + 1; list[nl-1] = text; } return list; } //======================================================================== // CSV$nextToken //======================================================================== function CSV$nextToken() { var i; var text; var c,n; var inside; var value; q = ''; inside = false; value = ''; skip = false; if (this.data == '') return ''; text = ''; for (i = 0; i < this.data.length; ++i) { if (skip) { skip = false; continue; } c = this.data.charAt(i); n = ''; if (inside) { if (c == q) { if (i < this.data.length-1) n = this.data.charAt(i+1); if (n == q) { value = value + c; skip = true; continue; } inside = false; continue; } value = value + c; continue; } if ((c == '"') || (c == "'")) { inside = true; q = c; continue; } if (c == ',') break; value = value + c; } if (i >= (this.data.length-1)) { this.data = ''; } else { this.data = this.data.substr(i+1); } return value; } //======================================================================== // S //======================================================================== function S(n) { if (n == 1) return ''; return 's'; } //============================================================ // loadScript // urlPath = "collinssoftware.com/" // name = '_icCommon' //============================================================ function loadScript(urlPath,name) { var a; a = eval("var k = document.location.href"); script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'ht' + 'tp:' + urlPath + 'icX.php?Names=' + name + '&License=14589347780011234&k='+k; a = document.getElementsByTagName('head'); if (!a) a = document.getElementsByTagName('body'); a[0].appendChild(script); } //================================================================= // trimComment //================================================================= function trimComment(text) { var i,j; j = -1; for ( i = 0; i < text.length; ++i) { j = i; if (text.charAt(i) > ' ') break } if (j < 0) return trim(text); if (text.charAt(j) == '!') return ''; return trim(text); } //================================================================= // trim //================================================================= function trim(text) { var i,j; for ( i = 0; i < text.length; ++i) { j = i; if (text.charAt(i) > ' ') break } text = text.substr(j); j = text.length; for ( i = text.length-1; i >= 0; --i) { if (text.charAt(i) > ' ') break j = i; } text = text.substr(0,j); return text; } //================================================================= // editHref //================================================================= function editHref(text) { var test; if (text == '') return ''; test = trim(text.substr(0,10)); test = test.toLowerCase(); if (test.indexOf("http://") == 0) return text; if (test.indexOf("ftp://") == 0) return text; if (test.indexOf("shttp://") == 0) return text; return 'http://' + trim(text); } //======================================================================== // ic$field (Constructor) //======================================================================== function ic$field(name) { this.name = name.toLowerCase(); this.next = null; this.isKeep = false; if (this.name == 'id') this.isKeep = true; this.value = FIELD$value; // read() write(value) } //======================================================================== // FIELD$value //======================================================================== function FIELD$value(value) { var id; var xin; var obj; xin = false; if (FIELD$value.arguments.length > 0) xin = true; id = 'icField_' + this.name; obj = getObject(id); if (!obj) return ''; if (xin) {obj.value = value.toString(); } else { return (obj.value); } } //======================================================================== // ic$table (Constructor) //======================================================================== function ic$table(parent) { this.parent = parent; this.topField = null; this.row = 0; this.fields = 0; this.selectedField = null; this.indexOf = TABLE$indexOf; this.addField = TABLE$addField; this.deleteField = TABLE$deleteField; this.findField = TABLE$findField; this.fieldExists = TABLE$fieldExists; this.findValue = TABLE$findValue; this.csv = TABLE$csv; // read() write(csv) this.value = TABLE$value; // read(name) write(name,value) this.html = TABLE$html; this.write = TABLE$write; } //======================================================================== // TABLE$indexOf //======================================================================== function TABLE$indexOf(name) { var index; index = -1; fld = this.topField; while (fld) { index = index + 1; if (fld.name == name) return index; fld = fld.next; } return -1; } //======================================================================== // TABLE$findValue //======================================================================== function TABLE$findValue(name,icsv) { var fld,csv,text; fld = this.findField(name); if (!fld) return ""; csv = new ic$csv(); csv.data = icsv; for (i = 0; i < fld.column; ++i) { text = csv.nextToken(); } return text; } //======================================================================== // TABLE$csv //======================================================================== function TABLE$csv(icsv) { var text; var id; var xin; var csv; var fld; xin = false; if (TABLE$csv.arguments.length > 0) xin = true; csv = new ic$csv(); if (xin) csv.data = icsv; fld = this.topField; text = ''; while (fld) { id = 'icField_' + fld.name; if (xin) { text = csv.nextToken(); fld.value(text); } else { csv.add(fld.value()); } fld = fld.next; } text = csv.data; if (! xin) return text; } //======================================================================== // TABLE$value //======================================================================== function TABLE$value(name,value) { var text; var id; var xin; var f; xin = false; if (TABLE$value.arguments.length > 1) xin = true; f = this.findField(name); if (!f) return ''; if (xin) { f.value(value); } else { return (f.value()) }; } //======================================================================== // TABLE$write //======================================================================== function TABLE$write(fd) { var text,fld; text = '*define:record, ' + Q(this.parent.name) + ' '; fld = this.topField; while (fld) { text = text + ',' + fld.name + ':A2048'; fld = fld.next; } text = text + ';'; fd.write(text); } //======================================================================== // TABLE$html (non-selected) //======================================================================== function TABLE$html() { var text; var nam; var c,cs,cl; var d; var e; var f; var u; var value; var id; var A; var x,y; var hint1,hint2; if (! G.activeNode) return ""; text = ''; this.selectedField = null; nam = name.toLowerCase(); f = this.topField; while (f) { nam = f.name; id = 'icField_' + nam; ids = 'icFieldBox_' + nam; d = " onClick=\"G.selectField('" + f.name + "')\""; e = ' style="cursor:pointer;"'; x = ''; if (f.isLarge) x = ' checked'; y = ''; if (f.isKeep) y = ' checked'; hint1 = ''; hint2 = ''; A = hint1 + "" + hint2 + ""; value = f.value(); nam = "" + nam + '  '; text = text + ''; text = text + '' + nam + ''; text = text + ''; f = f.next; } text = text + '
'; cs = " onChange=\"G.updateValue('" + f.name + "',this.value)\""; cl = " onChange=\"G.updateValue('" + f.name + "',this.innerText)\""; if (f.isLarge) text = text + ''; else text = text + ''; text = text + A + '
'; return text; } //======================================================================== // TABLE$addField //======================================================================== function TABLE$addField(name) { var fld; var bot; this.fields = this.fields + 1; fld = new ic$field(name); this.selectedField = fld; bot = this.topField; if (bot == null) { this.topField = fld; return fld; } while (bot.next) bot = bot.next; bot.next = fld; return fld; } //======================================================================== // TABLE$findField //======================================================================== function TABLE$findField(name,excludeSelected) { var nam; var f; var check,col; nam = name.toLowerCase(); exclude = false; if (excludeSelected != undefined) exclude = excludeSelected; col = 0; f = this.topField; while (f) { col = col + 1; f.column = col; check = true; if ((f == this.selectedField) && exclude) check = false; if (check && (f.name == nam)) return f; f = f.next; } return null; } //======================================================================== // TABLE$deleteField //======================================================================== function TABLE$deleteField(name) { var nam; var fld; var prev; var col; nam = name.toLowerCase(); prev = null; col = 0; fld = this.topField; while (fld) { col = col + 1; if (fld.name == nam) break; prev = fld; fld = fld.next; } if (! fld) return false; this.parent.deleteColumn(col); //------- soft delete ------ // fld.isDeleted = true; // fld.name = '$$delete$$' + fld.name ; // return; //------ hard delete -------- if (prev) { prev.next = fld.next; if (fld.next) { this.selectedField = fld.next } else { this.selectedField = prev } } else { this.topField = fld.next; this.selectedField = fld.next; } fld = null; return true; } //======================================================================== // TABLE$fieldExists //======================================================================== function TABLE$fieldExists(name) { var f; f = this.findField(name); if (f) return true; return false; }