/* ____ _____ / __ \ / ____| ___ _ _ ___| | | | (___ / _ \ | | |/ _ \ | | |\___ \ | __/ |_| | __/ |__| |____) | \___|\__, |\___|\____/|_____/ __/ | |___/ 1.2 Web Operating System eyeOS.org eyeOS Engineering Team - eyeOS.org/whoarewe eyeOS is released under the GNU General Public License (GPL) provided with this release in license.txt or via web at gnu.org/licenses/gpl.txt Copyright 2005-2007 eyeOS Team (team@eyeos.org) */ function Box_show(params,name,father,x,y,horiz,vert,checknum,cent) { var myheight = params["height"]; var mywidth = params["width"]; var title = params["title"]; var titleCss = params["titleCss"]; var theText = document.createTextNode(title); var oTable = document.createElement("TABLE"); var oTBody = document.createElement("TBODY"); var myTitle = document.createElement("DIV"); myTitle.className = titleCss; myTitle.setAttribute('id',name+'supText'); myTitle.appendChild(theText); oTable.style.width = mywidth+'px'; oTable.style.height = myheight+'px'; oTable.border=0; oTable.cellpadding=0; oTable.cellspacing=0; oTable.className = 'eyeBoxTable'; var oRow = document.createElement("TR"); var oCell = document.createElement("TD"); oCell.className = 'eyeBoxSupCent'; oCell.appendChild(myTitle); oRow.appendChild(oCell); oTBody.appendChild(oRow); oCell = document.createElement("TD"); oRow = document.createElement("TR"); oCell.className='eyeBoxCent'; oCell.width = '100%'; oCell.setAttribute('id',name); oRow.appendChild(oCell); oTBody.appendChild(oRow); if (IEversion == 0) { oCell = document.createElement("TD"); oRow = document.createElement("TR"); oCell.className='eyeBoxBottCent'; oCell.width = '100%'; oRow.appendChild(oCell); oTBody.appendChild(oRow); } oTable.appendChild(oTBody); createWidget(name+'_Container',father,oTable,horiz,vert,x,y,-1,-1,"eyeBoxContainer",cent); } function Line_show(params,name,father,x,y,horiz,vert,checknum,cent) { var mywidth = params['width']; var myheight = params['height']; var visible = params['visible']; var myLine = document.createElement('div'); myLine.setAttribute('id',name); myLine.style.width = mywidth+'px'; myLine.style.height = myheight+'px'; myLine.style.backgroundColor = '#dddddd'; createWidget(name+'_Container',father,myLine,horiz,vert,x,y,-1,-1,'eyeLineContainer',cent); } function File_show(params,name,father,x,y,horiz,vert,checknum,cent) { var callback = params['callback']; var filename = params['filename']; var visible = params['visible']; var multiple = params['multiple']; var pid = params['pid']; var myIframe = document.createElement('iframe'); if(multiple == 1){ var withs = '300px'; var height = '350px'; }else{ var withs = '250px'; var height = '90px'; } myIframe.setAttribute('id',name); myIframe.style.width = withs; myIframe.style.height = height; myIframe.style.border='none'; myIframe.frameBorder='no'; if(multiple == 1){ myIframe.setAttribute('src','index.php?extern=libs/eyeWidgets/getMultipleFile.eyecode&type=dynamic¶ms[]='+checknum+'¶ms[]='+callback+'¶ms[]='+filename+'¶ms[]='+pid) }else{ myIframe.setAttribute('src','index.php?extern=libs/eyeWidgets/getFile.eyecode&type=dynamic¶ms[]='+checknum+'¶ms[]='+callback+'¶ms[]='+filename+'¶ms[]='+pid) } createWidget(name+'_Container',father,myIframe,horiz,vert,x,y,-1,-1,'eyeLineContainer',cent); } function Simplebox_show(params,name,father,x,y,horiz,vert,checknum,cent) { var myheight = params["height"]; var mywidth = params["width"]; var divBox = document.createElement('div'); divBox.setAttribute('id',name); divBox.style.width = mywidth+'px'; divBox.style.height = myheight+'px'; if(params["border"] == 1){ createWidget(name+'_Container',father,divBox,horiz,vert,x,y,-1,-1,"eyeSimplebox",cent); }else{ createWidget(name+'_Container',father,divBox,horiz,vert,x,y,-1,-1,"eyeSimpleboxNoBorder",cent); } } function Button_show(params,name,father,x,y,horiz,vert,checknum,cent) { var caption = params["caption"]; var enabled = params["enabled"]; var visible = params["visible"]; var sync = params["sync"]; var dis = params["disablemsg"]; var sig = params["signal"]; var myWidth = params["width"]; var myHeight = params["height"]; var myImg = params["img"]; var myTop = params["imgY"]; var myLeft = parseInt(params["imgX"]); var forceMsg = params["forceMsg"]; myLeft = myLeft + 5; var myContainer = document.createElement('div'); myContainer.setAttribute('id',name+'_GlobalContainer'); if (myImg != "") { var myButton = document.createElement('img'); myButton.src=myImg; var myContent = document.createElement('div'); myContent.innerHTML = caption; myContent.setAttribute('id',name+'_cpt'); myContent.style.position = 'absolute'; } else { var myButton = document.createElement('button'); caption = tinyMCE.entityDecode(caption); theText=document.createTextNode(caption); myButton.appendChild(theText); } if(enabled == 0) { myButton.disabled=1; } if(myWidth > 0) { if(myImg != "") { myContainer.style.width = myWidth; } else { myButton.style.width = myWidth; } } if(myHeight > 0) { if(myImg != "") { myContainer.style.height = myHeight; } else { myButton.style.height = myHeight; } } if(myImg != "") { myContent.style.top = '2px'; myContent.style.left = myLeft+'px'; myContainer.style.cursor = 'Pointer'; } else { myButton.className = "eyeButtonClass"; } if(visible == 0) { myButton.style.visibility = 'hidden'; } if(dis == 0) { if(forceMsg == 0){ myContainer.onclick = function(){sendMsg(checknum,sig,eval(sync))}; }else{ var myParam = eyeParam(sig,forceMsg); myContainer.onclick = function(){sendMsg(checknum,sig,myParam)}; } } myButton.setAttribute('id',name); myContainer.appendChild(myButton); if(myContent) { myContainer.appendChild(myContent); } createWidget(name+'_Container',father,myContainer,horiz,vert,x,y,myWidth,myHeight,"eyeButton",cent); } function Calendar_show(params,name,father,x,y,horiz,vert,checknum,cent) { var myWidth = params['width']; var myHeight = params['height']; var selectFunc = params['selectFunc']; var globalDate = new Date(); var globalMonth = globalDate.getMonth(); var myDay = globalDate.getDate(); var globalYear = globalDate.getFullYear(); //Waiting for i18n var monthNames = new Array('January','February','March','April','May','June','July','August','September','October','November','December'); var calendarBase = document.createElement('div'); calendarBase.setAttribute('id',name+'calendarBase'); calendarBase.style.width = myWidth+'px'; calendarBase.style.height = myHeight+'px'; calendarBase.style.position = 'absolute'; var rowsAndDate = getRowsAndDate(); var weekDaysNames = getDaysNames(); var calendarBody = getCalendarBody(globalDate); calendarBase.appendChild(rowsAndDate); calendarBase.appendChild(weekDaysNames); calendarBase.appendChild(calendarBody); createWidget(name+'_Container',father,calendarBase,horiz,vert,x,y,myWidth,myHeight,"eyeCalendar",cent); function getRowsAndDate() { var rowsAndDate = document.createElement('div'); rowsAndDate.setAttribute('id',name+'rowsAndDate'); rowsAndDate.style.position = 'absolute'; rowsAndDate.style.width = '100%'; rowsAndDate.style.height = '18%'; rowsAndDate.style.color = params['rowsAndDate']; rowsAndDate.style.fontSize = '9px'; rowsAndDate.style.fontWeight = 'bold'; rowsAndDate.style.textAlign = 'center'; var rowLeft = document.createElement('div'); rowLeft.setAttribute('id',name+'rowLeft'); rowLeft.style.position = 'absolute'; rowLeft.style.left = '0%'; rowLeft.style.width = '24%'; rowLeft.style.height = '100%'; rowLeft.style.cursor = 'pointer'; xAddEventListener(rowLeft,'click',previousMonth); var text = document.createTextNode('<<'); rowLeft.appendChild(text); var dateMiddle = document.createElement('div'); dateMiddle.setAttribute('id',name+'dateMiddle'); dateMiddle.style.position = 'absolute'; dateMiddle.style.left = '24%'; dateMiddle.style.width = '52%'; dateMiddle.style.height = '100%'; text = document.createTextNode(monthNames[globalMonth]+' '+globalYear); dateMiddle.appendChild(text); var rowRight = document.createElement('div'); rowRight.setAttribute('id',name+'rowRight'); rowRight.style.position = 'absolute'; rowRight.style.right = '0%'; rowRight.style.width = '24%'; rowRight.style.height = '100%'; rowRight.style.cursor = 'pointer'; xAddEventListener(rowRight,'click',nextMonth); text = document.createTextNode('>>'); rowRight.appendChild(text); rowsAndDate.appendChild(rowLeft); rowsAndDate.appendChild(dateMiddle); rowsAndDate.appendChild(rowRight); return rowsAndDate; } function getDaysNames() { //At the moment, only show the week in this order: sunday monday....saturday. var x = 0;//for loops var weekDaysNames = document.createElement('div'); weekDaysNames.setAttribute('id',name+'weekDaysNames'); weekDaysNames.style.width = '100%'; weekDaysNames.style.height = '12%'; weekDaysNames.style.position = 'absolute'; weekDaysNames.style.top = '18%'; var leftCorner = document.createElement('div'); leftCorner.setAttribute('id',name+'leftCorner'); leftCorner.style.position = 'absolute'; leftCorner.style.left = '6%'; leftCorner.style.top = '0%'; leftCorner.style.height = '100%'; leftCorner.style.width = '6%'; leftCorner.style.background = 'no-repeat'; if(IEversion == 6){ leftCorner.style.backgroundImage = ''; leftCorner.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader (src='index.php?extern=apps/eyeX/themes/default/images/widgets/calendar_rowLeft.png', sizingMethod='scale');" }else{ leftCorner.style.backgroundImage ='url(index.php?extern=apps/eyeX/themes/default/images/widgets/calendar_rowLeft.png)' ; } var dayNameContent = document.createElement('div'); dayNameContent.style.width = '78%'; dayNameContent.style.height = '100%'; dayNameContent.style.lineHeight = '100%'; dayNameContent.style.position = 'absolute'; dayNameContent.style.left = '12%'; dayNameContent.style.top = '0%'; dayNameContent.style.backgroundColor = '#53A0E1'; var dayNames = new Array('S','M','T','W','T','F','S'); var left = 0; for(x=0;x<7;x++) { var dayName = document.createElement('div'); dayName.style.left = left+'%' dayName.style.width ='6.5%'; dayName.style.height ='100%'; dayName.style.lineHeight ='100%'; dayName.style.position = 'absolute'; dayName.style.color = params['dayName']; dayName.style.fontFamily = 'verdana'; dayName.style.fontSize = '1em'; var text = document.createTextNode(dayNames[x]); dayName.appendChild(text); dayNameContent.appendChild(dayName); left = left+15; } var rightCorner = document.createElement('div'); rightCorner.setAttribute('id',name+'rightCorner'); rightCorner.style.position = 'absolute'; rightCorner.style.right = '6%'; rightCorner.style.top = '0%'; rightCorner.style.height = '100%'; rightCorner.style.width = '6%'; rightCorner.style.background = 'no-repeat'; if(IEversion == 6){ rightCorner.style.backgroundImage = ''; rightCorner.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader (src='index.php?extern=apps/eyeX/themes/default/images/widgets/calendar_rowRight.png', sizingMethod='scale');" dayNameContent.style.backgroundColor = '#53A0E1'; }else{ rightCorner.style.backgroundImage='url(index.php?extern=apps/eyeX/themes/default/images/widgets/calendar_rowRight.png)' } weekDaysNames.appendChild(leftCorner); weekDaysNames.appendChild(dayNameContent); weekDaysNames.appendChild(rightCorner); return weekDaysNames; } function getCalendarBody() { var date = new Date(); date.setMonth(globalMonth); date.setYear(globalYear); var x,y = 0;//For bucles date.setDate(1);//First day of month var dayOfWeek = date.getDay(); var calendarBody = document.createElement('div'); calendarBody.style.width = '100%'; calendarBody.style.height = '70%'; calendarBody.style.position = 'absolute'; calendarBody.style.top = '30%'; //Calculating the the month lenght. var preMonthLenght = getMonthDays(globalMonth-1); var monthLenght = getMonthDays(globalMonth); var nextMonthLenght = getMonthDays(globalMonth+1); //Creating the array with day numbers. //First fill the first days of first week. var dayNums = new Array(0);//I will use push ,metoth var dayColors = new Array(0); var monthDay = new Array(0); for(x=dayOfWeek-1;x>=0;x--) { dayNums.push(preMonthLenght-x); dayColors.push(params['preMonthDays']);//Hardcoded at the moment } //Fill all month day for(x=1;x<=monthLenght;x++) { dayNums.push(x); date.setDate(x); if(date.getDay() == 0 || date.getDay() == 6) { dayColors.push(params['weekEnd']); }else{ dayColors.push(params['workDays']);//Hardcoded at the moment } } //Fill rest days var rest = 35-dayNums.length; for(x=1;x<=rest;x++) { dayNums.push(x); dayColors.push(params['nextMonthDays']);//Hardcoded at the moment } //Now, fill the body with days! var top = 7.5;//Hardcoded at the moment var count = 0; var vdate = new Date(); // for today for(x=0;x<5;x++) { var weekMonth = document.createElement('div'); weekMonth.style.width = '100%'; weekMonth.style.height = '16%'; weekMonth.style.position = 'absolute'; weekMonth.style.top = top+'%'; weekMonth.style.left = '0%'; var left = 11; var vdate = new Date(); for(y=0;y<7;y++) { var weekDay = document.createElement('div'); weekDay.style.position = 'absolute'; weekDay.style.left = left+'%'; weekDay.style.height = '100%'; weekDay.style.width = '5%'; weekDay.style.fontSize = '10px'; weekDay.style.fontFamily = 'verdana'; weekDay.style.color = dayColors[count]; //!!! the dayColors fix is only for some time, in the next version this days will send a correct data if(dayColors[count] != params['preMonthDays'] && dayColors[count] != params['nextMonthDays']) { weekDay.style.cursor = 'pointer'; if(dayNums[count] == vdate.getDate() && globalMonth == vdate.getMonth() && globalYear == vdate.getFullYear()){ weekDay.style.border = 'solid 1px'; weekDay.style.borderColor = params['todayBorder']; } }else{ weekDay.style.cursor = 'default'; } weekDay.day = dayNums[count];//Calcule the day of the month var text = document.createTextNode(dayNums[count]); //!!! the dayColors fix is only for some time, in the next version this days will send a correct data if(selectFunc != '' && dayColors[count] != params['preMonthDays'] && dayColors[count] != params['nextMonthDays']) { xAddEventListener(weekDay,'click',selectFunctionParser); } weekDay.appendChild(text); weekMonth.appendChild(weekDay); count++; left = left + 12; } calendarBody.appendChild(weekMonth); top = top+17; } return calendarBody; } function previousMonth() { calendarBase.removeChild(calendarBody); if(globalMonth == 0) { globalMonth = 11; globalYear = globalYear-1; globalDate.setFullYear(globalYear); }else{ globalMonth = globalMonth-1; } globalDate.setMonth(globalMonth); calendarBody = getCalendarBody(); calendarBase.appendChild(calendarBody); var dateMiddle = document.getElementById(name+'dateMiddle'); var textNode = dateMiddle.firstChild; textNode.replaceData(0,textNode.length,monthNames[globalMonth]+' '+globalYear); var newDate = new Date(); newDate.setMonth(globalMonth); newDate.setYear(globalYear); newDate.setDate(myDay); sendMsg(checknum,selectFunc,eyeParam('date',newDate.getTime())); } function nextMonth() { calendarBase.removeChild(calendarBody); if(globalMonth == 11) { globalMonth = 0; globalYear = globalYear+1; globalDate.setFullYear(globalYear); }else{ globalMonth = globalMonth+1; } globalDate.setMonth(globalMonth); calendarBody = getCalendarBody(); calendarBase.appendChild(calendarBody); var dateMiddle = document.getElementById(name+'dateMiddle'); var textNode = dateMiddle.firstChild; textNode.replaceData(0,textNode.length,monthNames[globalMonth]+' '+globalYear); var newDate = new Date(); newDate.setMonth(globalMonth); newDate.setYear(globalYear); newDate.setDate(myDay); sendMsg(checknum,selectFunc,eyeParam('date',newDate.getTime())); } function getMonthDays(myMonth) { if(myMonth == 3 || myMonth == 5 || myMonth == 8 || myMonth == 10) { return 30; }else if(myMonth == 1){ /*A little hack for caculate if february have 28 or 29 days.*/ var date = new Date(); date.setMonth(2); date.setDate(0); return date.getDate(); }else{ return 31; } } function selectFunctionParser(e) { var event = new xEvent(e); var dayClicked = event.target.day; myDay = dayClicked; var selectDate = new Date(); selectDate.setMonth(globalMonth); selectDate.setYear(globalYear); selectDate.setDate(dayClicked); sendMsg(checknum,selectFunc,eyeParam('date',selectDate.getTime())); } } function Checkbox_show(params,name,father,x,y,horiz,vert,checknum,cent) { var text = params["text"]; var checked = params["checked"]; var enabled = params["enabled"]; var visible = params["visible"]; var myCheckbox = document.createElement('input'); myCheckbox.setAttribute('type', 'checkbox'); var myContainer = document.createElement('div'); myContainer.setAttribute('id',name+'_textContainer'); if (checked == 1) { myCheckbox.setAttribute('checked','true'); } if (enabled == 0) { myCheckbox.disabled = 1; } if(visible == 0) { myCheckbox.style.visibility = 'hidden'; myContainer.style.visibility = 'hidden'; } myCheckbox.setAttribute('id',name); myCheckbox.className = 'eyeCheckbox'; myContainer.appendChild(myCheckbox); myContainer.className='eyeCheckboxText'; theText=document.createTextNode(text); myContainer.appendChild(theText); createWidget(name+'_Container',father,myContainer,horiz,vert,x,y,-1,-1,"eyeCheckboxContainer",cent); } function Container_show(params,name,father,x,y,horiz,vert,checknum,cent) { var myheight = parseInt(params["height"]); var mywidth = parseInt(params["width"]); var unit = params["unit"]; var myContainer = document.createElement("div"); if(myheight > 0) { myContainer.style.height = myheight + unit; } if(mywidth > 0){ myContainer.style.width = mywidth + unit; } myContainer.setAttribute('id',name); createWidget(name+'_Container',father,myContainer,horiz,vert,x,y,-1,-1,"eyeContainerContainer",cent,unit); } function Flash_show(params,name,father,x,y,horiz,vert,checknum,cent) { var height = params["height"]; var width = params["width"]; var src = params["src"]; var visible = params["visible"]; var flashParamsNames = getArrayArg(params["flashParamsNames"]); var flashParamsValues = getArrayArg(params["flashParamsValues"]); if (IEversion == 0) { var myFlash = document.createElement("object"); myFlash.setAttribute('width',width); myFlash.setAttribute('height',height); myFlash.setAttribute('data',src); myFlash.setAttribute('type','application/x-shockwave-flash'); myFlash.setAttribute('id', name); for(key in flashParamsNames){ var myTempParam = document.createElement('param'); myTempParam.setAttribute('name',flashParamsNames[key]); myTempParam.setAttribute('value',flashParamsValues[key]); myFlash.appendChild(myTempParam); } if( visible == 0) { myFlash.style.visibility = 'hidden'; } } else { var myFlash = document.createElement("div"); myFlash.setAttribute('id', name); myFlash.setAttribute('width',width); myFlash.setAttribute('height',height); myFlash.innerHTML = ''; myFlash.innerHTML += ''; for(key in flashParamsNames){ myFlash.innerHTML += ''; } myFlash.innerHTML += ''; myFlash.innerHTML += ''; } createWidget(name+'_Container',father,myFlash,horiz,vert,x,y,width,height,"eyeFlash",cent); } function Hidden_show(params,name,father,x,y,horiz,vert,checknum,cent) { var text = params["text"]; var myHidden = document.createElement('input'); myHidden.setAttribute('type','hidden'); if(text) { myHidden.value = text; } myHidden.setAttribute('id',name); myHidden.className = 'eyeHidden'; createWidget(name+'_Container',father,myHidden,horiz,vert,x,y,-1,-1,"eyeTextboxContainer",cent); } function Icon_show(params,name,father,x,y,horiz,vert,checknum) { var text = params["text"]; var image = params["image"]; var draggable = params["draggable"]; var onclick = params["onclick"]; var content = params["content"]; var myWidth = params["width"]; var myHeight = params["height"]; var myOnLoad = params["myonload"]; var realname = params["realname"]; var overBorder = params["overBorder"]; var myGlobalContainer = document.createElement('div'); myGlobalContainer.style.width='65px'; myGlobalContainer.setAttribute('id',name+'_globalContainer'); var myImage = document.createElement('img'); if(myOnLoad != "") { myImage.onload=function(){eval(myOnLoad);}; } myImage.src = image; myImage.setAttribute('id','img_'+name); myImage.className = 'eyeIcon_Image'; if(myWidth > 0) { myImage.setAttribute('width',myWidth); } if(myHeight > 0) { myImage.setAttribute('height',myHeight); } var myIconText = document.createElement('div'); myIconText.className = 'eyeIcon_Text'; myIconText.setAttribute('align','center'); myIconText.setAttribute('id',name+'_text'); myIconText.style.width = '65px'; text = tinyMCE.entityDecode(text); var theText = document.createTextNode(text); myIconText.appendChild(theText); myGlobalContainer.appendChild(myImage); myGlobalContainer.appendChild(myIconText); var myContent = document.createElement('input'); myContent.setAttribute('type', 'hidden'); myContent.setAttribute('id',name+'_Content'); myContent.value = content; myGlobalContainer.appendChild(myContent); realname = tinyMCE.entityDecode(realname); if(overBorder != 0) { myGlobalContainer.onmouseover = function() { myGlobalContainer.style.border = '1px solid #dddddd'; myIconText.innerHTML = ""; myIconText.appendChild(document.createTextNode(realname)); } myGlobalContainer.onmouseout = function() { myGlobalContainer.style.border = '1px solid #ffffff'; myIconText.innerHTML = ""; myIconText.appendChild(document.createTextNode(text)); } myGlobalContainer.style.border = '1px solid #ffffff'; } createWidget(name+'_Container',father,myGlobalContainer,horiz,vert,x,y,-1,-1,"eyeIcon",0); if (draggable==1) { makeDrag(name+'_Container',father,'iconDragUpdate',checknum,content,1); } if(onclick==1){ myGlobalContainer.onclick = function(){ var myContent = getArrayArg(content); var result = ''; for (var i in myContent) { result += eyeParam('arg'+i,tinyMCE.entityDecode(myContent[i])); } sendMsg(checknum,'Icon_Clicked',result); } } } function iconDragUpdate(widgetid,ancientX,ancientY,newX,newY,checknum,content) { var movedX = newX - ancientX; var movedY = newY - ancientY; myContent = getArrayArg(content); var result=""; for (var i in myContent) { result += eyeParam('arg'+i,tinyMCE.entityDecode(myContent[i])); } if (movedX < 1 && movedX > (-1) && movedY < 1 && movedY > (-1)) { sendMsg(checknum,'Icon_Clicked',result); } else { var sendxml = eyeParam('eyeArg',eyeParam('content',content)+eyeParam('newX',newX)+eyeParam('newY',newY),1); sendMsg(checknum,'Icon_Moved',sendxml); } } function Iframe_show(params,name,father,x,y,horiz,vert,checknum,cent) { var url = params["url"]; var myheight = params["height"]; var mywidth = params["width"]; var scroll = params["scroll"]; var myFrame = document.createElement('iframe'); myFrame.setAttribute('id',name); myFrame.setAttribute('src',url); myFrame.setAttribute('width',mywidth); myFrame.setAttribute('height',myheight); myFrame.style.border='0px solid black'; myFrame.frameBorder='no'; if(scroll == 0) { myFrame.setAttribute('scrolling','no'); } createWidget(name+'_Container',father,myFrame,horiz,vert,x,y,-1,-1,"eyeIframe",cent); } function Imagebox_show(params,name,father,x,y,horiz,vert,checknum,cent) { var url = params["url"]; var visible = params["visible"]; var alt = params["alt"]; var myWidth = params["width"]; var myHeight = params["height"]; var myClass = params["cssClass"]; var sig = params["signal"]; var sync = params["sync"]; var dis = params["disableMsg"]; var myImage = document.createElement('img'); myImage.src=url; myImage.setAttribute('alt',alt); if(myWidth > 0) { myImage.setAttribute('width',myWidth); } if(myHeight > 0) { myImage.setAttribute('height',myHeight); } myImage.setAttribute('id',name); if(dis == 0) { myImage.onclick = function(){sendMsg(checknum,sig,eval(sync))}; } if(myClass != '') { createWidget(name+'_Container',father,myImage,horiz,vert,x,y,myWidth,myHeight,myClass,cent); } else { createWidget(name+'_Container',father,myImage,horiz,vert,x,y,myWidth,myHeight,"eyeImagebox",cent); } if (visible == 0) { var container = document.getElementById(name+'_Container'); container.style.visibility = 'hidden'; } } function Label_show(params,name,father,x,y,horiz,vert,checknum,cent) { var text = params["text"]; var visible = params["visible"]; var sync = params["sync"]; var dis = params["disablemsg"]; var sig = params["signal"]; var myLabel = document.createElement('div'); myLabel.setAttribute('id',name); if (visible == 0) { myLabel.style.visibility='hidden'; } if(dis == 0) { myLabel.onclick = function() {sendMsg(checknum,sig,eyeParam(name,text)+eval(sync))}; } text = tinyMCE.entityDecode(text); myLabel.appendChild(document.createTextNode(text)); createWidget(name+'_Container',father,myLabel,horiz,vert,x,y,-1,-1,"eyeLabel",cent); } function Radio_show(params,name,father,x,y,horiz,vert,checknum,cent) { var checked = params["checked"]; var enabled = params["enabled"]; var visible = params["visible"]; var content = getArrayArg(params["content"]); var myDiv = document.createElement("div"); var myRadio; var currentValue; for(i=0;i 0) { mySelect.style.width = mywidth+'px'; } mySelect.setAttribute('id',name); createWidget(name+'_Container',father,mySelect,horiz,vert,x,y,-1,-1,"eyeSelect",cent); } function Slider_show(params,name,father,x,y,horiz,vert,checknum,cent) { var minValue = params["minValue"]; var maxValue = params["maxValue"]; var currentValue = params["currentValue"]; var sliderInput = document.createElement('div'); sliderInput.setAttribute('class','slider-input'); sliderInput.setAttribute('name',name); sliderInput.setAttribute('id',name); createWidget(name+'_Container',father,sliderInput,horiz,vert,x,y,-1,-1,"slider",cent); var s = new Slider(document.getElementById(name+'_Container'),document.getElementById(name)); s.setMinimum(minValue); s.setMaximum(maxValue); s.setValue(currentValue); } function Range() { this._value = 0; this._minimum = 0; this._maximum = 100; this._extent = 0; this._isChanging = false; } Range.prototype.setValue = function (value) { value = Math.round(parseFloat(value)); if (isNaN(value)) return; if (this._value != value) { if (value + this._extent > this._maximum) this._value = this._maximum - this._extent; else if (value < this._minimum) this._value = this._minimum; else this._value = value; if (!this._isChanging && typeof this.onchange == "function") this.onchange(); } }; Range.prototype.getValue = function () { return this._value; }; Range.prototype.setExtent = function (extent) { if (this._extent != extent) { if (extent < 0) this._extent = 0; else if (this._value + extent > this._maximum) this._extent = this._maximum - this._value; else this._extent = extent; if (!this._isChanging && typeof this.onchange == "function") this.onchange(); } }; Range.prototype.getExtent = function () { return this._extent; }; Range.prototype.setMinimum = function (minimum) { if (this._minimum != minimum) { var oldIsChanging = this._isChanging; this._isChanging = true; this._minimum = minimum; if (minimum > this._value) this.setValue(minimum); if (minimum > this._maximum) { this._extent = 0; this.setMaximum(minimum); this.setValue(minimum) } if (minimum + this._extent > this._maximum) this._extent = this._maximum - this._minimum; this._isChanging = oldIsChanging; if (!this._isChanging && typeof this.onchange == "function") this.onchange(); } }; Range.prototype.getMinimum = function () { return this._minimum; }; Range.prototype.setMaximum = function (maximum) { if (this._maximum != maximum) { var oldIsChanging = this._isChanging; this._isChanging = true; this._maximum = maximum; if (maximum < this._value) this.setValue(maximum - this._extent); if (maximum < this._minimum) { this._extent = 0; this.setMinimum(maximum); this.setValue(this._maximum); } if (maximum < this._minimum + this._extent) this._extent = this._maximum - this._minimum; if (maximum < this._value + this._extent) this._extent = this._maximum - this._value; this._isChanging = oldIsChanging; if (!this._isChanging && typeof this.onchange == "function") this.onchange(); } }; Range.prototype.getMaximum = function () { return this._maximum; }; Slider.isSupported = typeof document.createElement != "undefined" && typeof document.documentElement != "undefined" && typeof document.documentElement.offsetWidth == "number"; function Slider(oElement, oInput, sOrientation) { if (!oElement) return; this._orientation = sOrientation || "horizontal"; this._range = new Range(); this._range.setExtent(0); this._blockIncrement = 10; this._unitIncrement = 1; this._timer = new Timer(100); if (Slider.isSupported && oElement) { this.document = oElement.ownerDocument || oElement.document; this.element = oElement; this.element.slider = this; this.element.unselectable = "on"; // add class name tag to class name this.element.className = this._orientation + " " + this.classNameTag + " " + this.element.className; // create line this.line = this.document.createElement("DIV"); this.line.className = "line"; this.line.unselectable = "on"; this.line.appendChild(this.document.createElement("DIV")); this.element.appendChild(this.line); // create handle this.handle = this.document.createElement("DIV"); this.handle.className = "handle"; this.handle.unselectable = "on"; this.handle.appendChild(this.document.createElement("DIV")); this.handle.firstChild.appendChild( this.document.createTextNode(String.fromCharCode(160))); this.element.appendChild(this.handle); } this.input = oInput; // events var oThis = this; this._range.onchange = function () { oThis.recalculate(); if (typeof oThis.onchange == "function") oThis.onchange(); }; if (Slider.isSupported && oElement) { this.element.onfocus = Slider.eventHandlers.onfocus; this.element.onblur = Slider.eventHandlers.onblur; this.element.onmousedown = Slider.eventHandlers.onmousedown; this.element.onmouseover = Slider.eventHandlers.onmouseover; this.element.onmouseout = Slider.eventHandlers.onmouseout; this.element.onkeydown = Slider.eventHandlers.onkeydown; this.element.onkeypress = Slider.eventHandlers.onkeypress; this.element.onmousewheel = Slider.eventHandlers.onmousewheel; this.handle.onselectstart = this.element.onselectstart = function () { return false; }; this._timer.ontimer = function () { oThis.ontimer(); }; // extra recalculate for ie window.setTimeout(function() { oThis.recalculate(); }, 1); } else { this.input.onchange = function (e) { oThis.setValue(oThis.input.value); }; } } Slider.eventHandlers = { // helpers to make events a bit easier getEvent: function (e, el) { if (!e) { if (el) e = el.document.parentWindow.event; else e = window.event; } if (!e.srcElement) { var el = e.target; while (el != null && el.nodeType != 1) el = el.parentNode; e.srcElement = el; } if (typeof e.offsetX == "undefined") { e.offsetX = e.layerX; e.offsetY = e.layerY; } return e; }, getDocument: function (e) { if (e.target) return e.target.ownerDocument; return e.srcElement.document; }, getSlider: function (e) { var el = e.target || e.srcElement; while (el != null && el.slider == null) { el = el.parentNode; } if (el) return el.slider; return null; }, getLine: function (e) { var el = e.target || e.srcElement; while (el != null && el.className != "line") { el = el.parentNode; } return el; }, getHandle: function (e) { var el = e.target || e.srcElement; var re = /handle/; while (el != null && !re.test(el.className)) { el = el.parentNode; } return el; }, // end helpers onfocus: function (e) { var s = this.slider; s._focused = true; s.handle.className = "handle hover"; }, onblur: function (e) { var s = this.slider s._focused = false; s.handle.className = "handle"; }, onmouseover: function (e) { e = Slider.eventHandlers.getEvent(e, this); var s = this.slider; if (e.srcElement == s.handle) s.handle.className = "handle hover"; }, onmouseout: function (e) { e = Slider.eventHandlers.getEvent(e, this); var s = this.slider; if (e.srcElement == s.handle && !s._focused) s.handle.className = "handle"; }, onmousedown: function (e) { e = Slider.eventHandlers.getEvent(e, this); var s = this.slider; if (s.element.focus) s.element.focus(); Slider._currentInstance = s; var doc = s.document; if (doc.addEventListener) { doc.addEventListener("mousemove", Slider.eventHandlers.onmousemove, true); doc.addEventListener("mouseup", Slider.eventHandlers.onmouseup, true); } else if (doc.attachEvent) { doc.attachEvent("onmousemove", Slider.eventHandlers.onmousemove); doc.attachEvent("onmouseup", Slider.eventHandlers.onmouseup); doc.attachEvent("onlosecapture", Slider.eventHandlers.onmouseup); s.element.setCapture(); } if (Slider.eventHandlers.getHandle(e)) { // start drag Slider._sliderDragData = { screenX: e.screenX, screenY: e.screenY, dx: e.screenX - s.handle.offsetLeft, dy: e.screenY - s.handle.offsetTop, startValue: s.getValue(), slider: s }; } else { var lineEl = Slider.eventHandlers.getLine(e); s._mouseX = e.offsetX + (lineEl ? s.line.offsetLeft : 0); s._mouseY = e.offsetY + (lineEl ? s.line.offsetTop : 0); s._increasing = null; s.ontimer(); } }, onmousemove: function (e) { e = Slider.eventHandlers.getEvent(e, this); if (Slider._sliderDragData) { // drag var s = Slider._sliderDragData.slider; var boundSize = s.getMaximum() - s.getMinimum(); var size, pos, reset; if (s._orientation == "horizontal") { size = s.element.offsetWidth - s.handle.offsetWidth; pos = e.screenX - Slider._sliderDragData.dx; reset = Math.abs(e.screenY - Slider._sliderDragData.screenY) > 100; } else { size = s.element.offsetHeight - s.handle.offsetHeight; pos = s.element.offsetHeight - s.handle.offsetHeight - (e.screenY - Slider._sliderDragData.dy); reset = Math.abs(e.screenX - Slider._sliderDragData.screenX) > 100; } s.setValue(reset ? Slider._sliderDragData.startValue : s.getMinimum() + boundSize * pos / size); return false; } else { var s = Slider._currentInstance; if (s != null) { var lineEl = Slider.eventHandlers.getLine(e); s._mouseX = e.offsetX + (lineEl ? s.line.offsetLeft : 0); s._mouseY = e.offsetY + (lineEl ? s.line.offsetTop : 0); } } }, onmouseup: function (e) { e = Slider.eventHandlers.getEvent(e, this); var s = Slider._currentInstance; var doc = s.document; if (doc.removeEventListener) { doc.removeEventListener("mousemove", Slider.eventHandlers.onmousemove, true); doc.removeEventListener("mouseup", Slider.eventHandlers.onmouseup, true); } else if (doc.detachEvent) { doc.detachEvent("onmousemove", Slider.eventHandlers.onmousemove); doc.detachEvent("onmouseup", Slider.eventHandlers.onmouseup); doc.detachEvent("onlosecapture", Slider.eventHandlers.onmouseup); s.element.releaseCapture(); } if (Slider._sliderDragData) { // end drag Slider._sliderDragData = null; } else { s._timer.stop(); s._increasing = null; } Slider._currentInstance = null; }, onkeydown: function (e) { e = Slider.eventHandlers.getEvent(e, this); //var s = Slider.eventHandlers.getSlider(e); var s = this.slider; var kc = e.keyCode; switch (kc) { case 33: // page up s.setValue(s.getValue() + s.getBlockIncrement()); break; case 34: // page down s.setValue(s.getValue() - s.getBlockIncrement()); break; case 35: // end s.setValue(s.getOrientation() == "horizontal" ? s.getMaximum() : s.getMinimum()); break; case 36: // home s.setValue(s.getOrientation() == "horizontal" ? s.getMinimum() : s.getMaximum()); break; case 38: // up case 39: // right s.setValue(s.getValue() + s.getUnitIncrement()); break; case 37: // left case 40: // down s.setValue(s.getValue() - s.getUnitIncrement()); break; } if (kc >= 33 && kc <= 40) { return false; } }, onkeypress: function (e) { e = Slider.eventHandlers.getEvent(e, this); var kc = e.keyCode; if (kc >= 33 && kc <= 40) { return false; } }, onmousewheel: function (e) { e = Slider.eventHandlers.getEvent(e, this); var s = this.slider; if (s._focused) { s.setValue(s.getValue() + e.wheelDelta / 120 * s.getUnitIncrement()); // windows inverts this on horizontal sliders. That does not // make sense to me return false; } } }; Slider.prototype.classNameTag = "dynamic-slider-control", Slider.prototype.setValue = function (v) { this._range.setValue(v); this.input.value = this.getValue(); }; Slider.prototype.getValue = function () { return this._range.getValue(); }; Slider.prototype.setMinimum = function (v) { this._range.setMinimum(v); this.input.value = this.getValue(); }; Slider.prototype.getMinimum = function () { return this._range.getMinimum(); }; Slider.prototype.setMaximum = function (v) { this._range.setMaximum(v); this.input.value = this.getValue(); }; Slider.prototype.getMaximum = function () { return this._range.getMaximum(); }; Slider.prototype.setUnitIncrement = function (v) { this._unitIncrement = v; }; Slider.prototype.getUnitIncrement = function () { return this._unitIncrement; }; Slider.prototype.setBlockIncrement = function (v) { this._blockIncrement = v; }; Slider.prototype.getBlockIncrement = function () { return this._blockIncrement; }; Slider.prototype.getOrientation = function () { return this._orientation; }; Slider.prototype.setOrientation = function (sOrientation) { if (sOrientation != this._orientation) { if (Slider.isSupported && this.element) { // add class name tag to class name this.element.className = this.element.className.replace(this._orientation, sOrientation); } this._orientation = sOrientation; this.recalculate(); } }; Slider.prototype.recalculate = function() { if (!Slider.isSupported || !this.element) return; var w = this.element.offsetWidth; var h = this.element.offsetHeight; var hw = this.handle.offsetWidth; var hh = this.handle.offsetHeight; var lw = this.line.offsetWidth; var lh = this.line.offsetHeight; // this assumes a border-box layout if (this._orientation == "horizontal") { this.handle.style.left = (w - hw) * (this.getValue() - this.getMinimum()) / (this.getMaximum() - this.getMinimum()) + "px"; this.handle.style.top = (h - hh) / 2 + "px"; this.line.style.top = (h - lh) / 2 + "px"; this.line.style.left = hw / 2 + "px"; //this.line.style.right = hw / 2 + "px"; this.line.style.width = Math.max(0, w - hw - 2)+ "px"; this.line.firstChild.style.width = Math.max(0, w - hw - 4)+ "px"; } else { this.handle.style.left = (w - hw) / 2 + "px"; this.handle.style.top = h - hh - (h - hh) * (this.getValue() - this.getMinimum()) / (this.getMaximum() - this.getMinimum()) + "px"; this.line.style.left = (w - lw) / 2 + "px"; this.line.style.top = hh / 2 + "px"; this.line.style.height = Math.max(0, h - hh - 2) + "px"; //hard coded border width //this.line.style.bottom = hh / 2 + "px"; this.line.firstChild.style.height = Math.max(0, h - hh - 4) + "px"; //hard coded border width } }; Slider.prototype.ontimer = function () { var hw = this.handle.offsetWidth; var hh = this.handle.offsetHeight; var hl = this.handle.offsetLeft; var ht = this.handle.offsetTop; if (this._orientation == "horizontal") { if (this._mouseX > hl + hw && (this._increasing == null || this._increasing)) { this.setValue(this.getValue() + this.getBlockIncrement()); this._increasing = true; } else if (this._mouseX < hl && (this._increasing == null || !this._increasing)) { this.setValue(this.getValue() - this.getBlockIncrement()); this._increasing = false; } } else { if (this._mouseY > ht + hh && (this._increasing == null || !this._increasing)) { this.setValue(this.getValue() - this.getBlockIncrement()); this._increasing = false; } else if (this._mouseY < ht && (this._increasing == null || this._increasing)) { this.setValue(this.getValue() + this.getBlockIncrement()); this._increasing = true; } } this._timer.start(); }; function Timer(nPauseTime) { this._pauseTime = typeof nPauseTime == "undefined" ? 1000 : nPauseTime; this._timer = null; this._isStarted = false; } Timer.prototype.start = function () { if (this.isStarted()) this.stop(); var oThis = this; this._timer = window.setTimeout(function () { if (typeof oThis.ontimer == "function") oThis.ontimer(); }, this._pauseTime); this._isStarted = false; }; Timer.prototype.stop = function () { if (this._timer != null) window.clearTimeout(this._timer); this._isStarted = false; }; Timer.prototype.isStarted = function () { return this._isStarted; }; Timer.prototype.getPauseTime = function () { return this._pauseTime; }; Timer.prototype.setPauseTime = function (nPauseTime) { this._pauseTime = nPauseTime; }; function Sortabletable_show(params,name,father,x,y,horiz,vert,checknum,cent) { var visible = params["visible"]; var myTheader = getArrayArg(params["theader"]); var width = params["width"]; var height = params["height"]; var sizeUnit = params["sizeUnit"]; var signal = params["signal"]; var sortypes = getArrayArg(params["sortypes"]); var master = params["master"]; var realName = params["realName"]; var oTable = document.createElement("TABLE"); var oTHead = document.createElement("THEAD"); var oTBody = document.createElement("TBODY"); var widget = document.createElement('div'); widget.style.width=width+sizeUnit; widget.style.height=height+sizeUnit; widget.className='sort-table-container'; var oRow, oCell; var i,j; var myRows; var strSortypes = '['; var myHiddens = new Array(); for(keyVar in sortypes) { if(sortypes[keyVar] == 'Hidden') { myHiddens[keyVar] = 1; } else { myHiddens[keyVar] = 0; } if(strSortypes == '[') { strSortypes += '"'+sortypes[keyVar]+'"'; } else { strSortypes += ',"'+sortypes[keyVar]+'"'; } } strSortypes += ']'; //create the header oRow = document.createElement("TR"); for(i=0;i descending, false -> ascending SortableTable.prototype.defaultDescending = false; // shared between all instances. This is intentional to allow external files // to modify the prototype SortableTable.prototype._sortTypeInfo = {}; SortableTable.prototype.setTable = function (oTable) { if ( this.tHead ) this.uninitHeader(); this.element = oTable; this.setTHead( oTable.tHead ); this.setTBody( oTable.tBodies[0] ); }; SortableTable.prototype.setTHead = function (oTHead) { if (this.tHead && this.tHead != oTHead ) this.uninitHeader(); this.tHead = oTHead; this.initHeader( this.sortTypes ); }; SortableTable.prototype.addEntry = function(entry) { var myEntry = getArrayArg(entry); var oRow = document.createElement("TR"); var i=0; var oCell=0; var sortypes = this.normalSort; var myHiddens = new Array(); var myHtml = new Array(); for(keyVar in sortypes) { if(sortypes[keyVar] == 'Hidden') { myHiddens[keyVar] = 1; } else { myHiddens[keyVar] = 0; } if(sortypes[keyVar] == 'Html') { myHtml[keyVar] = 1; } else if(sortypes[keyVar] == 'HtmlButNoSort') { myHtml[keyVar] = 1; } else { myHtml[keyVar] = 0; } } for(i=0;i