|
From: <sv...@de...> - 2005-06-14 18:06:57
|
Author: pcamacho Date: 2005-06-14 14:06:59 -0400 (Tue, 14 Jun 2005) New Revision: 1320 Added: humano2/trunk/web/builder/site/js/grafcomponents/expandform.js Removed: humano2/trunk/web/builder/site/js/grafcomponents/expandformreport.js Log: CHANGE: name of file. Now not everything's perfect but much more things w= ork. Copied: humano2/trunk/web/builder/site/js/grafcomponents/expandform.js (f= rom rev 1314, humano2/trunk/web/builder/site/js/grafcomponents/expandform= report.js) Deleted: humano2/trunk/web/builder/site/js/grafcomponents/expandformrepor= t.js =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- humano2/trunk/web/builder/site/js/grafcomponents/expandformreport.js = 2005-06-14 18:02:49 UTC (rev 1319) +++ humano2/trunk/web/builder/site/js/grafcomponents/expandformreport.js = 2005-06-14 18:06:59 UTC (rev 1320) @@ -1,269 +0,0 @@ -// -// The Humano2 Business solution. -// Copyright (C) 2004,5 Humano2 Chile S.A. (http://www.humano2.com) -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. =20 -// -// - - -/** - * Constructor - * @param line object that contains the fields to display for each line = and that also contains preselected values - */ -function ExpandForm(selfRefName,receptorNode,title,inputLine) -{ - //Fields - this.selfRefName =3D selfRefName; - this.receptorNode =3D receptorNode; - this.inputLine =3D inputLine; - =20 - //this.optionArray1 =3D new Array(); - //this.optionArray2 =3D new Array(); - this.title =3D title; - - =20 - //Methods - this.PutAllComponents =3D ExpandFormPutAllComponents; - this.AddLine =3D ExpandFormAddLine; - this.RemoveLine =3D ExpandFormRemoveLine; - this.ReturnValues =3D ExpandFormReturnValues; - this.GetReceptorNode =3D ExpandFormGetReceptorNode; - this.GetSelfRefName =3D ExpandFormGetSelfRefName; - this.GetTitle =3D ExpandFormGetTitle; - =20 - this.PutAllComponents(receptorNode); - =20 - return this; =20 -} - - -/** - * This function adds a line to the expand form but - * with preselect values - */ -function ExpandFormAddLine(index) -{ - var divReceptor =3D GetNodeByTagNameAndAttName("div",this.selfRefNam= e)[0]; //Unique id in the document as every - = // graphical components should have unique identificator - //alert("divReceptor: " + divReceptor); - var lineNumber =3D divReceptor.childNodes.length; - =20 - var innerHtml =3D ""; - =20 - if(index !=3D null) - { - innerHtml =3D this.inputLine.GetPreselectedLineHtml(index,lineNum= ber); =20 - } - else - { - innerHtml =3D this.inputLine.GetEmptyLineHtml(lineNumber); - } - =20 - var divLine =3D document.createElement("div"); - =20 - divLine.innerHTML =3D innerHtml; - =20 - //alert("divLine.childNodes.length: " + divLine.childNodes.length) - //alert("innerHtml: " + innerHtml); - //Add the line - divReceptor.appendChild(divLine); -} - - -/** - * Should be conform to viewtools norm - */ -function ExpandFormReturnValues() -{ =20 - var res =3D ""; - - var divWithLines =3D GetNodeByTagNameAndAttName("div",this.selfRefNa= me)[0]; //Unique id in the document as every - = // graphical components should have unique identificator - var node =3D divWithLines.firstChild; - //alert("divWithLines.firstChild.childNodes.length: " + divWithLines= .firstChild.childNodes.length); - //alert("divWithLines.firstChild.innerHTML: " + divWithLines.firstCh= ild.innerHTML) - while(node !=3D null) - { - =20 - //Here we must get the input value moreover - //CAUTION: we start from the second child because the first is a= text node (title) !!!! - var divFirstSelect =3D node.firstChild.nextSibling; - var divSecondSelect =3D divFirstSelect.nextSibling; - var divThirdSelect =3D divSecondSelect.nextSibling; - =20 - ///FIXME: this code should be inside inputline - =20 - if((divFirstSelect.value !=3D -1) && (divSecondSelect.value!=3D = -1)) //Verify if something has been selected - { - if(this.inputLine.type =3D=3D 'TWOSELECTANDINPUT') - { - //alert("divFirstSelect:" + divFirstSelect); - res +=3D divFirstSelect.value + "|"; - //alert("divSecondSelect:" + divSecondSelect); - res +=3D divSecondSelect.value + "|"; - var divInput =3D divSecondSelect.nextSibling; - //alert("divInput:" + divInput); - res +=3D "\'" + divInput.value + "\'"; - } - =20 - =20 - if(this.inputLine.type =3D=3D 'THREESELECTANDINPUT') - { - //alert("divFirstSelect:" + divFirstSelect); - res +=3D divFirstSelect.value + "|"; - //alert("divSecondSelect:" + divSecondSelect); - res +=3D divSecondSelect.value + "|"; - res +=3D divThirdSelect.value + "|"; - var divInput =3D divThirdSelect.nextSibling; - //alert("divInput:" + divInput); - res +=3D "\'" + divInput.value + "\'"; - } - =20 - if(this.inputLine.type =3D=3D 'TWOSELECT') - { - //alert("divFirstSelect:" + divFirstSelect); - res +=3D divFirstSelect.value + "|"; =20 - //alert("divSecondSelect:" + divSecondSelect); - res +=3D divSecondSelect.value; =20 - } - res+=3D ";"; //Separator between two lines - } - node =3D node.nextSibling; - } - =20 - res =3D res.substring(0,res.length-1);//remove last ; - =20 - //alert("res:" + res); - return res; -} - - -function ExpandFormRemoveLine() -{ - var divReceptor =3D GetNodeByTagNameAndAttName("div",this.selfRefNam= e)[0]; //Unique id in the document as every - = // graphical components should have uni - if(divReceptor.childNodes.length =3D=3D 0) //Nothing ot remove - { - return; =20 - } - =20 - divReceptor.removeChild(divReceptor.lastChild); =20 - =20 - return divReceptor.childNodes.length; -} - -function ExpandFormGetTitle() -{ - return this.title; =20 -} - -function ExpandFormPutAllComponents() -{ - var innerHtml =3D=20 - "<table>" =20 - + "<tr>" - + "<td valign=3D\"top\">" - + "<div id=3D\"" + this.selfRefName +"\" name=3D\"= " + this.selfRefName + "\" >" //Id that will contain the form lines - + "</div>" - + "</td>" - + "<td valign=3D\"top\">" - + "<center>" - + "<input type=3D\"button\" value=3D\"Add criteria= \" onclick=3D\"" + this.selfRefName +".AddLine();\"></input>" - + "<br/>" - + "<input type=3D\"button\" value=3D\"Remove\" onc= lick=3D\"" + this.selfRefName +".RemoveLine();\">" - + "</center>"; - + "</td>" - + "</tr>" - + "</table>"; - =20 - //alert("innerHTML:" + innerHtml); - this.receptorNode.innerHTML =3D innerHtml; =20 - =20 - //Add lines with preselected values if inputValues exists - if(this.inputLine.HasPreselected() =3D=3D true) - { - var i; - var nbPreselected =3D this.inputLine.GetNumberOfPreselected(); - //alert("size inputs: " + this.inputValues.Size()); - for(i=3D0; i < nbPreselected;i++) - { - this.AddLine(i); - } - } - else - { - this.AddLine(); //Add empty line - } -} - -function ExpandFormGetReceptorNode() -{ - return this.receptorNode; =20 -} - -function ExpandFormGetSelfRefName() -{ - return this.selfRefName; -} - -function ExpandFormTest() -{ - /////////////////////////////////////////////// - TestGroupWrite("ExpandFormTest"); - =20 - =20 - var divReceptor =3D GetNodeByTagNameAndAttName("div","ExpandForm")[0= ];=20 - var divInsideReceptor =3D document.createElement("div"); - divReceptor.appendChild(divInsideReceptor); - =20 - var buttonShowValues =3D document.createElement("div"); - buttonShowValues.innerHTML =3D "<input type=3D\"button\" value=3D\"G= et values\" onclick=3D\"aExpandForm.ReturnValues();\"></input>"; - =20 - divReceptor.appendChild(buttonShowValues); - =20 - =20 - //Preselected values - var select0Arr =3D new Array(); - select0Arr[0] =3D new Array(); - select0Arr[0]["text"] =3D 'attribute0'; - select0Arr[0]["value"] =3D 'att0'; - =20 - select0Arr[1] =3D new Array(); - select0Arr[1]["text"] =3D 'attribute1'; - select0Arr[1]["value"] =3D 'att1'; - =20 - select0Arr[2] =3D new Array(); - select0Arr[2]["text"] =3D 'attribute2'; - select0Arr[2]["value"] =3D 'att2'; - =20 - var select1Arr =3D new Array(); - select1Arr[0] =3D new Array(); - select1Arr[0]["text"] =3D 'EqualTo'; - select1Arr[0]["value"] =3D '4'; - =20 - select1Arr[1] =3D new Array(); - select1Arr[1]["text"] =3D 'GreaterThan'; - select1Arr[1]["value"] =3D '5'; - =20 - var InputLineParams =3D - { - type: 'TWOSELECTANDINPUT', - select0: select0Arr, - select1: select1Arr, - input0: '', - PreselectedInput0: new Array('hola','hola2'), - PreselectedSelect0: new Array(0,2), - PreselectedSelect1: new Array(1,0), - refName: 'aExpandForm' - } - - anInputLine =3D new InputLine(InputLineParams); - =20 - aExpandForm =3D new ExpandForm("aExpandForm",divInsideReceptor,"Expa= ndFormReport",anInputLine); -} - - |