init web ems all

This commit is contained in:
agtuser committed 2024-09-27 17:13:36 +08:00
1 parent 81c97acbe9
commit 5cc56f8078
4263 files changed
+798779

No files matched your search

+64
View File
@@ -0,0 +1,64 @@
<script language="JavaScript">
function beginDrag(elementToDrag,event)
{
var deltaX=event.clientX-parseInt(elementToDrag.style.left);
var deltaY=event.clientY-parseInt(elementToDrag.style.top);
if(document.addEventListener)
{
document.addEventListener("mousemove",moveHandler,true);
document.addEventListener("mouseup",upHandler,true);
}
else if(document.attachEvent)
{
document.attachEvent("onmousemove",moveHandler);
document.attachEvent("onmouseup",upHandler);
}
if(event.stopPropagation)
event.stopPropagation();
else
event.cancelBubble=true;
if(event.preventDefault)
event.preventDefault();
else
event.returnValue=false;
function moveHandler(e)
{
  if (!e) e=window.event; //如果是IE的事件对象,那么就用window.event
  //全局属性,否则就用DOM二级标准的Event对象。
elementToDrag.style.left=(event.clientX-deltaX)+"px";
elementToDrag.style.top=(event.clientY-deltaY)+"px";
if(event.stopPropagation)
event.stopPropagation();
else
event.cancelBubble=true;
}
function upHandler(e)
{
if(document.removeEventListener)
{
document.removeEventListener("mouseup",upHandler,true);
document.removeEventListener("mousemove",moveHandler,true);
}
else
{
document.detachEvent("onmouseup",upHandler);
document.detachEvent("onmousemove",moveHandler);
}
window.location.href='./mapStatus.php?command=save&drag_x='+elementToDrag.style.left+"&drag_y="+elementToDrag.style.top+"&drag_key_led_num="+elementToDrag.id+"&needDragElement="+needDragElement+"&showingPageType="+showingPageType+"&typeOffset="+typeOffset+"&maxPageNum="+maxPageNum+"&maxLedNum="+maxLedNum+"&bg_img="+bg_img;
}
if(event.stopPropagation)
event.stopPropagation();
else
event.cancelBubble=true;
}
</script>
+64
View File
@@ -0,0 +1,64 @@
<script language="JavaScript">
function beginDrag(elementToDrag,event)
{
var deltaX=event.clientX-parseInt(elementToDrag.style.left);
var deltaY=event.clientY-parseInt(elementToDrag.style.top);
if(document.addEventListener)
{
document.addEventListener("mousemove",moveHandler,true);
document.addEventListener("mouseup",upHandler,true);
}
else if(document.attachEvent)
{
document.attachEvent("onmousemove",moveHandler);
document.attachEvent("onmouseup",upHandler);
}
if(event.stopPropagation)
event.stopPropagation();
else
event.cancelBubble=true;
if(event.preventDefault)
event.preventDefault();
else
event.returnValue=false;
function moveHandler(e)
{
  if (!e) e=window.event; //如果是IE的事件对象,那么就用window.event
  //全局属性,否则就用DOM二级标准的Event对象。
elementToDrag.style.left=(event.clientX-deltaX)+"px";
elementToDrag.style.top=(event.clientY-deltaY)+"px";
if(event.stopPropagation)
event.stopPropagation();
else
event.cancelBubble=true;
}
function upHandler(e)
{
if(document.removeEventListener)
{
document.removeEventListener("mouseup",upHandler,true);
document.removeEventListener("mousemove",moveHandler,true);
}
else
{
document.detachEvent("onmouseup",upHandler);
document.detachEvent("onmousemove",moveHandler);
}
window.location.href='./mapStatus_test.php?command=save&drag_x='+elementToDrag.style.left+"&drag_y="+elementToDrag.style.top+"&drag_key_led_num="+elementToDrag.id+"&needDragElement="+needDragElement+"&showingPageType="+showingPageType+"&typeOffset="+typeOffset+"&maxPageNum="+maxPageNum+"&maxLedNum="+maxLedNum+"&bg_img="+bg_img;
}
if(event.stopPropagation)
event.stopPropagation();
else
event.cancelBubble=true;
}
</script>
+57
View File
@@ -0,0 +1,57 @@
function beginDrag(elementToDrag,event)
{
var deltaX=event.clientX-parseInt(elementToDrag.style.left);
var deltaY=event.clientY-parseInt(elementToDrag.style.top);
if(document.addEventListener)
{
document.addEventListener("mousemove",moveHandler,true);
document.addEventListener("mouseup",upHandler,true);
}
else if(document.attachEvent)
{
document.attachEvent("onmousemove",moveHandler);
document.attachEvent("onmouseup",upHandler);
}
if(event.stopPropagation)
event.stopPropagation();
else
event.cancelBubble=true;
if(event.preventDefault)
event.preventDefault();
else
event.returnValue=false;
function moveHandler(e)
{
  if (!e) e=window.event; //如果是IE的事件对象,那么就用window.event
  //全局属性,否则就用DOM二级标准的Event对象。
elementToDrag.style.left=(event.clientX-deltaX)+"px";
elementToDrag.style.top=(event.clientY-deltaY)+"px";
if(event.stopPropagation)
event.stopPropagation();
else
event.cancelBubble=true;
}
function upHandler(e)
{
if(document.removeEventListener)
{
document.removeEventListener("mouseup",upHandler,true);
document.removeEventListener("mousemove",moveHandler,true);
}
else
{
document.detachEvent("onmouseup",upHandler);
document.detachEvent("onmousemove",moveHandler);}
}
if(event.stopPropagation)
event.stopPropagation();
else
event.cancelBubble=true;
}
+72
View File
@@ -0,0 +1,72 @@
<style>
<!--.drag{position:relative;cursor:hand}
-->
</style>
<script language="JavaScript">
var dragapproved=false
var z,x,y
var browser = navigator.appName; //find the browser name
if(browser == "Microsoft Internet Explorer"){
IE=1
}else{
IE=0
}
//alert(IE)
function move(){
if (event.button==1&&dragapproved){
z.style.pixelLeft=temp1+event.clientX-x
z.style.pixelTop=temp2+event.clientY-y
return false
}
}
function drags(){
//if (!document.all)
// return
dragapproved=true
if(IE){
z=event.srcElement
alert(z)
}else{
var node=this.parentNode;
//node=node.parentNode;
alert(node.id);
//alert(node.nodeType);
//alert(node.id);
//while(node.nodeType!=1){
// alert('11')
// node=node.parentNode;
//}
//alert('22')
//alert(node);
}
while (z.id.indexOf("statusLed") == -1) {//check the z if it's led
z = z.parentElement;
if (z == null) {
return true;
}
}
temp1=z.style.pixelLeft
temp2=z.style.pixelTop
x=event.clientX
y=event.clientY
document.onmousemove=move
}
function dropDrags() {
dragapproved=false
window.location.href='./mapStatus.php?command=save&drag_x='+z.style.pixelLeft+"&drag_y="+z.style.pixelTop+"&drag_key_led_num="+z.id
z = null;
return true
}
document.onmousedown=drags
document.onmouseup=dropDrags
</script>
+107
View File
@@ -0,0 +1,107 @@
<?php
?>
<script language=JavaScript>
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
function heartBeat() {
if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
if(diffY != lastScrollY) {
percent = .1 * (diffY - lastScrollY);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelTop += percent;
if(NS) document.floater.top += percent;
lastScrollY = lastScrollY + percent;
}
if(diffX != lastScrollX) {
percent = .1 * (diffX - lastScrollX);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelLeft += percent;
if(NS) document.floater.left += percent;
lastScrollX = lastScrollX + percent;
}
}
function checkFocus(x,y) {
stalkerx = document.floater.pageX;
stalkery = document.floater.pageY;
stalkerwidth = document.floater.clip.width;
stalkerheight = document.floater.clip.height;
if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true;
else return false;
}
function grabIt(e) {
if(IE) {
whichIt = event.srcElement;
while (whichIt.id.indexOf("floater") == -1) {
whichIt = whichIt.parentElement;
if (whichIt == null) { return true; }
}
whichIt.style.pixelLeft = whichIt.offsetLeft;
whichIt.style.pixelTop = whichIt.offsetTop;
currentX = (event.clientX + document.body.scrollLeft);
currentY = (event.clientY + document.body.scrollTop);
} else {
window.captureEvents(Event.MOUSEMOVE);
if(checkFocus (e.pageX,e.pageY)) {
whichIt = document.floater;
StalkerTouchedX = e.pageX-document.floater.pageX;
StalkerTouchedY = e.pageY-document.floater.pageY;
}
}
return true;
}
function moveIt(e) {
if (whichIt == null) { return false; }
if(IE) {
newX = (event.clientX + document.body.scrollLeft);
newY = (event.clientY + document.body.scrollTop);
distanceX = (newX - currentX); distanceY = (newY - currentY);
currentX = newX; currentY = newY;
whichIt.style.pixelLeft += distanceX;
whichIt.style.pixelTop += distanceY;
if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;
if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft;
if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;
if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;
event.returnValue = false;
} else {
whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);
if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;
if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;
if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;
if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;
return false;
}
return false;
}
function dropIt() {
whichIt = null;
if(NS) window.releaseEvents (Event.MOUSEMOVE);
return true;
}
if(NS) {
window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);
window.onmousedown = grabIt;
window.onmousemove = moveIt;
window.onmouseup = dropIt;
}
if(IE) {
document.onmousedown = grabIt;
document.onmousemove = moveIt;
document.onmouseup = dropIt;
}
if(NS || IE) action = window.setInterval("heartBeat()",1);
</script>
+758
View File
@@ -0,0 +1,758 @@
<script language="JavaScript" type="Text/JavaScript">
<!--
if(window.Event){// 修正Event的DOM
/*
IE5 MacIE5 Mozilla Konqueror2.2 Opera5
event yes yes yes yes yes
event.returnValue yes yes no no no
event.cancelBubble yes yes no no no
event.srcElement yes yes no no no
event.fromElement yes yes no no no
*/
Event.prototype.__defineSetter__("returnValue",function(b){//
if(!b)this.preventDefault();
return b;
});
Event.prototype.__defineSetter__("cancelBubble",function(b){// 设置或者检索当前事件句柄的层次冒泡
if(b)this.stopPropagation();
return b;
});
Event.prototype.__defineGetter__("srcElement",function(){
var node=this.target;
while(node.nodeType!=1)node=node.parentNode;
alert(node);
return node;
});
Event.prototype.__defineGetter__("fromElement",function(){// 返回鼠标移出的源节点
var node;
if(this.type=="mouseover")
node=this.relatedTarget;
else if(this.type=="mouseout")
node=this.target;
if(!node)return;
while(node.nodeType!=1)node=node.parentNode;
return node;
});
Event.prototype.__defineGetter__("toElement",function(){// 返回鼠标移入的源节点
var node;
if(this.type=="mouseout")
node=this.relatedTarget;
else if(this.type=="mouseover")
node=this.target;
if(!node)return;
while(node.nodeType!=1)node=node.parentNode;
return node;
});
Event.prototype.__defineGetter__("offsetX",function(){
return this.layerX;
});
Event.prototype.__defineGetter__("offsetY",function(){
return this.layerY;
});
}
if(window.Document){// 修正Document的DOM
/*
IE5 MacIE5 Mozilla Konqueror2.2 Opera5
document.documentElement yes yes yes yes no
document.activeElement yes null no no no
*/
}
if(window.Node){// 修正Node的DOM
/*
IE5 MacIE5 Mozilla Konqueror2.2 Opera5
Node.contains yes yes no no yes
Node.replaceNode yes no no no no
Node.removeNode yes no no no no
Node.children yes yes no no no
Node.hasChildNodes yes yes yes yes no
Node.childNodes yes yes yes yes no
Node.swapNode yes no no no no
Node.currentStyle yes yes no no no
*/
Node.prototype.replaceNode=function(Node){// 替换指定节点
this.parentNode.replaceChild(Node,this);
}
Node.prototype.removeNode=function(removeChildren){// 删除指定节点
if(removeChildren)
return this.parentNode.removeChild(this);
else{
var range=document.createRange();
range.selectNodeContents(this);
return this.parentNode.replaceChild(range.extractContents(),this);
}
}
Node.prototype.swapNode=function(Node){// 交换节点
var nextSibling=this.nextSibling;
var parentNode=this.parentNode;
node.parentNode.replaceChild(this,Node);
parentNode.insertBefore(node,nextSibling);
}
}
if(window.HTMLElement){
HTMLElement.prototype.__defineGetter__("all",function(){
var a=this.getElementsByTagName("*");
var node=this;
a.tags=function(sTagName){
return node.getElementsByTagName(sTagName);
}
return a;
});
HTMLElement.prototype.__defineGetter__("parentElement",function(){
if(this.parentNode==this.ownerDocument)return null;
return this.parentNode;
});
HTMLElement.prototype.__defineGetter__("children",function(){
var tmp=[];
var j=0;
var n;
for(var i=0;i<this.childNodes.length;i++){
n=this.childNodes[i];
if(n.nodeType==1){
tmp[j++]=n;
if(n.name){
if(!tmp[n.name])
tmp[n.name]=[];
tmp[n.name][tmp[n.name].length]=n;
}
if(n.id)
tmp[n.id]=n;
}
}
return tmp;
});
HTMLElement.prototype.__defineGetter__("currentStyle", function(){
return this.ownerDocument.defaultView.getComputedStyle(this,null);
});
HTMLElement.prototype.__defineSetter__("outerHTML",function(sHTML){
var r=this.ownerDocument.createRange();
r.setStartBefore(this);
var df=r.createContextualFragment(sHTML);
this.parentNode.replaceChild(df,this);
return sHTML;
});
HTMLElement.prototype.__defineGetter__("outerHTML",function(){
var attr;
var attrs=this.attributes;
var str="<"+this.tagName;
for(var i=0;i<attrs.length;i++){
attr=attrs[i];
if(attr.specified)
str+=" "+attr.name+'="'+attr.value+'"';
}
if(!this.canHaveChildren)
return str+">";
return str+">"+this.innerHTML+"</"+this.tagName+">";
});
HTMLElement.prototype.__defineGetter__("canHaveChildren",function(){
switch(this.tagName.toLowerCase()){
case "area":
case "base":
case "basefont":
case "col":
case "frame":
case "hr":
case "img":
case "br":
case "input":
case "isindex":
case "link":
case "meta":
case "param":
return false;
}
return true;
});
HTMLElement.prototype.__defineSetter__("innerText",function(sText){
var parsedText=document.createTextNode(sText);
this.innerHTML=parsedText;
return parsedText;
});
HTMLElement.prototype.__defineGetter__("innerText",function(){
var r=this.ownerDocument.createRange();
r.selectNodeContents(this);
return r.toString();
});
HTMLElement.prototype.__defineSetter__("outerText",function(sText){
var parsedText=document.createTextNode(sText);
this.outerHTML=parsedText;
return parsedText;
});
HTMLElement.prototype.__defineGetter__("outerText",function(){
var r=this.ownerDocument.createRange();
r.selectNodeContents(this);
return r.toString();
});
HTMLElement.prototype.attachEvent=function(sType,fHandler){
var shortTypeName=sType.replace(/on/,"");
fHandler._ieEmuEventHandler=function(e){
window.event=e;
return fHandler();
}
this.addEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
}
HTMLElement.prototype.detachEvent=function(sType,fHandler){
var shortTypeName=sType.replace(/on/,"");
if(typeof(fHandler._ieEmuEventHandler)=="function")
this.removeEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
else
this.removeEventListener(shortTypeName,fHandler,true);
}
HTMLElement.prototype.contains=function(Node){// 是否包含某节点
do if(Node==this)return true;
while(Node=Node.parentNode);
return false;
}
HTMLElement.prototype.insertAdjacentElement=function(where,parsedNode){
switch(where){
case "beforeBegin":
this.parentNode.insertBefore(parsedNode,this);
break;
case "afterBegin":
this.insertBefore(parsedNode,this.firstChild);
break;
case "beforeEnd":
this.appendChild(parsedNode);
break;
case "afterEnd":
if(this.nextSibling)
this.parentNode.insertBefore(parsedNode,this.nextSibling);
else
this.parentNode.appendChild(parsedNode);
break;
}
}
HTMLElement.prototype.insertAdjacentHTML=function(where,htmlStr){
var r=this.ownerDocument.createRange();
r.setStartBefore(this);
var parsedHTML=r.createContextualFragment(htmlStr);
this.insertAdjacentElement(where,parsedHTML);
}
HTMLElement.prototype.insertAdjacentText=function(where,txtStr){
var parsedText=document.createTextNode(txtStr);
this.insertAdjacentElement(where,parsedText);
}
HTMLElement.prototype.attachEvent=function(sType,fHandler){
var shortTypeName=sType.replace(/on/,"");
fHandler._ieEmuEventHandler=function(e){
window.event=e;
return fHandler();
}
this.addEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
}
HTMLElement.prototype.detachEvent=function(sType,fHandler){
var shortTypeName=sType.replace(/on/,"");
if(typeof(fHandler._ieEmuEventHandler)=="function")
this.removeEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
else
this.removeEventListener(shortTypeName,fHandler,true);
}
}
//-->
</script>
+14
View File
@@ -0,0 +1,14 @@
<html>
 <head>
  <title>Untitled Page</title>
  <script type="text/javascript" src="dragIE.js"></script>
 </head>
 <body>
 <div id="2222" style="position:absolute;left:100px;top:100px;background-color:White;border:solid black;">
  <div style="background-color:Gray;border-bottom:solid black;padding:3px;font-family:Sans-Serif;font-weight:bold;" onmousedown="beginDrag(this.parentNode,event);">
  拖动我&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  </div>
  <div>
  <p>This is a test.Testing,testing</p></div>
 </div>
 </body>
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

