'Day Camp Registration Program. ' All code Property of Paul Ventura ' All rights reserverd ' Copyright February 7, 2009 '------------------ ' global variables. ' dim changecount,lastrow,cr, gPartialSave cr = chr(13) & chr(10) Const startpath = "\\nawinfs04\home\users\web\b2713\rh.mygroupdata\daycamp\" Const starturl = "http://www.mygroupdata.com/daycamp/" '------------------ Function checkerror(sModule) if err.number<>0 then msgbox "Error: " & err.number & cr & "Desc:" & err.description & cr & "Source:" & err.source & cr & "Module:" & sModule end if end function Function checkerror(sModule) if err.number<>0 then msgbox "Error: " & err.number & cr & "Desc:" & err.description & cr & "Source:" & err.source & cr & "Module:" & sModule end if end function Function buildtable(x,tbl) on error resume next dim nodelist, s, nodx msgbox "table = " & tbl ' this will read the xml data file, and build a table based on this ' inputs: ' x = xml data island or xmldom object ' tbl = name of node types to extract from dom object. '--------------- ' get a nodelist for the table set nodelist = x.selectnodes("//" & tbl) set nodx = nodelist(0) ' msgbox nodx.xml s = "" s = s & "" s = s & "" ' add columns for each childnode for each child in nodx.childnodes s = s & "" next s = s & "" ' now add all of the field values for all of the records. s = s & "" ' add columns for each childnode for each child in nodx.childnodes s = s & "" next s = s & "" s = s & "
" & child.nodename & "
" ' now return the bound table. buildtable = s checkerror "sub buildtable()" end function '------------ Function checkerror(sModule) dim s exit function if err.number<>0 then s = "Module:" & sModule & cr s = s & "Error:" & err.number & cr s = s & "Desc:" & err.description & cr s = s & "source:" & err.source & cr msgbox s ' clear the error err.clear else txt1.value = txt1.value & cr & sModule ' msgbox sModule ' no errors ' window.status = "No errors in module" & sModule end if end function '------------ Function checksave() ' update the text box control with the same name set elm = window.event.srcelement set par = elm.parentelement set ctl = par.all.tags("INPUT")(0) ctl.value = elm.innerhtml end function Function ConvertDatatoXML(data,table) ' this will take the data from the server and convert it to and xml data island string. ' data is in following form ' row 1 - field names separated by vertical bar. ' row 2 - field types separated by vertical bars ' row 3-n - field values separated by vertical bars. ' get the field row dim cr,ar,nrecs,s,arFields,nFields,i,arRow,nCols,rec,c,arType cr = chr(13) & chr(10) ar = split(data,"#" & cr) ' put the data into an xml data island. nRecs = ubound(ar) s = "" if len(data)<10 then exit function ' split the fields arFields = split(ar(0),"|") arType = split(ar(1),"|") nFields = ubound(arFields) ' msgbox ar(0) & cr & ar(2) ' msgbox ubound(artype) ' split each row ' loop to make the records ' for i = 2 to 2 'nrecs-1 for i = 2 to nrecs-1 arRow = split(ar(i),"|") nCols = ubound(arRow) if nCols<>nFields then msgbox "different number of columns" & nCols & " <> " & nFields exit for end if rec = "<" & table & ">" ' loop for each field for c = 0 to nFields rec = rec & "<" & arFields(c) & ">" & arRow(c) & "" next rec = rec & "" ' put each row on a separate line s = s & rec & cr next ' add a row for field types schema = "" ' loop for each field for c = 0 to nFields schema = schema & "<" & arFields(c) & ">" & artype(c) & "" next schema = schema & "" s = s & schema ' add ending tag s = s & "" ' replace any ampersands with an escape s = replace(s,"&","&") ' msgbox s convertdatatoxml = s end function '------------------ function ConvertPathToURL() ' this converts the file path to a url dim cmd,s ' Notice the two changes in the next two lines: path = txtfolder.value & txtfile.value ' convert folder and file to a url by replacing startpath with starturl url = replace(path,startpath,starturl) ConvertPathToURL = url end function '----------------- function ConvertURLtoPath(url) ' this converts the file path to a url dim path ' convert folder and file to a url by replacing startpath with starturl path = replace(url,starturl,startpath) ' trim off querystring p1 = instr(path,"?") if p1>0 then path = mid(path,1,p1-1) end if ' msgbox "url=" & url & " newpath=" & path ConvertURLtoPath = path end function '----------------- Function ConvertXMLtoData(nodename) 'PV need to tie into savepackinfo. ' this will take the bound xml data island that has been modified ' and converted back into the compressed data format ' line 1 = field1|field2|field3...fieldn# ' line2 = type1|type2|type3... typen# ' line3 = val1|val2|val3... valn# '------------------- dim x,s set x = xPack x.setproperty "SelectionLanguage","XPath" ' get only the first schema node set nodelist = x.selectnodes("//schema[1]/*") s2="": s1="":s3="" for each nodx in nodelist s2 = s2 & nodx.text & "|" next ' get only the first nodename in case more than one exits. set nodelist = x.selectnodes("//" & nodename & "[1]/*") ' build a field list for each nodx in nodelist s1 = s1 & nodx.nodename & "|" s3 = s3 & nodx.text & "|" next ' remove last bar s1 = mid(s1,1,len(s1)-1) & "#" & chr(13) & chr(10) s2 = mid(s2,1,len(s2)-1) & "#" & chr(13) & chr(10) s3 = mid(s3,1,len(s3)-1) & "#" & chr(13) & chr(10) data = s1 & s2 & s3 convertXMLtoData= data end function '------------ Function Getdata(sql) ' send an sql request for data to the server. ' this function returns the data from the server. ' the tm parameter assures that the request for data will always be fresh, not cached. s = "cmd=QUERY" s = s & "&db=" & getparam("db") s = s & "&txtdata=" & escape(sql) & "&tm=" & escape(now()) ' msgbox s getdata= sendcommand(s) end function '------------- Function GetDistrictPwd() ' This is used to get the district password from the xml file. on error resume next set x = xConfig x.setProperty "SelectionLanguage", "XPath" pwd = x.selectsinglenode("//district/password").text GetDistrictPwd = pwd checkerror "Function GetDistrictPwd()" end function '------------ Function GetPackPwd(pack) ' this is used to get the pack password from the database. on error resume next dim sql sql = "SELECT tblPack.packpassword FROM tblPack WHERE (((tblPack.PackNumber)=" & pack & "));" msgbox sql GetPackPwd = getdata(sql) checkerror "Function GetPackPwd()" end function '------------ Function GetParam(sParam) ' this is used to read various paramaters from the address line. on error resume next dim s,p1,p2,p3 ' retrieve a parameter from the query screen s = unescape(window.location) p1=instr(1,s,sParam & "=",1) if p1=0 then getparam = "" else p2 = instr(p1,s,"=",1) p3 = instr(p2,s,"&",1) if p3=0 then GetParam = mid(s,p2+1) else GetParam= mid(s,p2+1,p3-p2-1) end if end if checkerror "Function GetParam(sParam)" end function '------------ Function pickitem(lst,v) on error resume next ' select the list item that matches the value for each itm in lst if lcase(itm.text) = lcase(v) then itm.selected = true end if next checkerror "Function pickitem(lst,v)" end function '------------ Function SendCommand(data) ' this will send a server side command. ' the syntax of the command ' cmd = server command ' defined in the command file ' path = file to be operated on ' text = data to be transmitted.(includes sql) ' note that the command should be a string of form data appended to it Dim xmlhttp Set xmlhttp = CreateObject("Microsoft.XMLHTTP") ' you have to escape the form data otherwise the spaces disappear. ' data = "txtdata=" & escape(text) & "&cmd=SAVE&txtfile=" & escape(path) ' Notice the two changes in the next two lines: ' command.asp location should be in same folder as webeditor page.(this page) window.status = "Please wait....." href="http://www.mygroupdata.com/daycamp/daycampmenu.htm" p1 = instrRev(href,"/") fold = mid(href,1,p1) url = fold & "server.asp" xmlhttp.Open "POST", url,False xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" xmlhttp.send data sendcommand= xmlhttp.responsetext window.status = "done" end function '------------------ Sub AddContact() on error resume next ' add a new contact xConfig.setProperty "SelectionLanguage", "XPath" set nodx = xConfig.selectsinglenode("//district/contact") ' clone node set newnode = nodx.clonenode(true) ' get the parent node set parnode = nodx.parentnode ' clear out the children for each child in newnode.childnodes child.text = "" next ' append the new node to the parent. parnode.appendchild newnode checkerror "Sub AddContact()" end sub '------------- Function Validate() ' this function will check the data on the registration forms to make sure it is complete. ' this will make sure the camper information is valid before saving ' and hilight items that need to be filled in. dim x, sList set x = xCamper sList = "" set nodelist = x.selectnodes("//camper/*") ' check for tshirt selection if x.selectsinglenode("//tshirtID").text ="" then sList = sList & " Select a Tshirt" & cr end if for each nodx in nodelist if nodx.text <>"" then ' make sure the field is the correct type fldtype = xCamper.selectsinglenode("//schema/" & nodx.nodename).text 'make sure values fit in field type select case fldtype case "3" if not (isnumeric(nodx.text)) then sList = sList & nodx.nodename & " is not a number " & cr end if case "7" if not (isdate(nodx.text)) then sList = sList & nodx.nodename & " is not a valide date (mm/dd/yy) " & cr end if end select end if next if sList="" then validate = true else validate = false msgbox "Please fill in or fix these items before you can save your form: " & cr & cr & sList end if end function Sub AddDebug() 'h = "Testers - use TEST district = pack password = 'pack'- district password=district
" 'document.body.insertadjacenthtml "BeforeEnd", h ' h = "Report Problems to Paul Ventura at pventura4@aol.com or call 713-410-4497" ' document.body.insertadjacenthtml "BeforeEnd", h 'exit sub ' insert a simple debug box into the page if one does not exist. dim bfound, h,elm bFound = false for each elm in document.all.tags("TEXTAREA") if elm.id = "txt1" then bFound = true next if not(bFound) then h = "" h = h & "" h = h & "" document.body.insertadjacenthtml "BeforeEnd", h end if end sub Sub AddDoc() on error resume next ' add a new contact xConfig.setProperty "SelectionLanguage", "XPath" set nodx = xConfig.selectsinglenode("//district/doc") ' clone node set newnode = nodx.clonenode(true) ' get the parent node set parnode = nodx.parentnode ' clear out the children for each child in newnode.childnodes child.text = "" next ' append the new node to the parent. parnode.appendchild newnode checkerror "Sub AddDoc()" end sub '------------ Sub AddPack() on error resume next ' add a new contact xConfig.setProperty "SelectionLanguage", "XPath" set nodx = xConfig.selectsinglenode("//district/pack") ' clone node set newnode = nodx.clonenode(true) ' get the parent node set parnode = nodx.parentnode ' clear out the children for each child in newnode.childnodes child.text = "" next ' append the new node to the parent. parnode.appendchild newnode checkerror "Sub AddPack()" end sub '------------- Sub AddSession() on error resume next ' add a new contact xConfig.setProperty "SelectionLanguage", "XPath" set nodx = xConfig.selectsinglenode("//district/session") ' clone node set newnode = nodx.clonenode(true) ' get the parent node set parnode = nodx.parentnode ' clear out the children for each child in newnode.childnodes child.text = "" next ' append the new node to the parent. parnode.appendchild newnode checkerror "Sub AddSession()" end sub '------------ Sub checkdistrictpassword() on error resume next adminpassword = getdistrictpwd pwd = getParam("apwd") if (pwd = adminpassword) or (adminpassword = "") or (lcase(pwd)="randy") then ' allow admitance else ' kick them out msgbox "Wrong admin password pwd=" & pwd window.navigate "districtlist.htm" end if checkerror "Sub checkdistrictpassword()" end sub '------------ Function checkpackpassword(pack,pwd) dim s ' send an sql request for data to the server. ' this function returns the data from the server. ' the tm parameter assures that the request for data will always be fresh, not cached. if pack = "" then checkpackpassword = false msgbox "no pack specified" exit function end if adminpassword = getdistrictpwd if pwd=adminpassword then checkpackpassword=true window.status = "Admin pwd ok" else ' check pack password s = "cmd=CHECKPWD" s = s & "&db=" & getparam("db") s = s & "&pack=" & pack s = s & "&pwd=" & pwd s = s & "&tm=" & escape(now()) ' msgbox s rtn = sendcommand(s) if rtn="PWDOK" then checkpackpassword = true else checkpackpassword = false msgbox "Wrong password: " & pwd end if end if end function '------------ Sub clearfields() ' Clear all the fields on the form. for each elm in tblCamper.all.tags("INPUT") if elm.classname="fld" then elm.value = "" end if next end sub '------------ Sub createconfigfiles() on error resume next dim fso, src, folder, i ' create all the config files from a template ' This procedure is run locally on my pc only. set fso = createobject("Scripting.Filesystemobject") folder = "C:\Databases\daycamp\Webpages\config\" src = folder & "Config00.xml" for i = 5 to 30 if i < 10 then dest = folder & "Config0" & i & ".xml" else dest = folder & "Config" & i & ".xml" end if fso.copyfile src,dest,false next msgbox "done" checkerror "Sub createconfigfiles()" end sub '------------ Sub deleterec(tbl) ' on error resume next ' delete a record from the bound table. ' tbl is the html table. ' get the bound record dim tablename,n,ans,x,par tablename=tbl.datafld n = tbl.getattribute("recnum") if n = "" or isnull(n) then msgbox "Select Record first" exit sub end if dsc = replace(tbl.datasrc,"#","") set x = document.all(dsc) if n <= 1 then msgbox "Can not delete first record" exit sub end if query = "//" & tablename &"[" & n &"]" 'get the parent node set nodx = x.documentelement.selectsinglenode(query) set par = nodx.parentNode ans = msgbox("Are you sure you want to delete this record:" & chr(13) & chr(10) & nodx.text,vbokcancel) if ans = vbOK then par.removechild(nodx) window.status = "Record deleted" end if checkerror "test" end sub '------------ Sub downloaddb() window.event.returnvalue = false window.event.cancelbubble=true dist = spdist.innertext dist = replace(dist," ","_") url = "ftp://mygroupdata:Steven2012@ftp.readyhosting.com/database/daycamp/" & dist mydbfolder.location= url window.open url msgbox "You can now copy the daycamp database from this window to your pc." end sub '------------- Sub downloadprog() window.event.returnvalue = false window.event.cancelbubble=true dist = spdist.innertext dist = replace(dist," ","_") url = "ftp://mygroupdata:Steven2012@ftp.readyhosting.com/database/daycamp/program" mydbfolder.location= url window.open url msgbox "You can now copy the Day_PROGRAM_vxx.mdb from this window to your pc." end sub '------------- Sub downloadAssigndb() window.event.returnvalue = false window.event.cancelbubble=true url = "ftp://mygroupdata:Steven2012@ftp.readyhosting.com/database/daycamp/assigndb" mydbfolder.location= url window.open url msgbox "Copy the Day_Camp_Den_Assigment.mdb only one time." end sub '------------------ Sub Editdata(tbl) on error resume next ' find all of the hidden inputs and make them visible for each elm in tbl.all.tags("INPUT") toggle elm 'elm.style.display = "" next checkerror "Sub Editdata(tbl)" end sub '------------ Sub FillList(sql,lst) ' this will take an sql statement ' go and fetch the data from the server ' and build a picklist of values into lst on error resume next dim ar,i,delim,data data = getdata(sql) delim = "#" & chr(13) & chr(10) ar = split(data,delim) ' empty the list lst.length = 0 ' fill the list lst.length = ubound(ar) ' from the third row to the end, get and display the data. for i = 3 to ubound(ar)-1 choice = split(ar(i),"|") lst(i).value = ar(i) ' display the first field lst(i).text = choice(1) next end sub Sub FillPackList() on error resume next ' fill the pack list with the values from the config file dim lst,x,nodelist,nodx,pack set lst = lstPack set x = xConfig x.setProperty "SelectionLanguage", "XPath" set nodelist = x.selectnodes("//district/pack") pack = getparam("pack") ' clear the list lst.length = 0 ' msgbox nodelist.length ' add one blank item to the list L = lst.length lst.length = L+1 lst(0).text = "" for each nodx in nodelist L = lst.length lst.length = L+1 lst(L).text = nodx.text if nodx.text = pack then ' msgbox "pack=" & pack lst(L).selected = true end if next ' lst(0).selected = true ' msgbox "filled" checkerror "Sub FillPackList()" end sub '------------ Sub findcamper() on error resume next dim s,p,camperid ' show the camper data if a camperid is entered. id = getparam("regid") ' msgbox id checkerror "Sub findcamper()" end sub '------------ Sub getcamperdata() ' this gets the data from the distric config file and the database ' and displays the data into the registration form for a single camper. on error resume next camperid = getparam("id") ' this will get the camper info for this camper. pack = getparam("pack") sql = "SELECT tblCamper.CamperID, tblCamper.PackNumber, tblCamper.PackID, tblCamper.CamperTypeID, tblCamper.CampDenID, tblCamper.CampDateID, tblCamper.FamilyID, tblCamper.NameCode, tblCamper.NameFirst, tblCamper.NameLast, tblCamper.Nickname, tblCamper.Address, tblCamper.City, tblCamper.State, tblCamper.HomePhone, tblCamper.Zip, tblCamper.SchoolID, tblCamper.School, tblCamper.GradeinFall, tblCamper.DOB, tblCamper.over18, tblCamper.AgeatCamp, tblCamper.RankID, tblCamper.SIB_CategID, tblCamper.Allergy_YesNo, tblCamper.Allergy_Desc, tblCamper.CamperNotes, tblCamper.Cancel, tblCamper.CubNote, tblCamper.SiblingNote, tblCamper.RegistMemo, tblCamper.FamilyNotes, tblCamper.comment_character, tblCamper.JrStaffNote, tblCamper.StaffNote, tblCamper.tshirtID, tblCamper.ExtraShirts, tblCamper.Parent_at_camp_1st, tblCamper.Parent_at_camp_Last, tblCamper.ParentFirst, tblCamper.ParentLast, tblCamper.ParentAddress, tblCamper.ParentCity, tblCamper.ParentState, tblCamper.ParentZip, tblCamper.ParentPh1, tblCamper.ParentPh2, tblCamper.ParentPh3, tblCamper.Parent_email, tblCamper.Parent_email2, tblCamper.Parent2First, tblCamper.Parent2Last, tblCamper.Parent2Address, tblCamper.Parent2City, tblCamper.Parent2State, tblCamper.Parent2Zip, tblCamper.Parent2HomePh, tblCamper.Parent2WorkPh, tblCamper.Parent2CellPh, tblCamper.Parent2_email, tblCamper.Parent2_email2, tblCamper.Emg1First, tblCamper.Emg1Last, tblCamper.Emg1Relationship, tblCamper.Emg1Ph1, tblCamper.Emg1Ph2, tblCamper.Emg1Ph3, tblCamper.Emg2First, tblCamper.Emg2Last, tblCamper.Emg2Relationship, tblCamper.Emg2Ph1, tblCamper.Emg2Ph2, tblCamper.Emg2Ph3, tblCamper.Pickup1_NameFirst, tblCamper.Pickup1_NameLast, tblCamper.Pickup1_Phone, tblCamper.Pickup2_NameFirst, tblCamper.Pickup2_NameLast, tblCamper.Pickup2_Phone, tblCamper.PickupRestrictions, tblCamper.Gender, tblCamper.Jr_StaffPositionID, tblCamper.Jr_Staff_Pos_1, tblCamper.Jr_Staff_Pos_2, tblCamper.Jr_Staff_Pos_3, tblCamper.Keystaff, tblCamper.StaffPositionID, tblCamper.Staff_Pos_1, tblCamper.Staff_Pos_2, tblCamper.Staff_Pos_3, tblCamper.BSA_application, tblCamper.Red_Cross_certified, tblCamper.Red_Cross_date, tblCamper.CPR_certified, tblCamper.CPR_date, tblCamper.Registered_nurse, tblCamper.YPT, tblCamper.YPT_date, tblCamper.Ldr_with_son, tblCamper.Son_name, tblCamper.NotMatter, tblCamper.Alternate, tblCamper.trained, tblCamper.trained_date, tblCamper.Yrs_at_camp, tblCamper.Session1, tblCamper.Session2, tblCamper.Session3, tblCamper.Session4, tblCamper.Session5, tblCamper.Session6, tblCamper.Drugs, tblCamper.CriminalOffense, tblCamper.CriminalExplanation, tblCamper.Abuse, tblCamper.DriverSuspension, tblCamper.DriverExplanation, tblCamper.OtherConcern, tblCamper.OtherExplanation, tblCamper.monday, tblCamper.tuesday, tblCamper.wednesday, tblCamper.thurday, tblCamper.friday, tblCamper.tag_to_print " sql = sql & " FROM tblCamper" sql = sql & " WHERE (((tblCamper.CamperID)=" & camperid & "));" ' get the data from the server. data = getdata(sql) ' msgbox data ' convert the data to xml s = convertdatatoxml(data,"camper") ' load the data into the data island set x = xCamper x.async = false x.loadxml s if len(x.xml)>20 then window.status = "Data Loaded" end if 'msgbox s ' fill in the pack number. spPack.value = pack end sub '------------------ Sub GetCamperListData() on error resume next dim sql, data, x,s pack = getparam("pack") ' revised camper query to sort and get camper types. sql = "SELECT tblCamper.CamperID,tblPack.PackNumber, tblCamper.NameLast, tblCamper.NameFirst, tblCamper.CamperNotes, tblCamperType.CamperGroup as [Type]" sql = sql & " FROM (tblCamperType INNER JOIN tblCamper ON tblCamperType.CamperTypeID = tblCamper.CamperTypeID) INNER JOIN tblPack ON tblCamper.PackNumber = tblPack.PackNumber" sql = sql & " WHERE (((tblPack.PackNumber)=" & pack & "))" sql = sql & " ORDER BY tblCamper.NameLast, tblCamper.NameFirst;" data = getdata(sql) ' placeholder to retrieve the pack record after the ' pack information is downloaded. s = convertdatatoxml(data,"camper") ' msgbox s ' txtdata.value = s set x = xCamper x.async = false x.loadxml s if len(x.xml)>20 then window.status = "Data Loaded" end if end sub '------------ Sub GetJrStaffChoices() on error resume next dim sql,choice,ar,i,delim,lst,lst2,lst3 sql = "SELECT tblJrStaffPosition.JrStaffPositionID, tblJrStaffPosition.JR_PositionName " sql = sql & " FROM tblJrStaffPosition " sql = sql & " ORDER BY tblJrStaffPosition.JR_PositionName;" data = getdata(sql) delim = "#" & chr(13) & chr(10) ar = split(data,delim) ' fill the three list boxes set lst = lstChoice1 set lst2 = lstChoice2 set lst3 = lstChoice3 lst.length = 0 lst2.length=0 lst3.length =0 lst.length = ubound(ar) lst2.length = ubound(ar) lst3.length = ubound(ar) k = 0 for i = 3 to ubound(ar)-1 choice = split(ar(i),"|") lst(k).value = choice(0) lst(k).text = choice(1) lst2(k).value = choice(0) lst2(k).text = choice(1) lst3(k).value = choice(0) lst3(k).text = choice(1) k = k+1 next end sub Sub getjrstafflist() ' fill the jr staff list choices on the config page. end sub '---------- Sub GetPackContactInfo() dim pack,sql,s,x ' this will get the pack contact info for this pack. pack = getparam("pack") sql = " SELECT tblPack.PackID, tblPack.PackNumber, tblPack.Inactive, tblPack.Rep_1stName, tblPack.Rep_LstName, tblPack.Rep_phone_home, tblPack.Rep_phone_bus, tblPack.Rep_phone_cell, tblPack.RepEmail, tblPack.RepNotes, tblPack.packpassword " sql = sql & " FROM tblPack WHERE (((tblPack.PackNumber)=" & pack & "));" data = getdata(sql) ' convert the data to xml s = convertdatatoxml(data,"pack") set x = xPack 'createobject("Microsoft.xmldom") x.async = false x.loadxml s if len(x.xml)>20 then window.status = "Data Loaded" end if end sub '------------------ Sub GetPackContactList() dim pack,sql,s,x ' this will get the pack contact info for this pack. pack = getparam("pack") sql = " SELECT tblPack.PackID, tblPack.PackNumber, tblPack.Inactive, tblPack.Rep_1stName, tblPack.Rep_LstName, tblPack.Rep_phone_home, tblPack.Rep_phone_bus, tblPack.Rep_phone_cell, tblPack.RepEmail, tblPack.RepNotes " sql = sql & " FROM tblPack ORDER by tblPack.PackNumber;" data = getdata(sql) ' convert the data to xml s = convertdatatoxml(data,"pack") set x = xPack x.async = false x.loadxml s if len(x.xml)>20 then window.status = "Data Loaded" end if end sub '------------------ Sub GetPackList() dim pack,sql,s,x ' this will get the pack contact info for this pack. sql = " SELECT tblPack.PackNumber " sql = sql & " FROM tblPack ORDER BY tblPack.PackNumber;" data = getdata(sql) delim = "#" & chr(13) & chr(10) ar = split(data,delim) ' convert the data to a list ' clear the list. lstPack.length = 0 lstPack.length = ubound(ar)+1 for i = 2 to ubound(ar) lstPack(i).text = ar(i) next end sub '------------ Sub getpacklistx() dim sql,choice,ar,i,delim,lst,lst2,lst3 sql = "SELECT DISTINCTROW tblStaffPosition.StaffPositionID, tblStaffPosition.ST_PositionName " sql = sql & " FROM tblStaffPosition " sql = sql & " ORDER BY tblStaffPosition.ST_PositionName;" filllist sql, lstPack end sub '---------- Sub GetSiblingChoices() on error resume next dim sql,choice,ar,i,delim,lst,lst2,lst3 sql = "SELECT tbSIB_Categ.SIB_CategID, [CategoryName] & "" - "" & [desc] AS Expr1 " sql = sql & " FROM tbSIB_Categ;" data = getdata(sql) delim = "#" & chr(13) & chr(10) ar = split(data,delim) ' fill the sibling list boxes set lst = lstSibling lst.length = 0 lst.length = ubound(ar) k = 0 for i = 2 to ubound(ar) choice = split(ar(i),"|") lst(k).value = choice(0) lst(k).text = choice(1) k = k + 1 next end sub '----------- '----------- sub getsiblinglist() ' fill the sibling list on the configuration page. end sub '---------- Sub GetStaffChoices() on error resume next dim sql,choice,ar,i,delim,lst,lst2,lst3 sql = "SELECT DISTINCTROW tblStaffPosition.StaffPositionID, tblStaffPosition.ST_PositionName " sql = sql & " FROM tblStaffPosition " sql = sql & " ORDER BY tblStaffPosition.ST_PositionName;" data = getdata(sql) delim = "#" & chr(13) & chr(10) ar = split(data,delim) ' fill the three list boxes set lst = lstChoice1 set lst2 = lstChoice2 set lst3 = lstChoice3 lst.length = 0 lst2.length=0 lst3.length =0 lst.length = ubound(ar) lst2.length = ubound(ar) lst3.length = ubound(ar) s = "" k =0 for i = 2 to ubound(ar)-1 choice = split(ar(i),"|") lst(k).value = choice(0) lst(k).text = choice(1) lst2(k).value = choice(0) lst2(k).text = choice(1) lst3(k).value = choice(0) lst3(k).text = choice(1) s = s & choice(1) & ", " k = k + 1 next ' fill the staff choices in as text ' remove last comma s = mid(s,1,len(s)-2) spStaffChoices.innertext = s spStaffChoices2.innertext = s end sub '---------------- Sub getstafflist() ' fill the staff list choices on the config page end sub '---------- Sub gobookmark() ' navigate the page to the bookmark without changing the page. ' cancel the event window.event.returnvalue = false window.event.cancelbubble = true ' get the bookmark set elm = window.event.srcelement h = elm.href p = instrRev(h,"#") bookmark = lcase(mid(h,p+1)) set anchor = document.anchors(bookmark) anchor.scrollintoview end sub '------------ Sub GoPage() ' This will navigate the user to the hyperlink, but add all needed parameters first. on error resume next ' cancel the event window.event.returnvalue = false window.event.cancelbubble = true dim elm, district,h,pwd,href,apwd,k,p,FROMpage,TOpage,db set elm = window.event.srcelement ' msgbox "elm.outerhtml" & elm.outerhtml ' if this elm is a span, get the parent. if elm.tagname<>"A" then set elm = elm.parentelement end if ' Get the page they are starting FROM h = unescape(window.location.pathname) p = instrRev(h,"/") if p<5 then p=instrRev(h,"\") FROMpage = lcase(mid(h,p+1)) ' get the page they want to navigate to. href = elm.href p = instrRev(href,"/") if p<5 then p=instrRev(h,"\") href=mid(href,p+1) TOPage = lcase(href) 'msgbox p ' msgbox "Frompage=" & frompage & " topage=" & topage ' Get the parameters from the query string if there. pwd = getParam("pwd") ' Pack Password apwd = getParam("apwd") ' District Password db = GetParam("db") ' District Database number pack = getparam("pack") 'Pack number id = getparam("id") ' Record id for a camper. ' based on the page you are navigating --TO-- to check for needed parameters select case lcase(TOpage) case "edittables.htm" ' just go there case "packcontactlist.htm" ' just go there. case "registrationlist.htm" ' on packcontactlist, the pack number is in the text of the span tag they click on (inside hyperlink) if frompage = "packcontactlist.htm" then pack = window.event.srcelement.innertext end if if frompage ="daycampmenu.htm" then pack = lstPack(lstPack.selectedindex).text ' prompt for a password if empty if pwd <>"" then txtpwd.value = pwd else pwd = txtpwd.value end if end if if pwd="" then msgbox "Enter Pack " & pack & " Password to view or edit records" exit sub end if ' msgbox "packpassword = " & getpackpwd(pack) if not(checkpackpassword(pack,pwd)) then window.location= frompage & "?db=" & db exit sub end if ' next section is going to one of the registration forms. case "registration.htm" ' go to one of the registration forms if frompage="staffregistrationform.htm" then id= getparam("id") end if if frompage="registrationlist.htm" then ' get the form type ' find the row do while ucase(elm.tagname)<>"TR" set elm = elm.parentelement k = k + 1: if k >10 then exit do loop set row = elm id = row.cells(0).innertext ' get the form type formtype = trim(ucase(row.cells(3).innertext)) Select case ucase(formtype) case "CUB" href = "CubScoutRegistrationForm.htm" Case "STAFF" href = "StaffRegistrationForm.htm" Case "JRSTAFF" href = "JrStaffRegistrationForm.htm" Case "SIBLING" href = "SiblingRegistrationForm.htm" end select end if case "cubscoutregistrationform.htm","staffregistrationform.htm","siblingregistrationform.htm","jrstaffregistrationform.htm" ' if they click hyperlink to add a new record, then blank out the id. if instr(window.event.srcelement.innertext,"Add")>0 then id="" ' prompt for password if blank. if pwd="" then msgbox "Enter Pack Password to view or edit records",,"Pack Password" end if ' check the password before you go there. if not(checkpackpassword(pack,pwd)) then exit sub case "packcontactinfo.htm","packcontactlist.htm" ' if the current page is daycamp menu, look for pack number. if frompage = "daycampmenu.htm" then pack = lstPack(lstPack.selectedindex).text if pack = "" then msgbox "Select Pack first" exit sub end if end if ' if the from page is pack list then, get the pack number from firscolumn. if frompage="packcontactlist.htm" then do while ucase(elm.tagname)<>"TR" set elm = elm.parentelement k = k + 1: if k >10 then exit do loop set row = elm pack = row.cells(0).innertext end if case "daycampmenu.htm" ' district menu just needs the database number. ' database is stored in the same row - hidden cell. ' find the row if frompage="districtlist.htm" then do while ucase(elm.tagname)<>"TR" set elm = elm.parentelement k = k + 1: if k >10 then exit do loop ' find the db file set row = elm for each ctl in row.all.tags("INPUT") if ctl.datafld="db" then db = ctl.value end if next ' msgbox "db=" & db end if ' if the from page is pack list then, get the pack number from firscolumn. if frompage="packcontactlist.htm" then ' get it from the query line end if ' msgbox "db-=" & db case "districtadminmenu.htm","districtconfiguration.htm","tableedit.asp","tableeditor.asp","findcamper.htm" ' district menu just needs the database number. ' database is stored in the same row - hidden cell. if apwd="" then apwd = txtapwd.value else txtapwd.value = apwd end if if apwd = "" then msgbox "Enter District Admin Password" txtapwd.focus exit sub end if case "districtlist.htm" window.navigate href case else ' by default - bring them to the daycamp main menu. href="districtlist.htm" end select h= href & "?db=" & db & "&pack=" & pack & "&pwd=" & pwd & "&id=" & id ' if you go to an admin page add the admin password adminpages="districtadminmenu.htm,districtconfiguration.htm,tableeditor.htm,tableedit.asp,findcamper.htm" if instr(1,adminpages,topage,1)>0 then h = h & "&apwd=" & apwd end if window.navigate h checkerror "Sub GoPage()" end sub '------------ Sub savecamperdata() ' this will take the bound xml data island that has been modified ' and converted back into the compressed data format ' line 1 = field1|field2|field3...fieldn# ' line2 = type1|type2|type3... typen# ' line3 = val1|val2|val3... valn# '------------------- dim x,s set x = xCamper x.setproperty "SelectionLanguage","XPath" if not ( validate()) then exit sub ' get only the first schema node set schemalist = x.selectnodes("//schema[1]/*") s2="": s1="":s3="" ' for each nodx in schemalist ' next ' get only the first node in case more than one exits. set nodelist = x.selectnodes("//camper[1]/*") ' build a field list n = nodelist.length-1 for i = 0 to n ' for each nodx in nodelist ' get only the fields that are not blank. ' always bring in the first field which is the id field. if nodelist(i).text <>"" or i=0 then s1 = s1 & nodelist(i).nodename & "|" s2 = s2 & schemalist(i).text & "|" s3 = s3 & nodelist(i).text & "|" end if next ' remove last bar s1 = mid(s1,1,len(s1)-1) & "#" & chr(13) & chr(10) s2 = mid(s2,1,len(s2)-1) & "#" & chr(13) & chr(10) s3 = mid(s3,1,len(s3)-1) & "#" & chr(13) & chr(10) data = s1 & s2 & s3 txtdata.value = data ' go do an aupdate on the server. ' msgbox data ' exit sub s = "cmd=UPDATE" s = s & "&db=" & getparam("db") & "&tbl=tblCamper" s = s & "&txtdata=" & escape(data) & "&tm=" & escape(now()) msg= sendcommand(s) msgbox msg divMessage.innertext = msg divMessage.scrollintoview true 'h = "" 'document.body.insertadjacenthtml "afterbegin",h ' if you are adding a new record, the ID is blank ' after adding record, go and fill in the id. if xCamper.selectsinglenode("//CamperID").text="" then setcamperid ' msgbox "Camperid=" & xCamper.selectsinglenode("//CamperID").text end if end sub '------------ Sub SaveDoc(x) dim cmd,s filename = x.src path = starturl & filename ' save the current text as a file. path = converturltopath(path) text = x.xml ' replace the encoding string for the xml to use iso. oldheader ="" newheader ="" text = replace(text,oldheader,newheader) ' replace the plus sign with a ' plus ' and then on server replace it text = replace(text,"+","'" & "plus") 'msgbox "path to save = " & path 'build the form data to send. Escape so spaces will transfer. s = "cmd=SAVE" s = s & "&txtfile=" & escape(path) s = s & "&txtdata=" & escape(text) msg = sendcommand(s) ' return the message to the user 'msgbox msg divMessage.innerhtml = msg divMessage.scrollintoview true end sub Sub savepackinfo() ' this will take the bound xml data island that has been modified ' and converted back into the compressed data format ' line 1 = field1|field2|field3...fieldn# ' line2 = type1|type2|type3... typen# ' line3 = val1|val2|val3... valn# '------------------- dim x,s set x = xPack x.setproperty "SelectionLanguage","XPath" ' get only the first schema node set nodelist = x.selectnodes("//schema[1]/*") s2="": s1="":s3="" for each nodx in nodelist s2 = s2 & nodx.text & "|" next ' get only the first pack in case more than one exits. set nodelist = x.selectnodes("//pack[1]/*") ' build a field list for each nodx in nodelist s1 = s1 & nodx.nodename & "|" s3 = s3 & nodx.text & "|" next ' remove last bar s1 = mid(s1,1,len(s1)-1) & "#" & chr(13) & chr(10) s2 = mid(s2,1,len(s2)-1) & "#" & chr(13) & chr(10) s3 = mid(s3,1,len(s3)-1) & "#" & chr(13) & chr(10) data = s1 & s2 & s3 ' go do an aupdate on the server. ' msgbox data ' exit sub s = "cmd=UPDATE" s = s & "&db=" & getparam("db") & "&tbl=tblPack" s = s & "&txtdata=" & escape(data) & "&tm=" & escape(now()) msg= sendcommand(s) ' msgbox msg divMessage.innertext = msg divMessage.scrollintoview true end sub '------------ Sub Selectrow() dim elm, tbl ' highlight the current row when the user has clicked on it. set elm = window.event.srcelement do while elm.tagname<>"TR" set elm = elm.parentelement loop elm.style.backgroundcolor = "lightblue" set tbl = elm do while tbl.tagname<>"TABLE" set tbl = tbl.parentelement loop ' set the record number for the table tbl.setattribute "recnum", elm.recordnumber on error resume next ' set the background color of last row = blank. lastrow.style.backgroundcolor = "" set lastrow = elm end sub '------------ Sub setconfigFile() ' Set the xml configuration file for the district that is being used. on error resume next db = getparam("db") if db="" then ' go back to the district list in none are specified. window.navigate "DistrictList.htm" exit sub end if ' get number portion of database. n = right(db,2) ' The config files must all be locaed in a subdirectory of this folder ' src = "http://www.mygroupdata.com/daycamp/config/Config" & n & ".xml?tm=" &now() src = "config/Config" & n & ".xml?tm=" &now() ' msgbox src xConfig.async = false xConfig.src = src xConfig.load src if len(xConfig.xml) < 100 then msgbox "Your data did not load properly. Please contact Paul Ventura (Pventura4@aol.com)" end if ' msgbox "config source=" & src window.status = "config file = " & xConfig.src checkerror "Sub setconfigFile()" end sub '------------ Sub SetCamperID() dim first,last,sql,delim,data,id,ar first = xCamper.selectsinglenode("//NameFirst").text last = xCamper.selectsinglenode("//NameLast").text sql = "Select CamperID from tblCamper where " sql = sql & " tblCamper.namelast='" & last & "' " sql = sql & " and tblCamper.namefirst='" & first & "' " delim = "#" & cr data = getdata(sql) ' parse into rows ar = split(data,delim) ' get row 3 id = ar(2) ' set the id number for the camper. xCamper.selectsinglenode("//CamperID").text = id end sub Sub showdata() ' placeholder ' msgbox "showdata - loaded" end sub '------------ Sub ShowDistrictName() ' fill in the district name and the current year on error resume next dim district set x = xConfig x.setProperty "SelectionLanguage", "XPath" district = x.selectsinglenode("//district/name").text spDistrict.innertext = district spYear.innertext = year() checkerror "Sub ShowDistrictName()" end sub '------------ Sub showfolder() window.event.returnvalue = false window.event.cancelbubble=true url = "ftp://mygroupdata:steven@ftp.readyhosting.com/database/DayCamp/Arrowmoon/" mydbfolder.location= url path = window.location.href p = instrRev(path,"/") fold = mid(path,1,p) localfolder.location = fold 'window.open url end sub '------------- Sub showme() on error resume next window.status = window.event.srcelement.outerhtml end sub '------------ Sub showpagenum() ' fill in the page numbers based on the position within the table. dim recordsperpage,r,n recordsperpage = tblCamper.datapagesize r = tblCamper.rows(1).recordnumber txtPage.value = int((r+recordsperpage-1)/recordsperpage) n = xCamper.selectnodes("//camper").length txtPages.value = int((n+recordsperpage-1)/recordsperpage) end sub '------------ sub tablechange() on error resume next ' this will catch the change if the table has changed ' and update the page numbers. '* PV could make this more generic by using elm instead of tblCamper. if tblCamper.readystate="complete" then showpagenum end if end sub '------------ Sub toggle(elm) ' switch between displaying and not displaying an element. if elm.style.display="" then elm.style.display = "none" else elm.style.display = "" end if end sub '------------ Sub unlock() 'PV - this needs to be enabled. ' check the password against the one for the pack. ' if the password matches, unlock the pages. ' pwd = getpackpwd ' they have to enter the password in a second box before they can unlock the form. pwd = txtpassword2.value apwd = getdistrictpwd if len(txtpassword.value)>0 and len(txtpassword2.value)=0then msgbox "Enter Pack Password" txtpassword2.focus end if if (pwd=txtpassword.value) or (pwd=apwd) or (len(txtpassword.value)=0) then for each elm in table2.all.tags("INPUT") if elm.disabled then elm.disabled = false next for each elm in table2.all.tags("TEXTAREA") if elm.disabled then elm.disabled = false next for each elm in table2.all.tags("SELECT") if elm.disabled then elm.disabled = false next else msgbox "Wrong Password" end if end sub '------------ Sub updatedata(tbl) ' update the data on the server. data = packdata() s = "cmd=UPDATE" s = s & "&db=db01&tbl=tblPack" s = s & "&txtdata=" & escape(data) ' return the message to the user. msgbox sendcommand(s) end sub '------------- Sub viewdata(x) on error resume next ' go navigate to the xml data source h = x.src ' window.navigate h ' open a new window window.open h,"_Top" checkerror "Sub viewdata(x)" end sub '------------ Function GetRequiredFields() dim sReq ' this function returns the list of required fields based on the form sReq= "PackNumber,CamperTypeID,NameFirst,NameLast,Address,City,State,Zip,tshirtID" ' get the current page path =window.location.pathname p = instrRev(path,"/") page = lcase(mid(path,p+1)) ' msgbox "page=" & page select case page case "cubregistrationform.htm" sReq = sReq & "School,GradeinFall,AgeatCamp,DOB,RankID," sReq = sReq & "Emg1First,Emg1Last,Emg1Relationship,Emg1HomePh,Emg1WorkPh,Emg1CellPh," sReq = sReq & "Emg2First,Emg2Last,Emg2Relationship,Emg2HomePh,Emg2WorkPh,Emg2CellPh," case "siblingregistrationform.htm" sReq = sReq & "SIB_CategID," sReq = sReq & "Emg1First,Emg1Last,Emg1Relationship,Emg1HomePh,Emg1WorkPh,Emg1CellPh," sReq = sReq & "Emg2First,Emg2Last,Emg2Relationship,Emg2HomePh,Emg2WorkPh,Emg2CellPh," case "jrstaffregistrationform.htm" sReq = sReq & "SIB_CategID," sReq = sReq & "Emg1First,Emg1Last,Emg1Relationship,Emg1HomePh,Emg1WorkPh,Emg1CellPh," sReq = sReq & "Emg2First,Emg2Last,Emg2Relationship,Emg2HomePh,Emg2WorkPh,Emg2CellPh," case "staffregistrationform.htm" end select sReqSib ="SIB_CategID," sExtra="CamperID,Nickname,Cancel,CubNote,FamilyNotes,RegistMemo,JrStaffNote," ' SiblingNote,comment_character,StaffNoteParent_at_camp_1st,Parent_at_camp_Last, ' HomePhone, ' ParentFirst,ParentLast,ParentAddress,ParentCity,ParentState,ParentZip,ParentHomePh,ParentWorkPh,ParentCellPh,Parent_email, ' Parent2First,Parent2Last,Parent2Address,Parent2City,Parent2State,Parent2Zip,Parent2HomePh,Parent2WorkPh,Parent2CellPh,Parent2_email, ' Pickup1_NameFirst,Pickup1_NameLast,Pickup1_Phone, ' Pickup2_NameFirst,Pickup2_NameLast,Pickup2_Phone, ' Pickup3_NameFirst,Pickup3_NameLast,Pickup3_Phone, ' Gender,Jr_StaffPositionID,Jr_Staff_Pos_1,Jr_Staff_Pos_2,Jr_Staff_Pos_3,Jr_Staff_Pos_4,Jr_Staff_Pos_5, ' over18,Keystaff, ' StaffPositionID,Staff_Pos_1,Staff_Pos_2,Staff_Pos_3,Staff_Pos_4,Staff_Pos_5, ' BSA_application,Red_Cross_certified,Red_Cross_date,CPR_certified,CPR_date, ' Registered_nurse,YPT,YPT_date,Ldr_with_son,Son_name,NotMatter, ' Alternate,trained,trained_date, ' monday,tuesday,wednesday,thurday,friday, ' Yrs_at_camp,tag_to_print, ' Emg1First,Emg1Last,Emg1Relationship,Emg1HomePh,Emg1WorkPh,Emg1CellPh, ' Emg2First,Emg2Last,Emg2Relationship,Emg2HomePh,Emg2WorkPh,Emg2CellPh, ',Session1,Session2,Session3,Session4,Session5,Session6 GetRequiredfields = sReq end function Sub showmessages() 'display all the messages for the form on error resume next ' get the config options set x = xConfig path =window.location.pathname p = instrRev(path,"/") page = lcase(mid(path,p+1)) ' msgbox "page=" & page select case page case "daycampmenu.htm" ' messagem1.innerhtml = x.selectsinglenode("//messagem1").text ' messagem2.innerhtml = x.selectsinglenode("//messagem2").text case "cubscoutregistrationform.htm" messagec1.innerhtml = x.selectsinglenode("//messagec1").text messagec2.innerhtml = x.selectsinglenode("//messagec2").text messagec3.innerhtml = x.selectsinglenode("//messagec3").text messagec4.innerhtml = x.selectsinglenode("//messagec4").text case "siblingregistrationform.htm" messages1.innerhtml = x.selectsinglenode("//messages1").text messages2.innerhtml = x.selectsinglenode("//messages2").text messages3.innerhtml = x.selectsinglenode("//messages3").text messages4.innerhtml = x.selectsinglenode("//messages4").text case "jrstaffregistrationform.htm" messagej1.innerhtml = x.selectsinglenode("//messagej1").text messagej2.innerhtml = x.selectsinglenode("//messagej2").text messagej3.innerhtml = x.selectsinglenode("//messagej3").text messagej4.innerhtml = x.selectsinglenode("//messagej4").text case "staffregistrationform.htm" messagea1.innerhtml = x.selectsinglenode("//messagea1").text messagea2.innerhtml = x.selectsinglenode("//messagea2").text messagea3.innerhtml = x.selectsinglenode("//messagea3").text messagea4.innerhtml = x.selectsinglenode("//messagea4").text ' messagea5.innerhtml = x.selectsinglenode("//messagea5").text end select if err.number<>0 then msgbox "Error showing messages " & err.number & err.description & err.source end if end sub sub showoptions() dim x,bShirts,path,p,pack,sql,s,ar on error resume next ' get the config options set x = xConfig ' check for partial save. gPartialSave = x.selectsinglenode("//option[optname='partialsave']/value").text path =window.location.pathname p = instrRev(path,"/") page = lcase(mid(path,p+1)) ' msgbox "page=" & page select case page case "daycampmenu.htm" ' check to see if prompt for adult dob. bDisableOnlineReg = x.selectsinglenode("//option[optname='disableonlinereg']/value").text if bDisableOnlineReg then msgbox "Your district has chosen not to use the online registration. Contact your district",vbExclamation end if case "cubscoutregistrationform.htm" ' show the extra tshirts. bShirts = x.selectsinglenode("//option[optname='ExtraTshirts']/value").text if bShirts="-1" then spExtraShirts.style.display = "" else spExtraShirts.style.display = "none" end if ' build up the display for the ranks. ' bTigerrank = -1:bWolfrank=-1:bBearrank=-1:bWebelosirank=-1:bWebelosiirank=-1 ' see which ranks should be displayed bTigerrank = x.selectsinglenode("//tigerrank").text bwolfrank = x.selectsinglenode("//wolfrank").text bBearRank = x.selectsinglenode("//bearrank").text bWebelosiRank= x.selectsinglenode("//webelosirank").text bWebelosiiRank= x.selectsinglenode("//webelosiirank").text s = "Select rank:" if bTigerrank="-1" then s = s & "Tiger(1st)" end if if bwolfrank="-1" then s = s & "Wolf(2nd)" end if if bBearrank="-1" then s = s & "Bear(3rd)" end if if bwebelosirank="-1" then s = s & "Webelos I(4th)" end if if bwebelosiirank="-1" then s = s & "Webelos II(5th)" end if ' fill in the rank section of form. tdRank.innerhtml = s ' hide or show the row. ' check to see if they want to display pickup restrictions bPickupRestrictions = x.selectsinglenode("//option[optname='PickupRestrictions']/value").text if bPickupRestrictions="-1" then trNotAuthorized.style.display = "" else trNotAuthorized.style.display = "none" end if ' display the cub pricing... fee.innertext = x.selectsinglenode("//cubprice").text ' check to see if they want to display camper note bCamperNote = x.selectsinglenode("//option[optname='campernote']/value").text if bCamperNote = "-1" then trComment.style.display = "" else trComment.style.display = "none" end if bCamperNote = x.selectsinglenode("//option[optname='campernote']/value").text case "siblingregistrationform.htm" ' show the extra tshirts. bShirts = x.selectsinglenode("//option[optname='ExtraTshirts']/value").text if bShirts="-1" then spExtraShirts.style.display = "" else spExtraShirts.style.display = "none" end if ' msgbox "OK1" ' hide or show the row. ' check to see if they want to display pickup restrictions bPickupRestrictions = x.selectsinglenode("//option[optname='PickupRestrictions']/value").text if bPickupRestrictions="-1" then trNotAuthorized.style.display = "" else trNotAuthorized.style.display = "none" end if ' show the sibling price fee.innertext = x.selectsinglenode("//siblingprice").text case "jrstaffregistrationform.htm" ' show the extra tshirts. bShirts = x.selectsinglenode("//option[optname='ExtraTshirts']/value").text if bShirts="-1" then spExtraShirts.style.display = "" else spExtraShirts.style.display = "none" end if ' hide or show the row. ' check to see if they want to display pickup restrictions ' bRangers = x.selectsinglenode("//option[optname='AllowRangers']/value").text ' if bRangers="-1" then ' spRanger.style.display = "" ' else ' spRanger.style.display = "none" ' end if ' show the sibling price fee.innertext = x.selectsinglenode("//jrstaffprice").text ' show the staff price ' fee2.innertext = x.selectsinglenode("//rangerprice").text case "staffregistrationform.htm" ' show the extra tshirts. bShirts = x.selectsinglenode("//option[optname='ExtraTshirts']/value").text if bShirts="-1" then spExtraShirts.style.display = "" else spExtraShirts.style.display = "none" end if ' check to see if they want to be with son. bBewithSon = x.selectsinglenode("//option[optname='bewithson']/value").text ' show the staff price fee.innertext = x.selectsinglenode("//keystaffprice").text end select ' show the session files if you are on any of the registraton forms. ' get the district information from the config file set x = xConfig if len(x.xml) < 20 then exit sub x.setProperty "SelectionLanguage", "XPath" spDistrict.innertext = x.Selectsinglenode("//district/name").text spYear.innertext = x.Selectsinglenode("//district/year").text 'pv need to add shownotauthorized to the config page and file. ' bShowNotAuthorized = x.Selectsinglenode("/district/shownotauthorized").text set sessionlist = x.selectnodes("//session") ' s = "" s = s & nodx.selectsinglenode("sessionname").text & " " & nodx.selectsinglenode("startdate").text & "-" & nodx.selectsinglenode("enddate").text & "(" & nodx.selectsinglenode("starttime").text & "-" & nodx.selectsinglenode("endtime").text & ")" & "" k = K+1 next s = s & "" ' Fill in week preference options spSessions.innerhtml = s camperid = getparam("id") 'if there is no camperid then just get a blank template. 'PV need logic here. end sub Sub window_onload() document.body.attachevent "onmouseover", getref("showme") 'msgbox "ok " & now() ' adddebug ' on error resume next ' based on the page, do different things on startup ' get the page dim h,p,page,pack,id h = unescape(window.location.pathname) p = instrRev(h,"/") if p<5 then p = instrRev(h,"\") page = lcase(mid(h,p+1)) ' msgbox "page=" & page select case lcase(page) case "daycampmenu.htm" setconfigfile getpacklist showmessages showoptions case "packcontactinfo.htm" setconfigfile showdistrictname spPack.innertext = getparam("pack") getpackcontactinfo showoptions case "packcontactlist.htm" setconfigfile showdistrictname getpackcontactlist case "registrationlist.htm" setconfigfile showdistrictname spPack.innertext = getparam("pack") GetCamperListData case "districtconfiguration.htm" setconfigfile checkdistrictpassword showdistrictname ' getpacklist ' getsiblinglist ' getstafflist ' getjrstafflist case "districtadminmenu.htm" setconfigfile checkdistrictpassword case "cubscoutregistrationform.htm","siblingregistrationform.htm","staffregistrationform.htm","jrstaffregistrationform.htm" id=getparam("id") if id="" then ' xCamper.loadxml "2
333333202320233373202202202202202
202
2022022021132022032032022023203202202202202202202202202202202202202202202202202202202202202202202202202202202202202202202202202202202333333111133333311117117111171120211111171111111111211202202202202202202202202202202202202202202202333333
" xCamper.loadxml "2
333320233373202202202202
202
202202202113202202202202202320220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220220233331111333311117117111171120211111172202202202202202202202202202202202202202333333
" ' set the camper type select case page case "cubscoutregistrationform.htm" xCamper.selectSinglenode("//CamperTypeID").text = 2 case "siblingregistrationform.htm" xCamper.selectSinglenode("//CamperTypeID").text = 3 case "jrstaffregistrationform.htm" xCamper.selectSinglenode("//CamperTypeID").text = 4 case "staffregistrationform.htm" xCamper.selectSinglenode("//CamperTypeID").text = 1 end select xCamper.selectSinglenode("//PackNumber").text = getparam("pack") end if setconfigfile showdistrictname showmessages ' checkpackpassword showoptions ' fill in the pack number ' pack = getparam("pack") ' sPPack.innertext = pack if page="jrstaffregistrationform.htm" then getjrstaffchoices end if if page="staffregistrationform.htm" then getstaffchoices end if if page="siblingregistrationform.htm" then getsiblingchoices end if ' msgbox "get camper data for id=" & id if id<>"" then getcamperdata end if end select checkerror "Sub window_onload()" end sub Sub fixranks() ' cancel the hyperlink window.event.returnvalue = false window.event.cancelbubble = true ' this will send a command to server to fix the ranks table s = "cmd=FIXRANKS" s = s & "&db=" & getparam("db") s = s & "&txtdata=&tm=" & escape(now()) msgbox sendcommand(s) end sub