Commit 627a0f567b82e7aac380f62bf31b5d223e5216a9
1 parent
543da178
initial revisions of javascript includes
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@703 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
154 additions
and
0 deletions
presentation/lookAndFeel/knowledgeTree/js/misc.js
0 → 100644
| 1 | +function validateString(field, msg, min, max) { | ||
| 2 | + if (!min) { min = 1 } | ||
| 3 | + if (!max) { max = 65535 } | ||
| 4 | + | ||
| 5 | + if (!field.value || field.value.length < min || field.value.max > max) { | ||
| 6 | + alert(msg); | ||
| 7 | + field.focus(); | ||
| 8 | + field.select(); | ||
| 9 | + return false; | ||
| 10 | + } | ||
| 11 | + return true; | ||
| 12 | +} | ||
| 13 | + | ||
| 14 | +function validateNumber(field, msg, min, max) { | ||
| 15 | + if (!min) { min = 0 } | ||
| 16 | + if (!max) { max = 255 } | ||
| 17 | + | ||
| 18 | + if ( (parseInt(field.value) != field.value) || field.value.length < min || field.value.length > max) { | ||
| 19 | + alert(msg); | ||
| 20 | + field.focus(); | ||
| 21 | + field.select(); | ||
| 22 | + return false; | ||
| 23 | + } | ||
| 24 | + return true; | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +function setActionAndSubmit(newAction) { | ||
| 28 | + document.MainForm.action = newAction; | ||
| 29 | + document.MainForm.submit(); | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +function getStylesheet() { | ||
| 33 | + //document.write(\"<link rel=stylesheet type=\"text/css\" href=\"\");"; | ||
| 34 | + if (is_unix && is_nav) { | ||
| 35 | + return "css/ns_unix.css"; | ||
| 36 | + } else if (is_win && is_ie) { | ||
| 37 | + return "css/ie_win.css\"; | ||
| 38 | + } else { | ||
| 39 | + return "css/default.css\"; | ||
| 40 | + } | ||
| 41 | +} |
presentation/lookAndFeel/knowledgeTree/js/scroll.js
0 → 100644
| 1 | +/********************************************************************************** | ||
| 2 | +ScrollText | ||
| 3 | +* Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> | ||
| 4 | +* This script was released at DHTMLCentral.com | ||
| 5 | +* Visit for more great scripts! | ||
| 6 | +* This may be used and changed freely as long as this msg is intact! | ||
| 7 | +* We will also appreciate any links you could give us. | ||
| 8 | +* | ||
| 9 | +* Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> | ||
| 10 | +*********************************************************************************/ | ||
| 11 | + | ||
| 12 | +function lib_bwcheck(){ //Browsercheck (needed) | ||
| 13 | + this.ver=navigator.appVersion | ||
| 14 | + this.agent=navigator.userAgent | ||
| 15 | + this.dom=document.getElementById?1:0 | ||
| 16 | + this.opera5=this.agent.indexOf("Opera 5")>-1 | ||
| 17 | + this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; | ||
| 18 | + this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0; | ||
| 19 | + this.ie4=(document.all && !this.dom && !this.opera5)?1:0; | ||
| 20 | + this.ie=this.ie4||this.ie5||this.ie6 | ||
| 21 | + this.mac=this.agent.indexOf("Mac")>-1 | ||
| 22 | + this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; | ||
| 23 | + this.ns4=(document.layers && !this.dom)?1:0; | ||
| 24 | + this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5) | ||
| 25 | + return this | ||
| 26 | +} | ||
| 27 | +var bw=new lib_bwcheck() | ||
| 28 | + | ||
| 29 | + | ||
| 30 | +/***************** | ||
| 31 | + | ||
| 32 | +You set the width and height of the divs inside the style tag, you only have to | ||
| 33 | +change the divScrollTextCont, Remember to set the clip the same as the width and height. | ||
| 34 | +You can remove the divUp and divDown layers if you want. | ||
| 35 | +This script should also work if you make the divScrollTextCont position:relative. | ||
| 36 | +Then you should be able to place this inside a table or something. Just remember | ||
| 37 | +that Netscape crash very easily with relative positioned divs and tables. | ||
| 38 | + | ||
| 39 | +Updated with a fix for error if moving over layer before pageload. | ||
| 40 | + | ||
| 41 | +****************/ | ||
| 42 | + | ||
| 43 | + | ||
| 44 | +//If you want it to move faster you can set this lower, it's the timeout: | ||
| 45 | +var speed = 30 | ||
| 46 | + | ||
| 47 | +//Sets variables to keep track of what's happening | ||
| 48 | +var loop, timer | ||
| 49 | + | ||
| 50 | +//Object constructor | ||
| 51 | +function makeObj(obj,nest){ | ||
| 52 | + nest=(!nest) ? "":'document.'+nest+'.' | ||
| 53 | + this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; | ||
| 54 | + this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; | ||
| 55 | + this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight | ||
| 56 | + this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight | ||
| 57 | + this.up=goUp;this.down=goDown; | ||
| 58 | + this.moveIt=moveIt; this.x=0; this.y=0; | ||
| 59 | + this.obj = obj + "Object" | ||
| 60 | + eval(this.obj + "=this") | ||
| 61 | + return this | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +// A unit of measure that will be added when setting the position of a layer. | ||
| 65 | +var px = bw.ns4||window.opera?"":"px"; | ||
| 66 | + | ||
| 67 | +function moveIt(x,y){ | ||
| 68 | + this.x = x | ||
| 69 | + this.y = y | ||
| 70 | + this.css.left = this.x+px | ||
| 71 | + this.css.top = this.y+px | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +//Makes the object go up | ||
| 75 | +function goDown(move){ | ||
| 76 | + if (this.y>-this.scrollHeight+oCont.clipHeight){ | ||
| 77 | + this.moveIt(0,this.y-move) | ||
| 78 | + if (loop) setTimeout(this.obj+".down("+move+")",speed) | ||
| 79 | + } | ||
| 80 | +} | ||
| 81 | +//Makes the object go down | ||
| 82 | +function goUp(move){ | ||
| 83 | + if (this.y<0){ | ||
| 84 | + this.moveIt(0,this.y-move) | ||
| 85 | + if (loop) setTimeout(this.obj+".up("+move+")",speed) | ||
| 86 | + } | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | +//Calls the scrolling functions. Also checks whether the page is loaded or not. | ||
| 90 | +function scroll(speed){ | ||
| 91 | + if (scrolltextLoaded){ | ||
| 92 | + loop = true; | ||
| 93 | + if (speed>0) oScroll.down(speed) | ||
| 94 | + else oScroll.up(speed) | ||
| 95 | + } | ||
| 96 | +} | ||
| 97 | + | ||
| 98 | +//Stops the scrolling (called on mouseout) | ||
| 99 | +function noScroll(){ | ||
| 100 | + loop = false | ||
| 101 | + if (timer) clearTimeout(timer) | ||
| 102 | +} | ||
| 103 | +//Makes the object | ||
| 104 | +var scrolltextLoaded = false | ||
| 105 | +function scrolltextInit(){ | ||
| 106 | + oCont = new makeObj('divScrollTextCont') | ||
| 107 | + oScroll = new makeObj('divText','divScrollTextCont') | ||
| 108 | + oScroll.moveIt(0,0) | ||
| 109 | + oCont.css.visibility = "visible" | ||
| 110 | + scrolltextLoaded = true | ||
| 111 | +} | ||
| 112 | +//Call the init on page load if the browser is ok... | ||
| 113 | +if (bw.bw) onload = scrolltextInit |