+944
View File
@@ -0,0 +1,944 @@
<script language="JavaScript">␍
/* This notice must be untouched at all times.␍
␍
wz_jsgraphics.js v. 2.36␍
The latest version is available at␍
http://www.walterzorn.com␍
or http://www.devira.com␍
or http://www.walterzorn.de␍
␍
Copyright (c) 2002-2004 Walter Zorn. All rights reserved.␍
Created 3. 11. 2002 by Walter Zorn (Web: http://www.walterzorn.com )␍
Last modified: 21. 6. 2006␍
␍
Performance optimizations for Internet Explorer␍
by Thomas Frank and John Holdsworth.␍
fillPolygon method implemented by Matthieu Haller.␍
␍
High Performance JavaScript Graphics Library.␍
Provides methods␍
- to draw lines, rectangles, ellipses, polygons␍
with specifiable line thickness,␍
- to fill rectangles and ellipses␍
- to draw text.␍
NOTE: Operations, functions and branching have rather been optimized␍
to efficiency and speed than to shortness of source code.␍
␍
LICENSE: LGPL␍
␍
This library is free software; you can redistribute it and/or␍
modify it under the terms of the GNU Lesser General Public␍
License (LGPL) as published by the Free Software Foundation; either␍
version 2.1 of the License, or (at your option) any later version.␍
␍
This library 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␍
Lesser General Public License for more details.␍
␍
You should have received a copy of the GNU Lesser General Public␍
License along with this library; if not, write to the Free Software␍
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA,␍
or see http://www.gnu.org/copyleft/lesser.html␍
*/␍
␍
␍
var jg_ihtm, jg_ie, jg_fast, jg_dom, jg_moz,␍
jg_n4 = (document.layers && typeof document.classes != "undefined");␍
␍
␍
function chkDHTM(x, i)␍
{␍
x = document.body || null;␍
jg_ie = x && typeof x.insertAdjacentHTML != "undefined";␍
jg_dom = (x && !jg_ie &&␍
typeof x.appendChild != "undefined" &&␍
typeof document.createRange != "undefined" &&␍
typeof (i = document.createRange()).setStartBefore != "undefined" &&␍
typeof i.createContextualFragment != "undefined");␍
jg_ihtm = !jg_ie && !jg_dom && x && typeof x.innerHTML != "undefined";␍
jg_fast = jg_ie && document.all && !window.opera;␍
jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined";␍
}␍
␍
␍
function pntDoc()␍
{␍
this.wnd.document.write(jg_fast? this.htmRpc() : this.htm);␍
this.htm = '';␍
}␍
␍
␍
function pntCnvDom()␍
{␍
var x = this.wnd.document.createRange();␍
x.setStartBefore(this.cnv);␍
x = x.createContextualFragment(jg_fast? this.htmRpc() : this.htm);␍
if(this.cnv) this.cnv.appendChild(x);␍
this.htm = '';␍
}␍
␍
␍
function pntCnvIe()␍
{␍
if(this.cnv) this.cnv.insertAdjacentHTML("BeforeEnd", jg_fast? this.htmRpc() : this.htm);␍
this.htm = '';␍
}␍
␍
␍
function pntCnvIhtm()␍
{␍
if(this.cnv) this.cnv.innerHTML += this.htm;␍
this.htm = '';␍
}␍
␍
␍
function pntCnv()␍
{␍
this.htm = '';␍
}␍
␍
␍
function mkDiv(x, y, w, h)␍
{␍
this.htm += '<div style="position:absolute;'+␍
'left:' + x + 'px;'+␍
'top:' + y + 'px;'+␍
'width:' + w + 'px;'+␍
'height:' + h + 'px;'+␍
'clip:rect(0,'+w+'px,'+h+'px,0);'+␍
'background-color:' + this.color +␍
(!jg_moz? ';overflow:hidden' : '')+␍
';"><\/div>';␍
}␍
␍
␍
function mkDivIe(x, y, w, h)␍
{␍
this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';';␍
}␍
␍
␍
function mkDivPrt(x, y, w, h)␍
{␍
this.htm += '<div style="position:absolute;'+␍
'border-left:' + w + 'px solid ' + this.color + ';'+␍
'left:' + x + 'px;'+␍
'top:' + y + 'px;'+␍
'width:0px;'+␍
'height:' + h + 'px;'+␍
'clip:rect(0,'+w+'px,'+h+'px,0);'+␍
'background-color:' + this.color +␍
(!jg_moz? ';overflow:hidden' : '')+␍
';"><\/div>';␍
}␍
␍
␍
function mkLyr(x, y, w, h)␍
{␍
this.htm += '<layer '+␍
'left="' + x + '" '+␍
'top="' + y + '" '+␍
'width="' + w + '" '+␍
'height="' + h + '" '+␍
'bgcolor="' + this.color + '"><\/layer>\n';␍
}␍
␍
␍
var regex = /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;␍
function htmRpc()␍
{␍
return this.htm.replace(␍
regex,␍
'<div style="overflow:hidden;position:absolute;background-color:'+␍
'$1;left:$2;top:$3;width:$4;height:$5"></div>\n');␍
}␍
␍
␍
function htmPrtRpc()␍
{␍
return this.htm.replace(␍
regex,␍
'<div style="overflow:hidden;position:absolute;background-color:'+␍
'$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n');␍
}␍
␍
␍
function mkLin(x1, y1, x2, y2)␍
{␍
if (x1 > x2)␍
{␍
var _x2 = x2;␍
var _y2 = y2;␍
x2 = x1;␍
y2 = y1;␍
x1 = _x2;␍
y1 = _y2;␍
}␍
var dx = x2-x1, dy = Math.abs(y2-y1),␍
x = x1, y = y1,␍
yIncr = (y1 > y2)? -1 : 1;␍
␍
if (dx >= dy)␍
{␍
var pr = dy<<1,␍
pru = pr - (dx<<1),␍
p = pr-dx,␍
ox = x;␍
while ((dx--) > 0)␍
{␍
++x;␍
if (p > 0)␍
{␍
this.mkDiv(ox, y, x-ox, 1);␍
y += yIncr;␍
p += pru;␍
ox = x;␍
}␍
else p += pr;␍
}␍
this.mkDiv(ox, y, x2-ox+1, 1);␍
}␍
␍
else␍
{␍
var pr = dx<<1,␍
pru = pr - (dy<<1),␍
p = pr-dy,␍
oy = y;␍
if (y2 <= y1)␍
{␍
while ((dy--) > 0)␍
{␍
if (p > 0)␍
{␍
this.mkDiv(x++, y, 1, oy-y+1);␍
y += yIncr;␍
p += pru;␍
oy = y;␍
}␍
else␍
{␍
y += yIncr;␍
p += pr;␍
}␍
}␍
this.mkDiv(x2, y2, 1, oy-y2+1);␍
}␍
else␍
{␍
while ((dy--) > 0)␍
{␍
y += yIncr;␍
if (p > 0)␍
{␍
this.mkDiv(x++, oy, 1, y-oy);␍
p += pru;␍
oy = y;␍
}␍
else p += pr;␍
}␍
this.mkDiv(x2, oy, 1, y2-oy+1);␍
}␍
}␍
}␍
␍
␍
function mkLin2D(x1, y1, x2, y2)␍
{␍
if (x1 > x2)␍
{␍
var _x2 = x2;␍
var _y2 = y2;␍
x2 = x1;␍
y2 = y1;␍
x1 = _x2;␍
y1 = _y2;␍
}␍
var dx = x2-x1, dy = Math.abs(y2-y1),␍
x = x1, y = y1,␍
yIncr = (y1 > y2)? -1 : 1;␍
␍
var s = this.stroke;␍
if (dx >= dy)␍
{␍
if (dx > 0 && s-3 > 0)␍
{␍
var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx;␍
_s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;␍
}␍
else var _s = s;␍
var ad = Math.ceil(s/2);␍
␍
var pr = dy<<1,␍
pru = pr - (dx<<1),␍
p = pr-dx,␍
ox = x;␍
while ((dx--) > 0)␍
{␍
++x;␍
if (p > 0)␍
{␍
this.mkDiv(ox, y, x-ox+ad, _s);␍
y += yIncr;␍
p += pru;␍
ox = x;␍
}␍
else p += pr;␍
}␍
this.mkDiv(ox, y, x2-ox+ad+1, _s);␍
}␍
␍
else␍
{␍
if (s-3 > 0)␍
{␍
var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy;␍
_s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;␍
}␍
else var _s = s;␍
var ad = Math.round(s/2);␍
␍
var pr = dx<<1,␍
pru = pr - (dy<<1),␍
p = pr-dy,␍
oy = y;␍
if (y2 <= y1)␍
{␍
++ad;␍
while ((dy--) > 0)␍
{␍
if (p > 0)␍
{␍
this.mkDiv(x++, y, _s, oy-y+ad);␍
y += yIncr;␍
p += pru;␍
oy = y;␍
}␍
else␍
{␍
y += yIncr;␍
p += pr;␍
}␍
}␍
this.mkDiv(x2, y2, _s, oy-y2+ad);␍
}␍
else␍
{␍
while ((dy--) > 0)␍
{␍
y += yIncr;␍
if (p > 0)␍
{␍
this.mkDiv(x++, oy, _s, y-oy+ad);␍
p += pru;␍
oy = y;␍
}␍
else p += pr;␍
}␍
this.mkDiv(x2, oy, _s, y2-oy+ad+1);␍
}␍
}␍
}␍
␍
␍
function mkLinDott(x1, y1, x2, y2)␍
{␍
if (x1 > x2)␍
{␍
var _x2 = x2;␍
var _y2 = y2;␍
x2 = x1;␍
y2 = y1;␍
x1 = _x2;␍
y1 = _y2;␍
}␍
var dx = x2-x1, dy = Math.abs(y2-y1),␍
x = x1, y = y1,␍
yIncr = (y1 > y2)? -1 : 1,␍
drw = true;␍
if (dx >= dy)␍
{␍
var pr = dy<<1,␍
pru = pr - (dx<<1),␍
p = pr-dx;␍
while ((dx--) > 0)␍
{␍
if (drw) this.mkDiv(x, y, 1, 1);␍
drw = !drw;␍
if (p > 0)␍
{␍
y += yIncr;␍
p += pru;␍
}␍
else p += pr;␍
++x;␍
}␍
if (drw) this.mkDiv(x, y, 1, 1);␍
}␍
␍
else␍
{␍
var pr = dx<<1,␍
pru = pr - (dy<<1),␍
p = pr-dy;␍
while ((dy--) > 0)␍
{␍
if (drw) this.mkDiv(x, y, 1, 1);␍
drw = !drw;␍
y += yIncr;␍
if (p > 0)␍
{␍
++x;␍
p += pru;␍
}␍
else p += pr;␍
}␍
if (drw) this.mkDiv(x, y, 1, 1);␍
}␍
}␍
␍
␍
function mkOv(left, top, width, height)␍
{␍
var a = width>>1, b = height>>1,␍
wod = width&1, hod = (height&1)+1,␍
cx = left+a, cy = top+b,␍
x = 0, y = b,␍
ox = 0, oy = b,␍
aa = (a*a)<<1, bb = (b*b)<<1,␍
st = (aa>>1)*(1-(b<<1)) + bb,␍
tt = (bb>>1) - aa*((b<<1)-1),␍
w, h;␍
while (y > 0)␍
{␍
if (st < 0)␍
{␍
st += bb*((x<<1)+3);␍
tt += (bb<<1)*(++x);␍
}␍
else if (tt < 0)␍
{␍
st += bb*((x<<1)+3) - (aa<<1)*(y-1);␍
tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);␍
w = x-ox;␍
h = oy-y;␍
if (w&2 && h&2)␍
{␍
this.mkOvQds(cx, cy, -x+2, ox+wod, -oy, oy-1+hod, 1, 1);␍
this.mkOvQds(cx, cy, -x+1, x-1+wod, -y-1, y+hod, 1, 1);␍
}␍
else this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, oy-h+hod, w, h);␍
ox = x;␍
oy = y;␍
}␍
else␍
{␍
tt -= aa*((y<<1)-3);␍
st -= (aa<<1)*(--y);␍
}␍
}␍
this.mkDiv(cx-a, cy-oy, a-ox+1, (oy<<1)+hod);␍
this.mkDiv(cx+ox+wod, cy-oy, a-ox+1, (oy<<1)+hod);␍
}␍
␍
␍
function mkOv2D(left, top, width, height)␍
{␍
var s = this.stroke;␍
width += s-1;␍
height += s-1;␍
var a = width>>1, b = height>>1,␍
wod = width&1, hod = (height&1)+1,␍
cx = left+a, cy = top+b,␍
x = 0, y = b,␍
aa = (a*a)<<1, bb = (b*b)<<1,␍
st = (aa>>1)*(1-(b<<1)) + bb,␍
tt = (bb>>1) - aa*((b<<1)-1);␍
␍
if (s-4 < 0 && (!(s-2) || width-51 > 0 && height-51 > 0))␍
{␍
var ox = 0, oy = b,␍
w, h,␍
pxl, pxr, pxt, pxb, pxw;␍
while (y > 0)␍
{␍
if (st < 0)␍
{␍
st += bb*((x<<1)+3);␍
tt += (bb<<1)*(++x);␍
}␍
else if (tt < 0)␍
{␍
st += bb*((x<<1)+3) - (aa<<1)*(y-1);␍
tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);␍
w = x-ox;␍
h = oy-y;␍
␍
if (w-1)␍
{␍
pxw = w+1+(s&1);␍
h = s;␍
}␍
else if (h-1)␍
{␍
pxw = s;␍
h += 1+(s&1);␍
}␍
else pxw = h = s;␍
this.mkOvQds(cx, cy, -x+1, ox-pxw+w+wod, -oy, -h+oy+hod, pxw, h);␍
ox = x;␍
oy = y;␍
}␍
else␍
{␍
tt -= aa*((y<<1)-3);␍
st -= (aa<<1)*(--y);␍
}␍
}␍
this.mkDiv(cx-a, cy-oy, s, (oy<<1)+hod);␍
this.mkDiv(cx+a+wod-s+1, cy-oy, s, (oy<<1)+hod);␍
}␍
␍
else␍
{␍
var _a = (width-((s-1)<<1))>>1,␍
_b = (height-((s-1)<<1))>>1,␍
_x = 0, _y = _b,␍
_aa = (_a*_a)<<1, _bb = (_b*_b)<<1,␍
_st = (_aa>>1)*(1-(_b<<1)) + _bb,␍
_tt = (_bb>>1) - _aa*((_b<<1)-1),␍
␍
pxl = new Array(),␍
pxt = new Array(),␍
_pxb = new Array();␍
pxl[0] = 0;␍
pxt[0] = b;␍
_pxb[0] = _b-1;␍
while (y > 0)␍
{␍
if (st < 0)␍
{␍
st += bb*((x<<1)+3);␍
tt += (bb<<1)*(++x);␍
pxl[pxl.length] = x;␍
pxt[pxt.length] = y;␍
}␍
else if (tt < 0)␍
{␍
st += bb*((x<<1)+3) - (aa<<1)*(y-1);␍
tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);␍
pxl[pxl.length] = x;␍
pxt[pxt.length] = y;␍
}␍
else␍
{␍
tt -= aa*((y<<1)-3);␍
st -= (aa<<1)*(--y);␍
}␍
␍
if (_y > 0)␍
{␍
if (_st < 0)␍
{␍
_st += _bb*((_x<<1)+3);␍
_tt += (_bb<<1)*(++_x);␍
_pxb[_pxb.length] = _y-1;␍
}␍
else if (_tt < 0)␍
{␍
_st += _bb*((_x<<1)+3) - (_aa<<1)*(_y-1);␍
_tt += (_bb<<1)*(++_x) - _aa*(((_y--)<<1)-3);␍
_pxb[_pxb.length] = _y-1;␍
}␍
else␍
{␍
_tt -= _aa*((_y<<1)-3);␍
_st -= (_aa<<1)*(--_y);␍
_pxb[_pxb.length-1]--;␍
}␍
}␍
}␍
␍
var ox = 0, oy = b,␍
_oy = _pxb[0],␍
l = pxl.length,␍
w, h;␍
for (var i = 0; i < l; i++)␍
{␍
if (typeof _pxb[i] != "undefined")␍
{␍
if (_pxb[i] < _oy || pxt[i] < oy)␍
{␍
x = pxl[i];␍
this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, _oy+hod, x-ox, oy-_oy);␍
ox = x;␍
oy = pxt[i];␍
_oy = _pxb[i];␍
}␍
}␍
else␍
{␍
x = pxl[i];␍
this.mkDiv(cx-x+1, cy-oy, 1, (oy<<1)+hod);␍
this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);␍
ox = x;␍
oy = pxt[i];␍
}␍
}␍
this.mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod);␍
this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);␍
}␍
}␍
␍
␍
function mkOvDott(left, top, width, height)␍
{␍
var a = width>>1, b = height>>1,␍
wod = width&1, hod = height&1,␍
cx = left+a, cy = top+b,␍
x = 0, y = b,␍
aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1,␍
st = (aa2>>1)*(1-(b<<1)) + bb,␍
tt = (bb>>1) - aa2*((b<<1)-1),␍
drw = true;␍
while (y > 0)␍
{␍
if (st < 0)␍
{␍
st += bb*((x<<1)+3);␍
tt += (bb<<1)*(++x);␍
}␍
else if (tt < 0)␍
{␍
st += bb*((x<<1)+3) - aa4*(y-1);␍
tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3);␍
}␍
else␍
{␍
tt -= aa2*((y<<1)-3);␍
st -= aa4*(--y);␍
}␍
if (drw) this.mkOvQds(cx, cy, -x, x+wod, -y, y+hod, 1, 1);␍
drw = !drw;␍
}␍
}␍
␍
␍
function mkRect(x, y, w, h)␍
{␍
var s = this.stroke;␍
this.mkDiv(x, y, w, s);␍
this.mkDiv(x+w, y, s, h);␍
this.mkDiv(x, y+h, w+s, s);␍
this.mkDiv(x, y+s, s, h-s);␍
}␍
␍
␍
function mkRectDott(x, y, w, h)␍
{␍
this.drawLine(x, y, x+w, y);␍
this.drawLine(x+w, y, x+w, y+h);␍
this.drawLine(x, y+h, x+w, y+h);␍
this.drawLine(x, y, x, y+h);␍
}␍
␍
␍
function jsgFont()␍
{␍
this.PLAIN = 'font-weight:normal;';␍
this.BOLD = 'font-weight:bold;';␍
this.ITALIC = 'font-style:italic;';␍
this.ITALIC_BOLD = this.ITALIC + this.BOLD;␍
this.BOLD_ITALIC = this.ITALIC_BOLD;␍
}␍
var Font = new jsgFont();␍
␍
␍
function jsgStroke()␍
{␍
this.DOTTED = -1;␍
}␍
var Stroke = new jsgStroke();␍
␍
␍
function jsGraphics(id, wnd)␍
{␍
this.setColor = new Function('arg', 'this.color = arg.toLowerCase();');␍
␍
this.setStroke = function(x)␍
{␍
this.stroke = x;␍
if (!(x+1))␍
{␍
this.drawLine = mkLinDott;␍
this.mkOv = mkOvDott;␍
this.drawRect = mkRectDott;␍
}␍
else if (x-1 > 0)␍
{␍
this.drawLine = mkLin2D;␍
this.mkOv = mkOv2D;␍
this.drawRect = mkRect;␍
}␍
else␍
{␍
this.drawLine = mkLin;␍
this.mkOv = mkOv;␍
this.drawRect = mkRect;␍
}␍
};␍
␍
␍
this.setPrintable = function(arg)␍
{␍
this.printable = arg;␍
if (jg_fast)␍
{␍
this.mkDiv = mkDivIe;␍
this.htmRpc = arg? htmPrtRpc : htmRpc;␍
}␍
else this.mkDiv = jg_n4? mkLyr : arg? mkDivPrt : mkDiv;␍
};␍
␍
␍
this.setFont = function(fam, sz, sty)␍
{␍
this.ftFam = fam;␍
this.ftSz = sz;␍
this.ftSty = sty || Font.PLAIN;␍
};␍
␍
␍
this.drawPolyline = this.drawPolyLine = function(x, y, s)␍
{␍
for (var i=0 ; i<x.length-1 ; i++ )␍
this.drawLine(x[i], y[i], x[i+1], y[i+1]);␍
};␍
␍
␍
this.fillRect = function(x, y, w, h)␍
{␍
this.mkDiv(x, y, w, h);␍
};␍
␍
␍
this.drawPolygon = function(x, y)␍
{␍
this.drawPolyline(x, y);␍
this.drawLine(x[x.length-1], y[x.length-1], x[0], y[0]);␍
};␍
␍
␍
this.drawEllipse = this.drawOval = function(x, y, w, h)␍
{␍
this.mkOv(x, y, w, h);␍
};␍
␍
␍
this.fillEllipse = this.fillOval = function(left, top, w, h)␍
{␍
var a = (w -= 1)>>1, b = (h -= 1)>>1,␍
wod = (w&1)+1, hod = (h&1)+1,␍
cx = left+a, cy = top+b,␍
x = 0, y = b,␍
ox = 0, oy = b,␍
aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1,␍
st = (aa2>>1)*(1-(b<<1)) + bb,␍
tt = (bb>>1) - aa2*((b<<1)-1),␍
pxl, dw, dh;␍
if (w+1) while (y > 0)␍
{␍
if (st < 0)␍
{␍
st += bb*((x<<1)+3);␍
tt += (bb<<1)*(++x);␍
}␍
else if (tt < 0)␍
{␍
st += bb*((x<<1)+3) - aa4*(y-1);␍
pxl = cx-x;␍
dw = (x<<1)+wod;␍
tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3);␍
dh = oy-y;␍
this.mkDiv(pxl, cy-oy, dw, dh);␍
this.mkDiv(pxl, cy+y+hod, dw, dh);␍
ox = x;␍
oy = y;␍
}␍
else␍
{␍
tt -= aa2*((y<<1)-3);␍
st -= aa4*(--y);␍
}␍
}␍
this.mkDiv(cx-a, cy-oy, w+1, (oy<<1)+hod);␍
};␍
␍
␍
/* fillPolygon method, implemented by Matthieu Haller.␍
This javascript function is an adaptation of the gdImageFilledPolygon for Walter Zorn lib.␍
C source of GD 1.8.4 found at http://www.boutell.com/gd/␍
␍
THANKS to Kirsten Schulz for the polygon fixes!␍
␍
The intersection finding technique of this code could be improved␍
by remembering the previous intertersection, and by using the slope.␍
That could help to adjust intersections to produce a nice␍
interior_extrema. */␍
this.fillPolygon = function(array_x, array_y)␍
{␍
var i;␍
var y;␍
var miny, maxy;␍
var x1, y1;␍
var x2, y2;␍
var ind1, ind2;␍
var ints;␍
␍
var n = array_x.length;␍
␍
if (!n) return;␍
␍
␍
miny = array_y[0];␍
maxy = array_y[0];␍
for (i = 1; i < n; i++)␍
{␍
if (array_y[i] < miny)␍
miny = array_y[i];␍
␍
if (array_y[i] > maxy)␍
maxy = array_y[i];␍
}␍
for (y = miny; y <= maxy; y++)␍
{␍
var polyInts = new Array();␍
ints = 0;␍
for (i = 0; i < n; i++)␍
{␍
if (!i)␍
{␍
ind1 = n-1;␍
ind2 = 0;␍
}␍
else␍
{␍
ind1 = i-1;␍
ind2 = i;␍
}␍
y1 = array_y[ind1];␍
y2 = array_y[ind2];␍
if (y1 < y2)␍
{␍
x1 = array_x[ind1];␍
x2 = array_x[ind2];␍
}␍
else if (y1 > y2)␍
{␍
y2 = array_y[ind1];␍
y1 = array_y[ind2];␍
x2 = array_x[ind1];␍
x1 = array_x[ind2];␍
}␍
else continue;␍
␍
// modified 11. 2. 2004 Walter Zorn␍
if ((y >= y1) && (y < y2))␍
polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);␍
␍
else if ((y == maxy) && (y > y1) && (y <= y2))␍
polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);␍
}␍
polyInts.sort(integer_compare);␍
for (i = 0; i < ints; i+=2)␍
this.mkDiv(polyInts[i], y, polyInts[i+1]-polyInts[i]+1, 1);␍
}␍
};␍
␍
␍
this.drawString = function(txt, x, y)␍
{␍
this.htm += '<div style="position:absolute;white-space:nowrap;'+␍
'left:' + x + 'px;'+␍
'top:' + y + 'px;'+␍
'font-family:' + this.ftFam + ';'+␍
'font-size:' + this.ftSz + ';'+␍
'color:' + this.color + ';' + this.ftSty + '">'+␍
txt +␍
'<\/div>';␍
};␍
␍
␍
/* drawStringRect() added by Rick Blommers.␍
Allows to specify the size of the text rectangle and to align the␍
text both horizontally (e.g. right) and vertically within that rectangle */␍
this.drawStringRect = function(txt, x, y, width, halign)␍
{␍
this.htm += '<div style="position:absolute;overflow:hidden;'+␍
'left:' + x + 'px;'+␍
'top:' + y + 'px;'+␍
'width:'+width +'px;'+␍
'text-align:'+halign+';'+␍
'font-family:' + this.ftFam + ';'+␍
'font-size:' + this.ftSz + ';'+␍
'color:' + this.color + ';' + this.ftSty + '">'+␍
txt +␍
'<\/div>';␍
};␍
␍
␍
this.drawImage = function(imgSrc, x, y, w, h, a)␍
{␍
this.htm += '<div style="position:absolute;'+␍
'left:' + x + 'px;'+␍
'top:' + y + 'px;'+␍
'width:' + w + 'px;'+␍
'height:' + h + 'px;">'+␍
'<img src="' + imgSrc + '" width="' + w + '" height="' + h + '"' + (a? (' '+a) : '') + '>'+␍
'<\/div>';␍
};␍
␍
␍
this.clear = function()␍
{␍
this.htm = "";␍
if (this.cnv) this.cnv.innerHTML = this.defhtm;␍
};␍
␍
␍
this.mkOvQds = function(cx, cy, xl, xr, yt, yb, w, h)␍
{␍
this.mkDiv(xr+cx, yt+cy, w, h);␍
this.mkDiv(xr+cx, yb+cy, w, h);␍
this.mkDiv(xl+cx, yb+cy, w, h);␍
this.mkDiv(xl+cx, yt+cy, w, h);␍
};␍
␍
this.setStroke(1);␍
this.setFont('verdana,geneva,helvetica,sans-serif', String.fromCharCode(0x31, 0x32, 0x70, 0x78), Font.PLAIN);␍
this.color = '#000000';␍
this.htm = '';␍
this.wnd = wnd || window;␍
␍
if (!(jg_ie || jg_dom || jg_ihtm)) chkDHTM();␍
if (typeof id != 'string' || !id) this.paint = pntDoc;␍
else␍
{␍
this.cnv = document.all? (this.wnd.document.all[id] || null)␍
: document.getElementById? (this.wnd.document.getElementById(id) || null)␍
: null;␍
this.defhtm = (this.cnv && this.cnv.innerHTML)? this.cnv.innerHTML : '';␍
this.paint = jg_dom? pntCnvDom : jg_ie? pntCnvIe : jg_ihtm? pntCnvIhtm : pntCnv;␍
}␍
␍
this.setPrintable(false);␍
}␍
␍
␍
␍
function integer_compare(x,y)␍
{␍
return (x < y) ? -1 : ((x > y)*1);␍
}␍
</script>␍
+86
View File
@@ -0,0 +1,86 @@
<?PHP
require("../../inc/header.inc");
echo "<br>operator the point of x,y";
//update sysLedConf set point_x=20 WHERE key_src_page_type = '0' AND key_src_page_num = '20480' AND point_x != '999' and remark like '$likeStr'
$pubDb = "OMC_PUB";
if(0)//map
for($i=0; $i<=11; $i++)
{
if(strlen($i)==1) $ii = '0'.$i;
else $ii = $i;
$likeStr = 'BTS_'.$ii.'%';
$point_x = 20+$i*60;
$updSql = "update sysLedConf set point_x=$point_x WHERE key_src_page_type = '0' AND key_src_page_num = '20480' AND point_x != '999' and remark like '$likeStr'";
echo "<br>updSql x = $updSql";
mysqli_query($pubConn,$updSql);
//exit;
$selSql = "select * from sysLedConf where point_x=$point_x AND key_src_page_num = '20480' AND point_x != '999' and remark like '$likeStr' order by key_led_num";
//echo "<br>selSql=$selSql";
$result = mysqli_query($pubConn,$selSql);
$tmp=0;
while($row = mysqli_fetch_array($result)) {
$keyLedNum = $row[key_led_num];
if($tmp==0)$num = $keyLedNum;
$poin_y = ($keyLedNum-$num+1)*40+20;
$updSql = "update sysLedConf set point_y=$poin_y where key_led_num=$keyLedNum AND key_src_page_num = '20480' AND point_x != '999' and remark like '$likeStr'";
//echo "<br>$updSql";
mysqli_query($pubConn,$updSql);
$tmp++;
}
}
if(0)//BSS-x
{
$pointArr = array(
array('x' => 263, 'y' => 268),
array('x' => 346, 'y' => 268),
array('x' => 430, 'y' => 268),
array('x' => 514, 'y' => 268),
array('x' => 598, 'y' => 268),
array('x' => 679, 'y' => 268),
array('x' => 263, 'y' => 455),
array('x' => 346, 'y' => 455),
array('x' => 430, 'y' => 455),
array('x' => 514, 'y' => 455),
array('x' => 598, 'y' => 455),
array('x' => 679, 'y' => 455)
);
for($i=20577; $i<=20588; $i++){
$selSql = "SELECT * FROM sysLedConf WHERE key_src_page_type = '2' AND key_src_page_num = '$i' AND point_x != '999' and remark like 'BTS%' ORDER BY key_src_page_type,key_led_num ASC";
$Result = mysqli_query($pubConn,$selSql);
while($Rows = mysqli_fetch_array($Result)){
$remark = $Rows[remark];
$subNo = explode('_',$remark);
$subNo = $subNo[2];
$subNo -= 0;
//echo "<br>$subNo";
$key_led_num = $Rows[key_led_num];
$pointX = $pointArr[$subNo][x];
$pointY = $pointArr[$subNo][y];
$updSql = "update sysLedConf set point_x=$pointX,point_y=$pointY WHERE key_src_page_type = '2' AND key_src_page_num = '$i' AND point_x != '999' and remark like 'BTS%' and key_led_num=$key_led_num";
echo "<br>$updSql";
mysqli_query($pubConn,$updSql);
}
}
for($i=20577; $i<=20588; $i++){
$selSql = "SELECT * FROM sysLedConf WHERE key_src_page_type = '2' AND key_src_page_num = '$i' AND point_x != '999' and remark like 'BSC%' ORDER BY key_src_page_type,key_led_num ASC";
$Result = mysqli_query($pubConn,$selSql);
$Rows = mysqli_fetch_array($Result);
$key_led_num = $Rows[key_led_num];
$pointX = 37;
$pointY = 454;
$updSql = "update sysLedConf set point_x=$pointX,point_y=$pointY WHERE key_src_page_type = '2' AND key_src_page_num = '$i' AND point_x != '999' and remark like 'BSC%' and key_led_num=$key_led_num";
echo "<br>$updSql";
mysqli_query($pubConn,$updSql);
}
}
?>
+473
View File
@@ -0,0 +1,473 @@
<?php
/*************************************************************************
* �ļ�˵����
* ����˵��:OMC״̬��ʾҳ�棬
* ���ù�ϵ��
*
*
* ���ߣ�Cui Ticun 2006-10-30
*
*�޸�ע�ͣ�
*NO.1
*Name��
*Time��
*Modify description��
*************************************************************************/
require("../sub_inc/header.inc");
$DEBUG = 0;
//==========================online help=======================
{
echo "<div style=\"position:absolute;top:20;left:815;\" id=\"helpId\">";
$helpId="1.1";
showHelp($helpId);
echo "</div>";
}
$tmpSql = "SELECT existFlag From elementExistConf WHERE elementName='BSS'";
global $pubConn;
if($DEBUG)
echo "<br>tmpSql=$tmpSql";
$tmpResult=mysqli_query($pubConn,$tmpSql);
echo mysqli_error($pubConn);
$tmpRows=mysqli_fetch_array('$tmpResult');
$bssExistFlag=$tmpRows['existFlag'];
if($bssExistFlag==1)
$showingTypeDefine=array(
array('needDragElement'=>'1','typeOffset'=>'20480','maxPageNum'=>'1','maxLedNum'=>'512','bg_img'=>'map.jpg','title'=>'MAP'),
array('needDragElement'=>'0','typeOffset'=>'20489','maxPageNum'=>'1','maxLedNum'=>'512','bg_img'=>'bg_shelf.jpg','title'=>'Central Office'),
array('needDragElement'=>'0','typeOffset'=>'20577','maxPageNum'=>'12','maxLedNum'=>'512','bg_img'=>'bss.jpg','title'=>'BSS')
);
else
$showingTypeDefine=array(
array('needDragElement'=>'1','typeOffset'=>'20480','maxPageNum'=>'1','maxLedNum'=>'512','bg_img'=>'map.jpg','title'=>'MAP'),
array('needDragElement'=>'0','typeOffset'=>'20489','maxPageNum'=>'1','maxLedNum'=>'512','bg_img'=>'bg_shelf_noBss.jpg','title'=>'Central Office'),
array('needDragElement'=>'0','typeOffset'=>'20577','maxPageNum'=>'12','maxLedNum'=>'512','bg_img'=>'bss.jpg','title'=>'BSS')
);
if(!isset($pageNum)||strlen($pageNum)<=0)
$pageNum=0;
if(!isset($showingPageType)||strlen($showingPageType)<=0)
$showingPageType=0;
if($bssExistFlag==0)
$showingPageType=1;
$needDragElement=$showingTypeDefine[$showingPageType]['needDragElement'];
$typeOffset =$showingTypeDefine[$showingPageType]['typeOffset'];
$maxPageNum =$showingTypeDefine[$showingPageType]['maxPageNum'];
$maxLedNum =$showingTypeDefine[$showingPageType]['maxLedNum'];
$bg_img =$showingTypeDefine[$showingPageType]['bg_img'];
if($DEBUG)
{
echo "<br>showingPageType=$showingPageType";
echo "<br>needDragElement=$needDragElement";
echo "<br>typeOffset=$typeOffset";
echo "<br>pageNum=$pageNum";
echo "<br>maxPageNum=$maxPageNum";
echo "<br>maxLedNum=$maxLedNum";
echo "<br>bg_img=$bg_img";
}
echo "<script language=\"JavaScript\">\n";
echo "var showingPageType=$showingPageType;\n";
echo "var needDragElement=$needDragElement;\n";
echo "var typeOffset=$typeOffset;\n";
echo "var pageNum=$pageNum;\n";
echo "var maxPageNum=$maxPageNum;\n";
echo "var maxLedNum=$maxLedNum;\n";
echo "var bg_img='$bg_img';\n";
echo "</script>";
if($needDragElement==1){
require("./dragElement.php");
require("./jsgraphics.php");
}
?>
<?php
if($language_version == 'eng'){
$language = 'eng';
}else{
$language = 'gb';
}
$dbName='OMC_PUB';
$ledConfTable='sysLedConf';
$ledStatTable='sysLedStat';
$nLedNoUsed ='00';
$nLedOk ='01';
$nLedWarn ='02';
$nLedError ='03';
$nLedAlarm ='04';
$NotShowLED ='15';
$shapeArr=array("circle","square","rectangle","triangle","rectangle_v","star");
$suffixArr=array(".gif","_f.gif");
$maxY=540;
$maxX=760;
$divideNumber='20489';
$routerURL = "./status_router.php?";
$htmlPageType=50;
?>
<script language="JavaScript">
function myDrawFunction(imageColor,x1,y1,x2,y2)
{
jg_doc.setStroke(1);
jg_doc.setColor(imageColor); // green
jg_doc.drawLine(x1,y1,x2,y2);
jg_doc.paint(); // draws, in this case, directly into the document
}
if(needDragElement==1)
var jg_doc = new jsGraphics(); // draw directly into document
var request_o=null; //declare the variable to hold the object.
var pageNum=0;
var totalLedNum=0;
/*
*--------------- GetResult() -----------------
* GetResult()
* ����:ͨ��XMLHTTP��������,���ؽ��.
* ����:str,�ַ���,��������.
* ʵ��:GetResult();
*--------------- GetResult() -----------------
*/
function GetResult()
{
var browser = navigator.appName; //find the browser name
if(browser == "Microsoft Internet Explorer"){
/* Create the object using MSIE's method */
request_o = new ActiveXObject("Microsoft.XMLHTTP");
}else{
/* Create the object using other browser's method */
request_o = new XMLHttpRequest();
//new XMLHttpRequest()
}
//alert(request_o);
var url="mapStatusServer.php?showingPageType="+showingPageType+"&typeOffset="+typeOffset+"&pageNum="+pageNum;
//document.writeln(url);
request_o.open("GET",url,"false");
request_o.onreadystatechange = handleMsgs;
request_o.send(null);
}
function handleMsgs(){
//alert(totalLedNum);
/* Make sure that the transaction has finished. The XMLHttpRequest object
has a property called readyState with several states:
0: Uninitialized
1: Loading
2: Loaded
3: Interactive
4: Finished */
//alert(request_o.readyState);
if(request_o.readyState == 4){ //Finished loading the response
/* We have got the response from the server-side script,
let's see just what it was. using the responseText property of
the XMLHttpRequest object. */
//var strResult = unescape(request_o.responseText);
var strResult = request_o.responseText;
//alert(strResult);
var arrResult = strResult.split("@@@");
if(arrResult.length-1!=totalLedNum)
window.location.href="./mapStatus.php?showingPageType="+showingPageType+"&pageNum="+pageNum;
for(var i=0;i<arrResult.length-1;i++){
statusImg=document.getElementById(i);
//alert(arrResult[i]);
statusImg.src=arrResult[i];
}
}
}
function MyShow(ledNum)
{
//10���Զ�ˢ��һ��,10��ȡ��һ������.
timer = window.setInterval("GetResult()",10000);
}
function ChangeImgId()
{
var idNumber = 0;
for (var i=0;i<document.images.length;i++)
{
if(document.images[i].id != 'helpId'){
document.images[i].id = idNumber;
idNumber++;
}
}
}
function openPage(newPage_showingPageType,newPage_pageNum,backurl)
{
//alert(newPage_showingPageType);
//alert(newPage_pageNum);
window.location.href=backurl+"showingPageType="+newPage_showingPageType+"&pageNum="+newPage_pageNum;
}
</script>
<?php
function getLedStatus($status_str,$led_num){
//echo "status_str:$status_str<br>";
//echo "led_num:$led_num<br>";
global $NotShowLED,$divideNumber;
$status_num = $NotShowLED;
$offset = 0;
if($led_num < $divideNumber){
$offset = ($led_num % 16)*2;
}else{
$offset = 0;
}
if($DEBUG)
echo "<br>led_num=$led_num,status_str=$status_str,offset=$offset";
$status_num = substr($status_str,$offset,2);
if($DEBUG)
echo "<br>status_num=$status_num";
if($status_num >=0 && $status_num <=$NotShowLED){
return($status_num&0x07);
}else{
return($NotShowLED);
}
}
?>
<?php
//save the result of dragging
if($command=='save'){
$tmpArr=explode("_",$drag_key_led_num);
$updateSql="UPDATE $ledConfTable SET point_x='$drag_x',point_y='$drag_y' WHERE key_led_num='$tmpArr[1]'";
if($DEBUG){
echo "<font size=\"2\">";
echo "<br>updateSql=$updateSql";
echo "</font>";
}
mysqli_query($pubConn,$updateSql);
}
?>
<?php
$pageIndex=$typeOffset+$pageNum;
if($bssExistFlag==1)
$selSql = "SELECT T1.key_led_num,T2.key_status,T1.point_x,T1.point_y,T1.shape,T1.remark,T1.dst_page_type,T1.dst_page_num
FROM $ledConfTable AS T1,$ledStatTable AS T2
WHERE (
if(T1.sync_from_led < 0 && T2.key_led_num < $divideNumber,floor(T1.key_led_num/16) = T2.key_led_num,T1.key_led_num = T2.key_led_num)
OR
if(T1.sync_from_led >= 0 && T2.key_led_num < $divideNumber,floor(T1.sync_from_led/16) = T2.key_led_num,T1.sync_from_led = T2.key_led_num)
)
AND T1.key_src_page_type ='$showingPageType'
AND T1.key_src_page_num = '$pageIndex'
AND T2.key_status != '15151515151515151515151515151515'
";
else
$selSql = "SELECT T1.key_led_num,T2.key_status,T1.point_x,T1.point_y,T1.shape,T1.remark,T1.dst_page_type,T1.dst_page_num
FROM $ledConfTable AS T1,$ledStatTable AS T2
WHERE (
if(T1.sync_from_led < 0 && T2.key_led_num < $divideNumber,floor(T1.key_led_num/16) = T2.key_led_num,T1.key_led_num = T2.key_led_num)
OR
if(T1.sync_from_led >= 0 && T2.key_led_num < $divideNumber,floor(T1.sync_from_led/16) = T2.key_led_num,T1.sync_from_led = T2.key_led_num)
)
AND T1.key_src_page_type ='$showingPageType'
AND T1.key_src_page_num = '$pageIndex'
AND T2.key_status != '15151515151515151515151515151515'
AND (T1.key_led_num <='20576' OR T1.key_led_num >='20589')
";
if($DEBUG)
echo "<br>selSql=$selSql";
$selResult=mysqli_query($pubConn,$selSql);
echo mysqli_error($pubConn);
$i = 0;
while($selRows=mysqli_fetch_array($selResult))
{
$key_led_num_Arr[$i] = $selRows['key_led_num'];
$X_Arr[$i] = $selRows['point_x'];
$Y_Arr[$i] = $selRows['point_y'];
$status[$i] = getLedStatus($selRows['key_status'],$selRows['key_led_num']);
if(strchr($selRows['remark'],":")){
$tmpRemarkArr = explode(":",$selRows['remark']);
$remark[$i] = $tmpRemarkArr[1];
}else
$remark[$i] = $selRows['remark'];
$dst_page_type[$i] = $selRows['dst_page_type'];
$dst_page_num[$i] = $selRows['dst_page_num'];
$shape[$i] = $selRows['shape'];
$type[$i] = $selRows['type'];
if($key_led_num_Arr[$i]==20489){
$cntrlLed_X=$X_Arr[$i];
$cntrlLed_Y=$Y_Arr[$i];
}
/*
$tmpX=$selRows[point_x]+10;
$tmpY=$selRows[point_y]+60;
$updateSql="UPDATE $ledConfTable SET point_x='$tmpX',point_Y='$tmpY' where key_led_num='$key_led_num_Arr[$i]'";
// echo "<br>updateSql=$updateSql";
mysqli_query($pubConn,$updateSql);
*/
if($DEBUG)
{
echo "<br><br>key_led_num_Arr[$i]=$key_led_num_Arr[$i]";
echo "<br>X_Arr[$i]=$X_Arr[$i]";
echo "<br>Y_Arr[$i]=$Y_Arr[$i]";
echo "<br>type[$i]=$type[$i]";
echo "<br>status[$i]=$status[$i]";
echo "<br>remark[$i]=$remark[$i]";
echo "<br>dst_page_num[$i]=$dst_page_num[$i]";
}
$i++;
}
$ledNum = $i;
?>
<BODY background="./images/<?php echo $bg_img;?>" style="background-repeat:no-repeat;background-position:10 60" onload="ChangeImgId();MyShow();">
<?php
echo "<table boder=\"0\" width=\"100%\" height=\"50\">";
echo "<tr>";
echo "<td width=\"50%\">";
echo "<font size=\"2\">";
echo "Status > ";
for($i=0;$i<sizeof($showingTypeDefine);$i++){
if($bssExistFlag==0&&($showingTypeDefine[$i]['title']=='BSS'||$showingTypeDefine[$i]['title']=='MAP'))
continue;
echo "<a href=\"JavaScript:openPage($i,0,'$PHP_SELF?')\">{$showingTypeDefine[$i]['title']}</a>";
if($showingTypeDefine[$i]['title']=='BSS'&&$showingTypeDefine[$showingPageType]['title']=='BSS'){
if($pageNum>0){
$tmpPageNum=$pageNum-1;
echo "<a href=\"JavaScript:openPage($i,$tmpPageNum,'$PHP_SELF?')\"><</a>";
}else{
echo "<";
}
echo "&nbsp;$pageNum&nbsp;";
if($pageNum<11){
$tmpPageNum=$pageNum+1;
echo "<a href=\"JavaScript:openPage($i,$tmpPageNum,'$PHP_SELF?')\">></a>";
}else{
echo ">";
}
}
echo "|";
}
echo "</font>";
echo "</td>";
echo "</tr>";
echo "</table>";
//display all led status
$totalImgY=0;
for($j=0;$j<sizeof($Y_Arr);$j++)
{
//echo "<font size=\"2\">status = $status[$j]<br>";
switch($status[$j]){
case $nLedOk:
$tmpImage="./images/".$shapeArr[$shape[$j]]."_green";
break;
case $nLedWarn:
$tmpImage="./images/".$shapeArr[$shape[$j]]."_yellow";
break;
case $nLedError:
$tmpImage="./images/".$shapeArr[$shape[$j]]."_red";
break;
case $nLedNoUsed:
$tmpImage="./images/".$shapeArr[$shape[$j]]."_gray";
break;
default :
$continueFlag=1;
//$tmpImage="./images/".$shapeArr[$shape[$j]]."_gray";
break;
}
if($continueFlag==1){
$ledNum--;
$continueFlag=0;
continue;
}
$tmpImage = $tmpImage.$suffixArr[0];
$tmpId='statusLed_'.$key_led_num_Arr[$j];
echo "\n<div id=\"$tmpId\" style=\"position:absolute; top:{$Y_Arr[$j]}px; left:{$X_Arr[$j]}px;\">";
if($needDragElement){
echo "\n<div onmousedown=\"beginDrag(this.parentNode,event);\">";
echo "<img VSPACE=\"0\" align = \"top\" border=\"0\" src=\"$tmpImage\"></a>";
echo "\n</div>";
$tmpPageNum=$dst_page_num[$j]-$showingTypeDefine[$dst_page_type[$j]]['typeOffset'];
if($dst_page_type[$j] >= $htmlPageType){
$linkURL=$routerURL."page_type=$dst_page_type[$j]&page_num=$dst_page_num[$j]&src_page_type=$showingPageType&src_page_num=$pageNum";
if($DEBUG)
echo "<br>linkURL=$linkURL";
echo "<a href=\"$linkURL\">$remark[$j]</a>";
}else{
$i=$dst_page_type[$j];
echo "<a href=\"JavaScript:openPage($i,$tmpPageNum,'$PHP_SELF?')\">$remark[$j]</a>";
}
}else{
$tmpPageNum=$dst_page_num[$j]-$showingTypeDefine[$dst_page_type[$j]]['typeOffset'];
if($dst_page_type[$j] >= $htmlPageType){
$linkURL=$routerURL."page_type=$dst_page_type[$j]&page_num=$dst_page_num[$j]&src_page_type=$showingPageType&src_page_num=$pageNum";
if($DEBUG)
echo "<br>linkURL=$linkURL";
echo "<a href=\"$linkURL\"><img VSPACE=\"0\" align = \"top\" border=\"0\" src=\"$tmpImage\"></a>";
if($key_led_num_Arr[$j]>=20577)// BSC or BTS, need display the remark
echo "<br><FONT color==\"#0000FF\">$remark[$j]</FONT>";
}else{
//echo "<br>page_num[$j]=$dst_page_num[$j]";
//echo "<br>Define[$dst_page_type[$j]][tO]={$showingTypeDefine[$dst_page_type[$j]][typeOffset]}";
$i=$dst_page_type[$j];
echo "<a href=\"JavaScript:openPage($i,$tmpPageNum,'$PHP_SELF?')\"><img VSPACE=\"0\" align = \"top\" border=\"0\" src=\"$tmpImage\"></a>";
if($key_led_num_Arr[$j]>=20577)// BSC or BTS, need display the remark
echo "<br><FONT color==\"#0000FF\">$remark[$j]</FONT>";
}
}
echo "\n</div>";
if(0)//�����
if($key_led_num_Arr!=20489){
echo "\n<script type=\"text/javascript\">\n";
echo "<!--\n";
echo "myDrawFunction('#ff0000',$cntrlLed_X+5,$cntrlLed_Y+5,$X_Arr[$j]+5,$Y_Arr[$j]+5)\n";
echo "//-->\n";
echo "</script>\n";
}
}
echo "<script language=\"JavaScript\">";
echo "pageNum=$pageNum;";
echo "totalLedNum=$ledNum;";
echo "</script>";
?>
</body>
</html>
+134
View File
@@ -0,0 +1,134 @@
<?php
/*************************************************************************
* 文件说明:
* 功能说明:MAP状态显示页面服务器端,
*
* 调用关系:
*
*
* 作者:Cui Ticun 2005-10-31
*
*修改注释:
*NO.1
*Name:
*Time:
*Modify description:
*************************************************************************/
require("../../inc/lib.inc");
$tmpSql = "SELECT existFlag From elementExistConf WHERE elementName='BSS'";
global $pubConn;
if($DEBUG)
echo "<br>tmpSql=$tmpSql";
$tmpResult=mysqli_query($pubConn,$tmpSql);
echo mysqli_error($pubConn);
$tmpRows=mysqli_fetch_array($tmpResult);
$bssExistFlag=$tmpRows['existFlag'];
$dbName='OMC_PUB';
$ledConfTable='sysLedConf';
$ledStatTable='sysLedStat';
$nLedNoUsed ='00';
$nLedOk ='01';
$nLedWarn ='02';
$nLedError ='03';
$nLedAlarm ='04';
$NotShowLED ='15';
$shapeArr=array("circle","square","rectangle","triangle","rectangle_v","star");
$suffixArr=array(".gif","_f.gif");
$divideNumber='20489';
function getLedStatus($status_str,$led_num){
global $NotShowLED,$divideNumber;
$status_num = $NotShowLED;
$offset = 0;
if($led_num < $divideNumber){
$offset = ($led_num % 16)*2;
}else{
$offset = 0;
}
if($DEBUG)
echo "<br>led_num=$led_num,status_str=$status_str,offset=$offset";
$status_num = substr($status_str,$offset,2);
if($DEBUG)
echo "<br>status_num=$status_num";
if($status_num >=0 && $status_num <=$NotShowLED){
return($status_num&0x07);
}else{
return($NotShowLED);
}
}
$pageIndex=$typeOffset+$pageNum;
if($bssExistFlag==1)
$selSql = "SELECT T1.key_led_num,T2.key_status,T1.point_x,T1.point_y,T1.shape,T1.remark,T1.dst_page_type,T1.dst_page_num
FROM $ledConfTable AS T1,$ledStatTable AS T2
WHERE (
if(T1.sync_from_led < 0 && T2.key_led_num < $divideNumber,floor(T1.key_led_num/16) = T2.key_led_num,T1.key_led_num = T2.key_led_num)
OR
if(T1.sync_from_led >= 0 && T2.key_led_num < $divideNumber,floor(T1.sync_from_led/16) = T2.key_led_num,T1.sync_from_led = T2.key_led_num)
)
AND T1.key_src_page_type ='$showingPageType'
AND T1.key_src_page_num = '$pageIndex'
AND T2.key_status != '15151515151515151515151515151515'
";
else
$selSql = "SELECT T1.key_led_num,T2.key_status,T1.point_x,T1.point_y,T1.shape,T1.remark,T1.dst_page_type,T1.dst_page_num
FROM $ledConfTable AS T1,$ledStatTable AS T2
WHERE (
if(T1.sync_from_led < 0 && T2.key_led_num < $divideNumber,floor(T1.key_led_num/16) = T2.key_led_num,T1.key_led_num = T2.key_led_num)
OR
if(T1.sync_from_led >= 0 && T2.key_led_num < $divideNumber,floor(T1.sync_from_led/16) = T2.key_led_num,T1.sync_from_led = T2.key_led_num)
)
AND T1.key_src_page_type ='$showingPageType'
AND T1.key_src_page_num = '$pageIndex'
AND T2.key_status != '15151515151515151515151515151515'
AND (T1.key_led_num <='20576' OR T1.key_led_num >='20589')
";
if($DEBUG)
echo "<br>selSql=$selSql";
$selResult=mysqli_query($pubConn,$selSql);
echo mysqli_error($pubConn);
$selRows=mysqli_fetch_array($selResult);
do{
//echo "<br>selRows[key_status]";
$tmpStatus=getLedStatus($selRows['key_status'],$selRows['key_led_num']);
switch($tmpStatus){
case $nLedOk:
$tmpImage="./images/".$shapeArr[$selRows['shape']]."_green";
break;
case $nLedWarn:
$tmpImage="./images/".$shapeArr[$selRows['shape']]."_yellow";
break;
case $nLedError:
$tmpImage="./images/".$shapeArr[$selRows['shape']]."_red";
break;
case $nLedNoUsed:
$tmpImage="./images/".$shapeArr[$selRows['shape']]."_gray";
break;
default :
$continueFlag=1;
//$tmpImage="./images/".$shapeArr[$shape[$j]]."_gray";
break;
}
if($continueFlag==1){
$continueFlag=0;
continue;
}
$tmpImage = $tmpImage.$suffixArr[0];
echo "$tmpImage";
echo "@@@";
}while($selRows=mysqli_fetch_array($selResult));
?>
+375
View File
@@ -0,0 +1,375 @@
<?php
/*************************************************************************
* 文件说明:
* 功能说明:OMC状态显示页面,
* 调用关系:
*
*
* 作者:Cui Ticun 2006-10-30
*
*修改注释:
*NO.1
*Name:
*Time:
*Modify description:
*************************************************************************/
require("../sub_inc/header.inc");
$showingTypeDefine=array(
array('needDragElement'=>'1','typeOffset'=>'20480','maxPageNum'=>'1','maxLedNum'=>'512','bg_img'=>'map.jpg','title'=>'MAP'),
array('needDragElement'=>'1','typeOffset'=>'20489','maxPageNum'=>'1','maxLedNum'=>'512','bg_img'=>'bg_shelf.jpg','title'=>'Central Office'),
array('needDragElement'=>'1','typeOffset'=>'20577','maxPageNum'=>'12','maxLedNum'=>'512','bg_img'=>'bss.jpg','title'=>'BSS')
);
if(!isset($pageNum)||strlen($pageNum)<=0)
$pageNum=0;
if(!isset($showingPageType)||strlen($showingPageType)<=0)
$showingPageType=0;
$needDragElement=$showingTypeDefine[$showingPageType][needDragElement];
$typeOffset =$showingTypeDefine[$showingPageType][typeOffset];
$maxPageNum =$showingTypeDefine[$showingPageType][maxPageNum];
$maxLedNum =$showingTypeDefine[$showingPageType][maxLedNum];
$bg_img =$showingTypeDefine[$showingPageType][bg_img];
if($DEBUG)
{
echo "<br>showingPageType=$showingPageType";
echo "<br>needDragElement=$needDragElement";
echo "<br>typeOffset=$typeOffset";
echo "<br>pageNum=$pageNum";
echo "<br>maxPageNum=$maxPageNum";
echo "<br>maxLedNum=$maxLedNum";
echo "<br>bg_img=$bg_img";
}
echo "<script language=\"JavaScript\">\n";
echo "var showingPageType=$showingPageType;\n";
echo "var needDragElement=$needDragElement;\n";
echo "var typeOffset=$typeOffset;\n";
echo "var pageNum=$pageNum;\n";
echo "var maxPageNum=$maxPageNum;\n";
echo "var maxLedNum=$maxLedNum;\n";
echo "var bg_img='$bg_img';\n";
echo "</script>";
if($needDragElement==1)
require("./dragElement_test.php");
?>
<?php
if($language_version == 'eng'){
$language = eng;
}else{
$language = gb;
}
$dbName='OMC_PUB';
$ledConfTable='sysLedConf';
$ledStatTable='sysLedStat';
$nLedNoUsed ='00';
$nLedOk ='01';
$nLedWarn ='02';
$nLedError ='03';
$nLedAlarm ='04';
$NotShowLED ='15';
$shapeArr=array("circle","square","rectangle","triangle","rectangle_v","star");
$suffixArr=array(".gif","_f.gif");
$maxY=540;
$maxX=760;
$divideNumber='20489';
$routerURL = "./status_router.php?";
$htmlPageType=50;
?>
<script language="JavaScript">
var request_o=null; //declare the variable to hold the object.
var pageNum=0;
var totalLedNum=0;
/*
*--------------- GetResult() -----------------
* GetResult()
* 功能:通过XMLHTTP发送请求,返回结果.
* 参数:str,字符串,发送条件.
* 实例:GetResult();
*--------------- GetResult() -----------------
*/
function GetResult()
{
var browser = navigator.appName; //find the browser name
if(browser == "Microsoft Internet Explorer"){
/* Create the object using MSIE's method */
request_o = new ActiveXObject("Microsoft.XMLHTTP");
}else{
/* Create the object using other browser's method */
request_o = new XMLHttpRequest();
//new XMLHttpRequest()
}
//alert(request_o);
var url="mapStatusServer.php?showingPageType="+showingPageType+"&typeOffset="+typeOffset+"&pageNum="+pageNum;
request_o.open("GET",url,"false");
request_o.onreadystatechange = handleMsgs;
request_o.send(null);
}
function handleMsgs(){
//alert(totalLedNum);
/* Make sure that the transaction has finished. The XMLHttpRequest object
has a property called readyState with several states:
0: Uninitialized
1: Loading
2: Loaded
3: Interactive
4: Finished */
//alert(request_o.readyState);
if(request_o.readyState == 4){ //Finished loading the response
/* We have got the response from the server-side script,
let's see just what it was. using the responseText property of
the XMLHttpRequest object. */
//var strResult = unescape(request_o.responseText);
var strResult = request_o.responseText;
//alert(strResult);
var arrResult = strResult.split("@@@");
if(arrResult.length-1!=totalLedNum)
window.location.href="./mapStatus_test.php?showingPageType="+showingPageType+"&pageNum="+pageNum;
for(var i=0;i<arrResult.length-1;i++){
statusImg=document.getElementById(i);
//alert(arrResult[i]);
statusImg.src=arrResult[i];
}
}
}
function MyShow(ledNum)
{
//10秒自动刷新一次,10秒取得一次数据.
timer = window.setInterval("GetResult()",10000);
}
function ChangeImgId()
{
var idNumber = 0;
for (var i=0;i<document.images.length;i++)
{
if(document.images[i].id != 'helpId'){
document.images[i].id = idNumber;
idNumber++;
}
}
}
function openPage(newPage_showingPageType,newPage_pageNum,backurl)
{
window.location.href=backurl+"showingPageType="+newPage_showingPageType+"&pageNum="+newPage_pageNum;
}
</script>
<?php
function getLedStatus($status_str,$led_num){
global $NotShowLED,$divideNumber;
$status_num = $NotShowLED;
$offset = 0;
if($led_num < $divideNumber){
$offset = ($led_num % 16)*2;
}else{
$offset = 0;
}
if($DEBUG)
echo "<br>led_num=$led_num,status_str=$status_str,offset=$offset";
$status_num = substr($status_str,$offset,2);
if($DEBUG)
echo "<br>status_num=$status_num";
if($status_num >=0 && $status_num <=$NotShowLED){
return($status_num&0x07);
}else{
return($NotShowLED);
}
}
?>
<?php
//save the result of dragging
if($command=='save'){
$tmpArr=explode("_",$drag_key_led_num);
$updateSql="UPDATE $ledConfTable SET point_x='$drag_x',point_y='$drag_y' WHERE key_led_num='$tmpArr[1]'";
if($DEBUG){
echo "<font size=\"2\">";
echo "<br>updateSql=$updateSql";
echo "</font>";
}
mysqli_query($pubConn,$updateSql);
}
?>
<?php
$pageIndex=$typeOffset+$pageNum;
$selSql = "SELECT T1.key_led_num,T2.key_status,T1.point_x,T1.point_y,T1.shape,T1.remark,T1.dst_page_type,T1.dst_page_num
FROM $ledConfTable AS T1,$ledStatTable AS T2
WHERE (
if(T1.sync_from_led < 0 && T2.key_led_num < $divideNumber,floor(T1.key_led_num/16) = T2.key_led_num,T1.key_led_num = T2.key_led_num)
OR
if(T1.sync_from_led >= 0 && T2.key_led_num < $divideNumber,floor(T1.sync_from_led/16) = T2.key_led_num,T1.sync_from_led = T2.key_led_num)
)
AND T1.key_src_page_type ='$showingPageType'
AND T1.key_src_page_num = '$pageIndex'
";
if($DEBUG)
echo "<br>selSql=$selSql";
$selResult=mysqli_query($pubConn,$selSql);
echo mysqli_error($pubConn);
$i = 0;
while($selRows=mysqli_fetch_array($selResult))
{
$key_led_num_Arr[$i] = $selRows[key_led_num];
$X_Arr[$i] = $selRows[point_x];
$Y_Arr[$i] = $selRows[point_y];
$status[$i] = getLedStatus($selRows[key_status],$selRows[key_led_num]);
if(strchr($selRows[remark],":")){
$tmpRemarkArr = explode(":",$selRows[remark]);
$remark[$i] = $tmpRemarkArr[1];
}else
$remark[$i] = $selRows[remark];
$dst_page_type[$i] = $selRows[dst_page_type];
$dst_page_num[$i] = $selRows[dst_page_num];
$shape[$i] = $selRows[shape];
$type[$i] = $selRows[type];
/*
$tmpX=$selRows[point_x]+10;
$tmpY=$selRows[point_y]+60;
$updateSql="UPDATE $ledConfTable SET point_x='$tmpX',point_Y='$tmpY' where key_led_num='$key_led_num_Arr[$i]'";
// echo "<br>updateSql=$updateSql";
mysqli_query($pubConn,$updateSql);
*/
if($DEBUG)
{
echo "<br>key_led_num_Arr[$i]=$key_led_num_Arr[$i]";
echo "<br>X_Arr[$i]=$X_Arr[$i]";
echo "<br>Y_Arr[$i]=$Y_Arr[$i]";
echo "<br>type[$i]=$type[$i]";
echo "<br>status[$i]=$status[$i]";
echo "<br>remark[$i]=$remark[$i]";
}
$i++;
}
$ledNum = $i;
?>
<BODY background="./images/<?php echo $bg_img;?>" style="background-repeat:no-repeat;background-position:10 60" onload="ChangeImgId();">
<?php
echo "<table boder=\"0\" width=\"100%\" height=\"50\">";
echo "<tr>";
echo "<td width=\"50%\">";
echo "<font size=\"2\">";
echo "Status > ";
for($i=0;$i<sizeof($showingTypeDefine);$i++){
echo "<a href=\"JavaScript:openPage($i,0,'$PHP_SELF?')\">{$showingTypeDefine[$i][title]}</a>";
if($showingTypeDefine[$i][title]=='BSS'&&$showingTypeDefine[$showingPageType][title]=='BSS'){
if($pageNum>0){
$tmpPageNum=$pageNum-1;
echo "<a href=\"JavaScript:openPage($i,$tmpPageNum,'$PHP_SELF?')\"><</a>";
}else{
echo "<";
}
echo "&nbsp;$pageNum&nbsp;";
if($pageNum<11){
$tmpPageNum=$pageNum+1;
echo "<a href=\"JavaScript:openPage($i,$tmpPageNum,'$PHP_SELF?')\">></a>";
}else{
echo ">";
}
}
echo "|";
}
echo "</font>";
echo "</td>";
echo "</tr>";
echo "</table>";
//display all led status
$totalImgY=0;
for($j=0;$j<sizeof($Y_Arr);$j++)
{
//echo "<font size=\"2\">status = $status[$j]<br>";
switch($status[$j]){
case $nLedOk:
$tmpImage="./images/".$shapeArr[$shape[$j]]."_green";
break;
case $nLedWarn:
$tmpImage="./images/".$shapeArr[$shape[$j]]."_yellow";
break;
case $nLedError:
$tmpImage="./images/".$shapeArr[$shape[$j]]."_red";
break;
case $nLedNoUsed:
$tmpImage="./images/".$shapeArr[$shape[$j]]."_gray";
break;
default :
$tmpImage="./images/".$shapeArr[$shape[$j]]."_gray";
break;
}
if($continueFlag==1){
$ledNum--;
$continueFlag=0;
continue;
}
$tmpImage = $tmpImage.$suffixArr[0];
$tmpId='statusLed_'.$key_led_num_Arr[$j];
echo "\n<div id=\"$tmpId\" style=\"position:absolute; top:{$Y_Arr[$j]}px; left:{$X_Arr[$j]}px;\">";
if($needDragElement){
echo "\n<div onmousedown=\"beginDrag(this.parentNode,event);\">";
echo "<img VSPACE=\"0\" align = \"top\" border=\"0\" src=\"$tmpImage\"></a>";
echo "\n</div>";
$tmpPageNum=$dst_page_num[$j]-$showingTypeDefine[$dst_page_type[$j]][typeOffset];
if($dst_page_type[$j] >= $htmlPageType){
$linkURL=$routerURL."page_type=$dst_page_type[$j]&page_num=$dst_page_num[$j]&src_page_type=$showingPageType&src_page_num=$pageNum";
if($DEBUG)
echo "<br>linkURL=$linkURL";
echo "<a href=\"$linkURL\">$remark[$j]</a>";
}else{
$i=$dst_page_type[$j];
echo "<a href=\"JavaScript:openPage($i,$tmpPageNum,'$PHP_SELF?')\">$remark[$j]</a>";
}
}else{
$tmpPageNum=$dst_page_num[$j]-$showingTypeDefine[$dst_page_type[$j]][typeOffset];
if($dst_page_type[$j] >= $htmlPageType){
$linkURL=$routerURL."page_type=$dst_page_type[$j]&page_num=$dst_page_num[$j]&src_page_type=$showingPageType&src_page_num=$pageNum";
if($DEBUG)
echo "<br>linkURL=$linkURL";
echo "<a href=\"$linkURL\"><img VSPACE=\"0\" align = \"top\" border=\"0\" src=\"$tmpImage\"></a>";
}else{
$i=$dst_page_type[$j];
echo "<a href=\"JavaScript:openPage($i,$tmpPageNum,'$PHP_SELF?')\"><img VSPACE=\"0\" align = \"top\" border=\"0\" src=\"$tmpImage\"></a>";
}
}
echo "\n</div>";
}
echo "<script language=\"JavaScript\">";
echo "pageNum=$pageNum;";
echo "totalLedNum=$ledNum;";
echo "</script>";
?>
</body>
</html>
+106
View File
@@ -0,0 +1,106 @@
<?php
/*************************************************************************
* 文件说明:
* 功能说明:根据由Applet传来的sys_id,跳转到不同的状态显示页面,
*
* 调用关系:调用:各种设备的状态信息显示页面
* 被调用:show_applet.php
*
*
* 作者:
*
*修改注释:
*NO.1
*姓名:
*时间:
*修改说明:
*************************************************************************/
require("../../inc/header.inc");
$DEBUG = 0;
if($DEBUG) echo "<br>page_type = $page_type , page_num = $page_num";
$page_num = omc_keep_length($page_num,0,4);
if($DEBUG) echo "<br>page_type = $page_type page_num = $page_num";
$sys_code = $page_type - 50;
$sys_type = omc_sys_code2type($sys_code);
$sys_num = substr($page_num,0,2)+0;
$subsys_num = substr($page_num,2,2)+0;
$sys_id = $sys_type.'_'.$sys_num.'_'.$subsys_num;
$sys_id_2 = $sys_type.'_'.$sys_num;
switch($sys_type){
case '8KE1':
$page_url = "../../fault/csuStatus/csuStatus_frame.php";
break;
case 'CCF(MSC)':
$page_url = "../../fault/serverStatus/serverStatus.php";
break;
case 'MSC':
$page_url = "../../fault/serverStatus/serverStatus.php";
break;
case 'VPS':
$page_url = "../../fault/perStatus/devStatus.php";
break;
case 'PCR':
$page_url = "../../fault/perStatus/devStatus.php";
break;
case 'PCRK':
$page_url = "../../fault/perStatus/devStatus.php";
break;
case 'PCR8':
$page_url = "../../fault/perStatus/devStatus.php";
break;
case 'CNF':
$page_url = "../../fault/perStatus/devStatus.php";
break;
case 'CNFC':
$page_url = "../../fault/perStatus/devStatus.php";
break;
case 'IWF':
$page_url = "../../fault/perStatus/devStatus.php";
break;
case 'OMC':
$page_url = "../../fault/serverStatus/serverStatus.php";
break;
case 'HLR':
$page_url = "../../fault/serverStatus/serverStatus.php";
break;
case 'AUC':
$page_url = "../../fault/serverStatus/serverStatus.php";
break;
case 'EIR':
$page_url = "../../fault/serverStatus/serverStatus.php";
break;
case 'PPS':
$page_url = "../../fault/serverStatus/serverStatus.php";
break;
case 'SMSC':
$page_url = "../../fault/serverStatus/serverStatus.php";
break;
case 'VLR':
$page_url = "../../fault/serverStatus/serverStatus.php";
break;
case 'VSS':
$page_url = "../../fault/serverStatus/serverStatus.php";
break;
case 'VAS':
$page_url = "../../fault/serverStatus/serverStatus.php";
break;
case 'BSC':
$page_url = "../../fault/bssStatus/bscStatus.php?src_page_type=$src_page_type&src_page_num=$src_page_num";
break;
case 'BTS':
$page_url = "../../fault/bssStatus/btsStatus.php?src_page_type=$src_page_type&src_page_num=$src_page_num";
break;
case 'PWR':
$page_url = "../../fault/csuStatus/csuStatus.php";
break;
default:
echo "Can't find this system's define!please check it:$sys_id";
exit();
}
if($DEBUG) echo "<br>$page_url";
if($DEBUG) exit();
echo "<meta http-equiv=\"refresh\" content=\"0 url=$page_url\">";
exit();
?>
+943
View File
@@ -0,0 +1,943 @@
/* This notice must be untouched at all times.
wz_jsgraphics.js v. 2.36
The latest version is available at
http://www.walterzorn.com
or http://www.devira.com
or http://www.walterzorn.de
Copyright (c) 2002-2004 Walter Zorn. All rights reserved.
Created 3. 11. 2002 by Walter Zorn (Web: http://www.walterzorn.com )
Last modified: 21. 6. 2006
Performance optimizations for Internet Explorer
by Thomas Frank and John Holdsworth.
fillPolygon method implemented by Matthieu Haller.
High Performance JavaScript Graphics Library.
Provides methods
- to draw lines, rectangles, ellipses, polygons
with specifiable line thickness,
- to fill rectangles and ellipses
- to draw text.
NOTE: Operations, functions and branching have rather been optimized
to efficiency and speed than to shortness of source code.
LICENSE: LGPL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (LGPL) as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA,
or see http://www.gnu.org/copyleft/lesser.html
*/
var jg_ihtm, jg_ie, jg_fast, jg_dom, jg_moz,
jg_n4 = (document.layers && typeof document.classes != "undefined");
function chkDHTM(x, i)
{
x = document.body || null;
jg_ie = x && typeof x.insertAdjacentHTML != "undefined";
jg_dom = (x && !jg_ie &&
typeof x.appendChild != "undefined" &&
typeof document.createRange != "undefined" &&
typeof (i = document.createRange()).setStartBefore != "undefined" &&
typeof i.createContextualFragment != "undefined");
jg_ihtm = !jg_ie && !jg_dom && x && typeof x.innerHTML != "undefined";
jg_fast = jg_ie && document.all && !window.opera;
jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined";
}
function pntDoc()
{
this.wnd.document.write(jg_fast? this.htmRpc() : this.htm);
this.htm = '';
}
function pntCnvDom()
{
var x = this.wnd.document.createRange();
x.setStartBefore(this.cnv);
x = x.createContextualFragment(jg_fast? this.htmRpc() : this.htm);
if(this.cnv) this.cnv.appendChild(x);
this.htm = '';
}
function pntCnvIe()
{
if(this.cnv) this.cnv.insertAdjacentHTML("BeforeEnd", jg_fast? this.htmRpc() : this.htm);
this.htm = '';
}
function pntCnvIhtm()
{
if(this.cnv) this.cnv.innerHTML += this.htm;
this.htm = '';
}
function pntCnv()
{
this.htm = '';
}
function mkDiv(x, y, w, h)
{
this.htm += '<div style="position:absolute;'+
'left:' + x + 'px;'+
'top:' + y + 'px;'+
'width:' + w + 'px;'+
'height:' + h + 'px;'+
'clip:rect(0,'+w+'px,'+h+'px,0);'+
'background-color:' + this.color +
(!jg_moz? ';overflow:hidden' : '')+
';"><\/div>';
}
function mkDivIe(x, y, w, h)
{
this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';';
}
function mkDivPrt(x, y, w, h)
{
this.htm += '<div style="position:absolute;'+
'border-left:' + w + 'px solid ' + this.color + ';'+
'left:' + x + 'px;'+
'top:' + y + 'px;'+
'width:0px;'+
'height:' + h + 'px;'+
'clip:rect(0,'+w+'px,'+h+'px,0);'+
'background-color:' + this.color +
(!jg_moz? ';overflow:hidden' : '')+
';"><\/div>';
}
function mkLyr(x, y, w, h)
{
this.htm += '<layer '+
'left="' + x + '" '+
'top="' + y + '" '+
'width="' + w + '" '+
'height="' + h + '" '+
'bgcolor="' + this.color + '"><\/layer>\n';
}
var regex = /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;
function htmRpc()
{
return this.htm.replace(
regex,
'<div style="overflow:hidden;position:absolute;background-color:'+
'$1;left:$2;top:$3;width:$4;height:$5"></div>\n');
}
function htmPrtRpc()
{
return this.htm.replace(
regex,
'<div style="overflow:hidden;position:absolute;background-color:'+
'$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n');
}
function mkLin(x1, y1, x2, y2)
{
if (x1 > x2)
{
var _x2 = x2;
var _y2 = y2;
x2 = x1;
y2 = y1;
x1 = _x2;
y1 = _y2;
}
var dx = x2-x1, dy = Math.abs(y2-y1),
x = x1, y = y1,
yIncr = (y1 > y2)? -1 : 1;
if (dx >= dy)
{
var pr = dy<<1,
pru = pr - (dx<<1),
p = pr-dx,
ox = x;
while ((dx--) > 0)
{
++x;
if (p > 0)
{
this.mkDiv(ox, y, x-ox, 1);
y += yIncr;
p += pru;
ox = x;
}
else p += pr;
}
this.mkDiv(ox, y, x2-ox+1, 1);
}
else
{
var pr = dx<<1,
pru = pr - (dy<<1),
p = pr-dy,
oy = y;
if (y2 <= y1)
{
while ((dy--) > 0)
{
if (p > 0)
{
this.mkDiv(x++, y, 1, oy-y+1);
y += yIncr;
p += pru;
oy = y;
}
else
{
y += yIncr;
p += pr;
}
}
this.mkDiv(x2, y2, 1, oy-y2+1);
}
else
{
while ((dy--) > 0)
{
y += yIncr;
if (p > 0)
{
this.mkDiv(x++, oy, 1, y-oy);
p += pru;
oy = y;
}
else p += pr;
}
this.mkDiv(x2, oy, 1, y2-oy+1);
}
}
}
function mkLin2D(x1, y1, x2, y2)
{
if (x1 > x2)
{
var _x2 = x2;
var _y2 = y2;
x2 = x1;
y2 = y1;
x1 = _x2;
y1 = _y2;
}
var dx = x2-x1, dy = Math.abs(y2-y1),
x = x1, y = y1,
yIncr = (y1 > y2)? -1 : 1;
var s = this.stroke;
if (dx >= dy)
{
if (dx > 0 && s-3 > 0)
{
var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx;
_s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;
}
else var _s = s;
var ad = Math.ceil(s/2);
var pr = dy<<1,
pru = pr - (dx<<1),
p = pr-dx,
ox = x;
while ((dx--) > 0)
{
++x;
if (p > 0)
{
this.mkDiv(ox, y, x-ox+ad, _s);
y += yIncr;
p += pru;
ox = x;
}
else p += pr;
}
this.mkDiv(ox, y, x2-ox+ad+1, _s);
}
else
{
if (s-3 > 0)
{
var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy;
_s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;
}
else var _s = s;
var ad = Math.round(s/2);
var pr = dx<<1,
pru = pr - (dy<<1),
p = pr-dy,
oy = y;
if (y2 <= y1)
{
++ad;
while ((dy--) > 0)
{
if (p > 0)
{
this.mkDiv(x++, y, _s, oy-y+ad);
y += yIncr;
p += pru;
oy = y;
}
else
{
y += yIncr;
p += pr;
}
}
this.mkDiv(x2, y2, _s, oy-y2+ad);
}
else
{
while ((dy--) > 0)
{
y += yIncr;
if (p > 0)
{
this.mkDiv(x++, oy, _s, y-oy+ad);
p += pru;
oy = y;
}
else p += pr;
}
this.mkDiv(x2, oy, _s, y2-oy+ad+1);
}
}
}
function mkLinDott(x1, y1, x2, y2)
{
if (x1 > x2)
{
var _x2 = x2;
var _y2 = y2;
x2 = x1;
y2 = y1;
x1 = _x2;
y1 = _y2;
}
var dx = x2-x1, dy = Math.abs(y2-y1),
x = x1, y = y1,
yIncr = (y1 > y2)? -1 : 1,
drw = true;
if (dx >= dy)
{
var pr = dy<<1,
pru = pr - (dx<<1),
p = pr-dx;
while ((dx--) > 0)
{
if (drw) this.mkDiv(x, y, 1, 1);
drw = !drw;
if (p > 0)
{
y += yIncr;
p += pru;
}
else p += pr;
++x;
}
if (drw) this.mkDiv(x, y, 1, 1);
}
else
{
var pr = dx<<1,
pru = pr - (dy<<1),
p = pr-dy;
while ((dy--) > 0)
{
if (drw) this.mkDiv(x, y, 1, 1);
drw = !drw;
y += yIncr;
if (p > 0)
{
++x;
p += pru;
}
else p += pr;
}
if (drw) this.mkDiv(x, y, 1, 1);
}
}
function mkOv(left, top, width, height)
{
var a = width>>1, b = height>>1,
wod = width&1, hod = (height&1)+1,
cx = left+a, cy = top+b,
x = 0, y = b,
ox = 0, oy = b,
aa = (a*a)<<1, bb = (b*b)<<1,
st = (aa>>1)*(1-(b<<1)) + bb,
tt = (bb>>1) - aa*((b<<1)-1),
w, h;
while (y > 0)
{
if (st < 0)
{
st += bb*((x<<1)+3);
tt += (bb<<1)*(++x);
}
else if (tt < 0)
{
st += bb*((x<<1)+3) - (aa<<1)*(y-1);
tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);
w = x-ox;
h = oy-y;
if (w&2 && h&2)
{
this.mkOvQds(cx, cy, -x+2, ox+wod, -oy, oy-1+hod, 1, 1);
this.mkOvQds(cx, cy, -x+1, x-1+wod, -y-1, y+hod, 1, 1);
}
else this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, oy-h+hod, w, h);
ox = x;
oy = y;
}
else
{
tt -= aa*((y<<1)-3);
st -= (aa<<1)*(--y);
}
}
this.mkDiv(cx-a, cy-oy, a-ox+1, (oy<<1)+hod);
this.mkDiv(cx+ox+wod, cy-oy, a-ox+1, (oy<<1)+hod);
}
function mkOv2D(left, top, width, height)
{
var s = this.stroke;
width += s-1;
height += s-1;
var a = width>>1, b = height>>1,
wod = width&1, hod = (height&1)+1,
cx = left+a, cy = top+b,
x = 0, y = b,
aa = (a*a)<<1, bb = (b*b)<<1,
st = (aa>>1)*(1-(b<<1)) + bb,
tt = (bb>>1) - aa*((b<<1)-1);
if (s-4 < 0 && (!(s-2) || width-51 > 0 && height-51 > 0))
{
var ox = 0, oy = b,
w, h,
pxl, pxr, pxt, pxb, pxw;
while (y > 0)
{
if (st < 0)
{
st += bb*((x<<1)+3);
tt += (bb<<1)*(++x);
}
else if (tt < 0)
{
st += bb*((x<<1)+3) - (aa<<1)*(y-1);
tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);
w = x-ox;
h = oy-y;
if (w-1)
{
pxw = w+1+(s&1);
h = s;
}
else if (h-1)
{
pxw = s;
h += 1+(s&1);
}
else pxw = h = s;
this.mkOvQds(cx, cy, -x+1, ox-pxw+w+wod, -oy, -h+oy+hod, pxw, h);
ox = x;
oy = y;
}
else
{
tt -= aa*((y<<1)-3);
st -= (aa<<1)*(--y);
}
}
this.mkDiv(cx-a, cy-oy, s, (oy<<1)+hod);
this.mkDiv(cx+a+wod-s+1, cy-oy, s, (oy<<1)+hod);
}
else
{
var _a = (width-((s-1)<<1))>>1,
_b = (height-((s-1)<<1))>>1,
_x = 0, _y = _b,
_aa = (_a*_a)<<1, _bb = (_b*_b)<<1,
_st = (_aa>>1)*(1-(_b<<1)) + _bb,
_tt = (_bb>>1) - _aa*((_b<<1)-1),
pxl = new Array(),
pxt = new Array(),
_pxb = new Array();
pxl[0] = 0;
pxt[0] = b;
_pxb[0] = _b-1;
while (y > 0)
{
if (st < 0)
{
st += bb*((x<<1)+3);
tt += (bb<<1)*(++x);
pxl[pxl.length] = x;
pxt[pxt.length] = y;
}
else if (tt < 0)
{
st += bb*((x<<1)+3) - (aa<<1)*(y-1);
tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3);
pxl[pxl.length] = x;
pxt[pxt.length] = y;
}
else
{
tt -= aa*((y<<1)-3);
st -= (aa<<1)*(--y);
}
if (_y > 0)
{
if (_st < 0)
{
_st += _bb*((_x<<1)+3);
_tt += (_bb<<1)*(++_x);
_pxb[_pxb.length] = _y-1;
}
else if (_tt < 0)
{
_st += _bb*((_x<<1)+3) - (_aa<<1)*(_y-1);
_tt += (_bb<<1)*(++_x) - _aa*(((_y--)<<1)-3);
_pxb[_pxb.length] = _y-1;
}
else
{
_tt -= _aa*((_y<<1)-3);
_st -= (_aa<<1)*(--_y);
_pxb[_pxb.length-1]--;
}
}
}
var ox = 0, oy = b,
_oy = _pxb[0],
l = pxl.length,
w, h;
for (var i = 0; i < l; i++)
{
if (typeof _pxb[i] != "undefined")
{
if (_pxb[i] < _oy || pxt[i] < oy)
{
x = pxl[i];
this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, _oy+hod, x-ox, oy-_oy);
ox = x;
oy = pxt[i];
_oy = _pxb[i];
}
}
else
{
x = pxl[i];
this.mkDiv(cx-x+1, cy-oy, 1, (oy<<1)+hod);
this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);
ox = x;
oy = pxt[i];
}
}
this.mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod);
this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);
}
}
function mkOvDott(left, top, width, height)
{
var a = width>>1, b = height>>1,
wod = width&1, hod = height&1,
cx = left+a, cy = top+b,
x = 0, y = b,
aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1,
st = (aa2>>1)*(1-(b<<1)) + bb,
tt = (bb>>1) - aa2*((b<<1)-1),
drw = true;
while (y > 0)
{
if (st < 0)
{
st += bb*((x<<1)+3);
tt += (bb<<1)*(++x);
}
else if (tt < 0)
{
st += bb*((x<<1)+3) - aa4*(y-1);
tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3);
}
else
{
tt -= aa2*((y<<1)-3);
st -= aa4*(--y);
}
if (drw) this.mkOvQds(cx, cy, -x, x+wod, -y, y+hod, 1, 1);
drw = !drw;
}
}
function mkRect(x, y, w, h)
{
var s = this.stroke;
this.mkDiv(x, y, w, s);
this.mkDiv(x+w, y, s, h);
this.mkDiv(x, y+h, w+s, s);
this.mkDiv(x, y+s, s, h-s);
}
function mkRectDott(x, y, w, h)
{
this.drawLine(x, y, x+w, y);
this.drawLine(x+w, y, x+w, y+h);
this.drawLine(x, y+h, x+w, y+h);
this.drawLine(x, y, x, y+h);
}
function jsgFont()
{
this.PLAIN = 'font-weight:normal;';
this.BOLD = 'font-weight:bold;';
this.ITALIC = 'font-style:italic;';
this.ITALIC_BOLD = this.ITALIC + this.BOLD;
this.BOLD_ITALIC = this.ITALIC_BOLD;
}
var Font = new jsgFont();
function jsgStroke()
{
this.DOTTED = -1;
}
var Stroke = new jsgStroke();
function jsGraphics(id, wnd)
{
this.setColor = new Function('arg', 'this.color = arg.toLowerCase();');
this.setStroke = function(x)
{
this.stroke = x;
if (!(x+1))
{
this.drawLine = mkLinDott;
this.mkOv = mkOvDott;
this.drawRect = mkRectDott;
}
else if (x-1 > 0)
{
this.drawLine = mkLin2D;
this.mkOv = mkOv2D;
this.drawRect = mkRect;
}
else
{
this.drawLine = mkLin;
this.mkOv = mkOv;
this.drawRect = mkRect;
}
};
this.setPrintable = function(arg)
{
this.printable = arg;
if (jg_fast)
{
this.mkDiv = mkDivIe;
this.htmRpc = arg? htmPrtRpc : htmRpc;
}
else this.mkDiv = jg_n4? mkLyr : arg? mkDivPrt : mkDiv;
};
this.setFont = function(fam, sz, sty)
{
this.ftFam = fam;
this.ftSz = sz;
this.ftSty = sty || Font.PLAIN;
};
this.drawPolyline = this.drawPolyLine = function(x, y, s)
{
for (var i=0 ; i<x.length-1 ; i++ )
this.drawLine(x[i], y[i], x[i+1], y[i+1]);
};
this.fillRect = function(x, y, w, h)
{
this.mkDiv(x, y, w, h);
};
this.drawPolygon = function(x, y)
{
this.drawPolyline(x, y);
this.drawLine(x[x.length-1], y[x.length-1], x[0], y[0]);
};
this.drawEllipse = this.drawOval = function(x, y, w, h)
{
this.mkOv(x, y, w, h);
};
this.fillEllipse = this.fillOval = function(left, top, w, h)
{
var a = (w -= 1)>>1, b = (h -= 1)>>1,
wod = (w&1)+1, hod = (h&1)+1,
cx = left+a, cy = top+b,
x = 0, y = b,
ox = 0, oy = b,
aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1,
st = (aa2>>1)*(1-(b<<1)) + bb,
tt = (bb>>1) - aa2*((b<<1)-1),
pxl, dw, dh;
if (w+1) while (y > 0)
{
if (st < 0)
{
st += bb*((x<<1)+3);
tt += (bb<<1)*(++x);
}
else if (tt < 0)
{
st += bb*((x<<1)+3) - aa4*(y-1);
pxl = cx-x;
dw = (x<<1)+wod;
tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3);
dh = oy-y;
this.mkDiv(pxl, cy-oy, dw, dh);
this.mkDiv(pxl, cy+y+hod, dw, dh);
ox = x;
oy = y;
}
else
{
tt -= aa2*((y<<1)-3);
st -= aa4*(--y);
}
}
this.mkDiv(cx-a, cy-oy, w+1, (oy<<1)+hod);
};
/* fillPolygon method, implemented by Matthieu Haller.
This javascript function is an adaptation of the gdImageFilledPolygon for Walter Zorn lib.
C source of GD 1.8.4 found at http://www.boutell.com/gd/
THANKS to Kirsten Schulz for the polygon fixes!
The intersection finding technique of this code could be improved
by remembering the previous intertersection, and by using the slope.
That could help to adjust intersections to produce a nice
interior_extrema. */
this.fillPolygon = function(array_x, array_y)
{
var i;
var y;
var miny, maxy;
var x1, y1;
var x2, y2;
var ind1, ind2;
var ints;
var n = array_x.length;
if (!n) return;
miny = array_y[0];
maxy = array_y[0];
for (i = 1; i < n; i++)
{
if (array_y[i] < miny)
miny = array_y[i];
if (array_y[i] > maxy)
maxy = array_y[i];
}
for (y = miny; y <= maxy; y++)
{
var polyInts = new Array();
ints = 0;
for (i = 0; i < n; i++)
{
if (!i)
{
ind1 = n-1;
ind2 = 0;
}
else
{
ind1 = i-1;
ind2 = i;
}
y1 = array_y[ind1];
y2 = array_y[ind2];
if (y1 < y2)
{
x1 = array_x[ind1];
x2 = array_x[ind2];
}
else if (y1 > y2)
{
y2 = array_y[ind1];
y1 = array_y[ind2];
x2 = array_x[ind1];
x1 = array_x[ind2];
}
else continue;
// modified 11. 2. 2004 Walter Zorn
if ((y >= y1) && (y < y2))
polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);
else if ((y == maxy) && (y > y1) && (y <= y2))
polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);
}
polyInts.sort(integer_compare);
for (i = 0; i < ints; i+=2)
this.mkDiv(polyInts[i], y, polyInts[i+1]-polyInts[i]+1, 1);
}
};
this.drawString = function(txt, x, y)
{
this.htm += '<div style="position:absolute;white-space:nowrap;'+
'left:' + x + 'px;'+
'top:' + y + 'px;'+
'font-family:' + this.ftFam + ';'+
'font-size:' + this.ftSz + ';'+
'color:' + this.color + ';' + this.ftSty + '">'+
txt +
'<\/div>';
};
/* drawStringRect() added by Rick Blommers.
Allows to specify the size of the text rectangle and to align the
text both horizontally (e.g. right) and vertically within that rectangle */
this.drawStringRect = function(txt, x, y, width, halign)
{
this.htm += '<div style="position:absolute;overflow:hidden;'+
'left:' + x + 'px;'+
'top:' + y + 'px;'+
'width:'+width +'px;'+
'text-align:'+halign+';'+
'font-family:' + this.ftFam + ';'+
'font-size:' + this.ftSz + ';'+
'color:' + this.color + ';' + this.ftSty + '">'+
txt +
'<\/div>';
};
this.drawImage = function(imgSrc, x, y, w, h, a)
{
this.htm += '<div style="position:absolute;'+
'left:' + x + 'px;'+
'top:' + y + 'px;'+
'width:' + w + 'px;'+
'height:' + h + 'px;">'+
'<img src="' + imgSrc + '" width="' + w + '" height="' + h + '"' + (a? (' '+a) : '') + '>'+
'<\/div>';
};
this.clear = function()
{
this.htm = "";
if (this.cnv) this.cnv.innerHTML = this.defhtm;
};
this.mkOvQds = function(cx, cy, xl, xr, yt, yb, w, h)
{
this.mkDiv(xr+cx, yt+cy, w, h);
this.mkDiv(xr+cx, yb+cy, w, h);
this.mkDiv(xl+cx, yb+cy, w, h);
this.mkDiv(xl+cx, yt+cy, w, h);
};
this.setStroke(1);
this.setFont('verdana,geneva,helvetica,sans-serif', String.fromCharCode(0x31, 0x32, 0x70, 0x78), Font.PLAIN);
this.color = '#000000';
this.htm = '';
this.wnd = wnd || window;
if (!(jg_ie || jg_dom || jg_ihtm)) chkDHTM();
if (typeof id != 'string' || !id) this.paint = pntDoc;
else
{
this.cnv = document.all? (this.wnd.document.all[id] || null)
: document.getElementById? (this.wnd.document.getElementById(id) || null)
: null;
this.defhtm = (this.cnv && this.cnv.innerHTML)? this.cnv.innerHTML : '';
this.paint = jg_dom? pntCnvDom : jg_ie? pntCnvIe : jg_ihtm? pntCnvIhtm : pntCnv;
}
this.setPrintable(false);
}
function integer_compare(x,y)
{
return (x < y) ? -1 : ((x > y)*1);
}