//============================================================================= //prop tree function makePropTree(Data,Parent,tableName,tickbox){ var Html=''; var readonly=''; if(!Data){return}; for (var Row in Data){ var tid=Data[Row]['id']; var tgroup=Data[Row]['parent']; var ttype=Data[Row]['type']; var tname=Data[Row]['fieldName']; if(tname){ var tnameSafe=tname.replace(/[^a-z]*/gi,'');//for use with folder ids, removing all non alpha chars } var tlabel=Data[Row]['label']; var toptions=Data[Row]['options']; //var tfvalue=Data['pagedata'][tname]; //var tfid=Data['pagedata'][tname+'_id']; //tablename needs to be the root folder - ie a folder with parent=0 if(tgroup==0 && Parent==0){var FieldBits=tname.split('.'); var tableName=FieldBits[0];}//set tablename for dbase update //if(tstate=="1"){ var readonly="readonly";}else{var readonly="";} if(tname){ var propid=tname.replace('.','|'); var tname=propid.replace('|','_'); } //if tickbox=true, make all elements (except folders tickboxes) if(ttype!="5" && tickbox){ttype="7";} // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =name,group,type,id if(ttype=="5" && tgroup==Parent){ if(advPropFolderState['propType'+tid]){ Html+='

'+tlabel+'

'; Html+='
'; }else{ Html+='

'+tlabel+'

'; Html+='
'; } Html+= makePropTree(Data,tid,tableName,tickbox);//pass tableName down tree to subs Html+='
'; }else if(ttype!="5" && tgroup==Parent){ //if(tstate=="2"){//if hidden //Html+=''; //}else{ if(ttype=="2" && tgroup==Parent){ Html+='
'; }else{ Html+='
'; } Html+=''; if(ttype=="1"){ Html+=''; }else if (ttype=="2"){//date type Html+=''; }else if (ttype=="3" || ttype=="0"){ Html+=''; }else if (ttype=="4" || ttype=="9"){ Html+=''; }else if (ttype=="6"){ Html+=''; }else if (ttype=="7"){ Html+=''; }else if (ttype=="8"){ Html+=''; }else if (ttype=="10"){ Html+=''; var options=toptions.split("\n"); for (i=0;i'; } Html+=''; } Html+='
'; //} //alert(Html); } }//for end return Html } function advOpBoxDrop(id,bool,value){ if(bool){ document.getElementById(id).value+=value+";";//append }else{ document.getElementById(id).value=document.getElementById(id).value.replace((value+";"),'');//remove } } function treeSwitch(e){ if(!e.target){var branch=window.event.srcElement;}else{var branch=e.target;} var foldername='folder'+branch.id; foldername=foldername.replace('propType',''); var container=document.getElementById(foldername); if(container && branch.tagName=="DIV"){ if(!container.style.display || container.style.display=="none"){ advPropFolderState[branch.id]='true'; container.style.display="block"; branch.style.backgroundImage="url(/duocms-resources/icons/minus.gif)"; }else{ advPropFolderState[branch.id]=''; container.style.display="none"; branch.style.backgroundImage="url(/duocms-resources/icons/plus.gif)"; } } if(branch.tagName!="DIV"){branch=branch.parentNode;}//make it highlight if not div ie-plus/minus if(lastselected){ lastselected.style.backgroundColor="white"; } if(branch.id.replace('propType','')!=branch.id){ advPropselectedid=branch.id.replace('propType',''); //advPropRename(); //advPropSelectedTime[advPropselectedid]=new Date(); } if(branch.id.replace('groupId','')!=branch.id){ secGroupId=branch.id.replace('groupId',''); secSelType='group'; } if(branch.id.replace('userId','')!=branch.id){ secGroupId=branch.id.replace('userId',''); secSelType='user'; } //alert (secSelType+secGroupId); branch.style.backgroundColor="#C2DBEB"; lasthighlightedColor=branch.style.backgroundColor; lastselected=branch; getParentFolderId(branch); } function getParentFolderId(branch){ while(branch.className!='advpropfolder' && branch.tagName!='body' && branch.className!='advproplist'){ branch=branch.parentNode; } if(branch.id.replace('folder','')!=branch.id){ branch=branch.previousSibling; } currentPropParentId=branch.id.replace('propType',''); } function treeCollapseSetup(){ //add functions to where class = advpropfolder Targets=document.getElementsByTagName("div"); if(document.getElementById('propType'+advPropselectedid)){ var rehighlight=document.getElementById('propType'+advPropselectedid); rehighlight.style.backgroundColor="#C2DBEB"; lastselected=rehighlight; } for(i=0;i for(row in data){ var item=document.getElementById("folder_"+row); if(item){ if(data[row]>1){ item.innerHTML='1/'+data[row]+'  '; }else{ item.innerHTML=''; } } } } function getAdvancedTableRecord(table,recordnum){ var recordnumElem=document.getElementById("folderCount_"+table); recordnum=parseInt(recordnumElem.innerHTML)+recordnum; if(document.getElementById('advprop_structure_id')){ var strucid=document.getElementById('advprop_structure_id').value; var myConn = new XHConn(); var qstring="&table="+table+"&limit="+recordnum+"&structure_id="+strucid; if (myConn){myConn.connect("/duocms/data/getTableRecord/", "POST", qstring, getAdvancedTableRecord_res);} } } function getAdvancedTableRecord_res(data){ //alert(data.responseText); var data=eval('('+data.responseText+')'); var info=data.info; for (var row in info){ fieldid="advprop_"+info['table']+"_"+row; if(document.getElementById(fieldid)){ var formelem=document.getElementById(fieldid); setFormValueByNode(formelem,info[row]); //alert(fieldid+"="+info[row]); } } var item=document.getElementById("folderCount_"+info['table']); if(item){ item.innerHTML=info['limit']; } }