var g_findWord=""; // word for find var g_findMode=""; // 1.parent 2.children 3.self var g_currShowDeep=0; var g_DictWordList= new Array(); var g_DocWordMean= new Array(); var g_dictList = new Array(); var g_DictWordNew = new Object(); var g_DictWordUpdataIndex=0;//正在更新的记录在内存字典表中的索引号 var g_DictCount=0; var g_currEditWord=-1; var g_currBookMarkColor="0"; var g_dictFindParentLevel=0; var g_dictFindAllDone=false; function setNaviVisibility(){ var objNave = document.getElementById('leftmenuinner'); var objMainView = document.getElementById("body_mainview"); if(objNave.style.display=="none"){ objNave.style.display="block"; getStyleClass('mainview').style.margin = "0px 0px 0px 30em"; } else{ objNave.style.display="none"; getStyleClass('mainview').style.margin = "0px"; } } function menuSelected(obj){ var objMenuItems=document.getElementsByClassName("menu"); for (var i=0;i"+arrDictFileList[x].filename+"

"; } else{ fileList = fileList + "

"+arrDictFileList[x].filename+"

"; } } document.getElementById('basic_dict_list').innerHTML=fileList; if(g_findWord.length>0){ menu_dict_match(); } } else { document.getElementById('basic_dict_list')="Problem retrieving data:" + xmlhttp.statusText; } } } function dict_windowsInit(){ var strSertch = location.search; if(strSertch.length>0){ strSertch = strSertch.substr(1); var sertchList=strSertch.split('&'); for (x in sertchList){ var item = sertchList[x].split('='); if(item[0]=="word"){ //g_findWord=item[1]; } if(item[0]=="mode"){ //g_findMode=item[1]; } } } checkCookie(); dict_getDictFileList(); document.getElementById('id_info_window_select').value="view_dict_curr"; windowsSelected(document.getElementById('id_info_window_select')); } function menu_dict_match(){ currMatchingDictNum=0; g_dictFindParentLevel=0; g_dictFindAllDone=false; g_currShowDeep=0; dict_dict_match(); } function dict_dict_match(){ if(currMatchingDictNum"; dict_dict_match(); } else{ document.getElementById('id_dict_match_inner').innerHTML+="Max Parent Level "+g_dictFindParentLevel+" Stop!
"; dictShowCurrWordList(); //dictFindShow(); } } if(g_findMode=="children"){ if(g_dictFindParentLevel>-2){ currMatchingDictNum=0; g_dictFindParentLevel--; document.getElementById('id_dict_match_inner').innerHTML+="finding parent level "+g_dictFindParentLevel+"
"; dict_dict_match(); } else{ document.getElementById('id_dict_match_inner').innerHTML+="Max Children Level "+g_dictFindParentLevel+" Stop!
"; dictShowCurrWordList(); //dictFindShow(); } } } } var dict_DictXmlHttp=null; function dict_loadDictFromDB(strFileName,dictName){ var xmlText=""; if(window.XMLHttpRequest) {// code for IE7, Firefox, Opera, etc. dict_DictXmlHttp=new XMLHttpRequest(); } else if(window.ActiveXObject) {// code for IE6, IE5 dict_DictXmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } if (dict_DictXmlHttp!=null) { var d=new Date(); dict_DictXmlHttp.onreadystatechange=dict_dict_serverResponse; var wordList=dict_getAllWordList(); if(wordList!=null){ document.getElementById('id_dict_msg').innerHTML="开始匹配字典"+dictName.name; dict_DictXmlHttp.open("POST", "dict_find2.php", true); dict_DictXmlHttp.send(dictName.type+"$"+dictName.filename+"$"+g_dictFindParentLevel+"$"+wordList); } else{ g_dictFindAllDone=true; document.getElementById('id_dict_match_inner').innerHTML+="all done!"; } } else { alert("Your browser does not support XMLHTTP."); } } function dict_dict_serverResponse(){ if (dict_DictXmlHttp.readyState==4)// 4 = "loaded" { document.getElementById('id_dict_msg').innerHTML="已经获取字典数据"; if (dict_DictXmlHttp.status==200) {// 200 = "OK" var xmlText = dict_DictXmlHttp.responseText; if (window.DOMParser) { parser=new DOMParser(); xmlDict=parser.parseFromString(xmlText,"text/xml"); } else // Internet Explorer { xmlDict=new ActiveXObject("Microsoft.XMLDOM"); xmlDict.async="false"; xmlDict.loadXML(xmlText); } if (xmlDict == null){ alert("error:can not load dict."); return; } document.getElementById('id_dict_match_inner').innerHTML+=g_dictList[currMatchingDictNum].name+":"+xmlDict.getElementsByTagName("word").length+"
"; dictDataParse(xmlDict,g_dictList[currMatchingDictNum].name); } else { document.getElementById('id_dict_match_inner')="Problem retrieving data:" + xmlhttp.statusText; } currMatchingDictNum++; dict_dict_match(); } } /*解析字典数据*/ function dictDataParse(xmlDictData,dictname){ document.getElementById('id_dict_msg').innerHTML="正在解析字典数据"; var xDict = xmlDictData.getElementsByTagName("word"); var tOut=""; var sDictPali=""; var sDictId=""; var sDictOrg=""; var sDictMean=""; var sDictCase=""; for(iword=0;iword"; outData=outData+""+g_DictWordList[i].dictname+""; outData=outData+""+g_DictWordList[i].Pali+""; outData=outData+""+g_DictWordList[i].Type+""; outData=outData+""+g_DictWordList[i].Gramma+""; outData=outData+""+g_DictWordList[i].Parent+""; outData=outData+""+g_DictWordList[i].Mean+""; outData=outData+""+g_DictWordList[i].Factors+""; outData=outData+""; } outData+=""; return outData; } var g_CurrActiveRecorder="new"; function setCurrActiveRecorder(recorderName){ g_CurrActiveRecorder=recorderName; } function updataCurrActiveRecorder(filder,value){ if(filder=="all"){ } else{ document.getElementById(filder+"_"+g_CurrActiveRecorder).value=value; mean_change(g_CurrActiveRecorder); } } function addToCurrActiveRecorder(filder,value){ if(filder=="all"){ } else{ meanString=document.getElementById(filder+"_"+g_CurrActiveRecorder).value; meanList=meanString.split("$"); for(i in meanList) { if(meanList[i]==value){ return; } } document.getElementById(filder+"_"+g_CurrActiveRecorder).value+="$"+value; mean_change(g_CurrActiveRecorder); } } function updataFactorMeanPrev(id,strNew){ //if(strNew!=null){ //document.getElementById("id_factormean_prev_"+id).value=strNew; //} } function factorMeanItemChange(id,iPos,count,newMean){ //alert(id+":"+iPos+":"+newMean); var factorMeanPrevString = document.getElementById("id_factormean_prev_"+id).value; currFactorMeanPrevList=factorMeanPrevString.split("+"); currFactorMeanPrevList[iPos]=newMean; document.getElementById("id_factormean_prev_"+id).value=currFactorMeanPrevList.join("+"); } function makeFactorBlock(factorStr,id){ var output=""; var factorList=factorStr.split("+"); var defualtFactorMeanList=new Array; for(iFactor in factorList){ arrFM=findAllMeanInDict(factorList[iFactor],10); if(arrFM.length==0){ arrFM[0]="unkow"; } output +="
"; output += "

"; output += arrFM[0]; defualtFactorMeanList.push(arrFM[0]); output +="

"; output+="
"; for(iFM in arrFM){ output+=""+arrFM[iFM]+""; } output+="
"; output+="
"; if(iFactor"; output+="
"; output+="

«

"; output+="
"; output+="

"+meanList[i]+"

"; output+="
"; output+="

x

"; output+="
"; output+=""; } return(output); } function mean_change(id){ var meanString = document.getElementById("id_dict_user_mean_"+id).value; document.getElementById("id_mean_block_"+id).innerHTML=makeMeanBlock(meanString,id); } function meanBlockDelete(id,indexDelete){ var meanString = document.getElementById("id_dict_user_mean_"+id).value; var meanBlock=""; var meanList=meanString.split("$"); meanList.splice(indexDelete,1); var newString = meanList.join("$"); document.getElementById("id_dict_user_mean_"+id).value=newString; mean_change(id); } function meanBlockMove(id,moveFrom,moveTo){ var meanString = document.getElementById("id_dict_user_mean_"+id).value; var meanBlock=""; var meanList=meanString.split("$"); if(moveTo<0){ moveTo=0; } if(moveFrom==moveTo){ return; } var temp=meanList[moveTo]; meanList[moveTo]=meanList[moveFrom]; for(i=moveFrom-1;i>moveTo;i--){ meanList[i+1]=meanList[i]; } meanList[moveTo+1]=temp; var newString = meanList.join("$"); /* for(x in meanList){ newString+=meanList[x]+"$"; } */ document.getElementById("id_dict_user_mean_"+id).value=newString; mean_change(id); } function addAutoMeanToFactorMean(id){ document.getElementById("id_dict_user_fm_"+id).value=document.getElementById("id_factormean_prev_"+id).value; } //show current selected word in the word window to modify var g_WordTableCurrWord=""; function dictCurrWordShowAsTable(inCurrWord){ g_WordTableCurrWord = inCurrWord; g_CurrActiveRecorder="new"; var outData=""; var listParent= new Array(); var listFactors= new Array(); var listChildren = new Array(); outData+="

Parent:"; for(var i=0;i0){ var find=false; for(x in listParent){ if(listParent[x]==g_DictWordList[i].Parent){ find=true; break; } } if(!find){ listParent.push(g_DictWordList[i].Parent); } } if(g_DictWordList[i].Factors.length>0){ arrFactors=g_DictWordList[i].Factors.split("+"); for(iFactors in arrFactors){ var find=false; for(x in listFactors){ if(listFactors[x]==arrFactors[iFactors]){ find=true; break; } } if(!find){ listFactors.push(arrFactors[iFactors]); } } } } } for(x in listParent){ outData+=""+listParent[x]+" " } for(x in listFactors){ outData+="["+listFactors[x]+"] " } outData+="

"; outData=outData+"

└"+inCurrWord+"

"; outData+="

└Children: "; for(var i=0;i0){ var find=false; for(x in listChildren){ if(listChildren[x]==g_DictWordList[i].Pali){ find=true; break; } } if(!find){ listChildren.push(g_DictWordList[i].Pali); } } } } for(x in listChildren){ outData+=""+listChildren[x]+" " } outData+="

"; //get new recorder filder var newRecorder = new Object(); newRecorder.Type=""; newRecorder.Gramma=""; newRecorder.Parent=""; newRecorder.Mean=""; newRecorder.Note=""; newRecorder.Factors=""; newRecorder.FactorMean=""; newRecorder.Confer=""; newRecorder.Status=""; newRecorder.Lock=""; newRecorder.Tag=""; var newMeanList= new Array(); for(var i=0;i0){ newRecorder.Type=g_DictWordList[i].Type } if(newRecorder.Gramma=="" && g_DictWordList[i].Gramma.length>0){ newRecorder.Gramma=g_DictWordList[i].Gramma; } if(newRecorder.Parent=="" && g_DictWordList[i].Parent.length>0){ newRecorder.Parent=g_DictWordList[i].Parent; } if(g_DictWordList[i].Mean.length>0){ otherMean = g_DictWordList[i].Mean.split("$"); for(iMean in otherMean){ pushNewToList(newMeanList,otherMean[iMean]); } newRecorder.Mean=newMeanList.join("$"); } if(newRecorder.Factors=="" && g_DictWordList[i].Factors.length>0){ newRecorder.Factors=g_DictWordList[i].Factors; } if(newRecorder.FactorMean=="" && g_DictWordList[i].FactorMean.length>0){ newRecorder.FactorMean=g_DictWordList[i].FactorMean; } if(newRecorder.Note=="" && g_DictWordList[i].Note.length>0){ newRecorder.Note=g_DictWordList[i].Note; } } } newMeanBlock=makeMeanBlock(newRecorder.Mean,"new"); newFactorBlock=makeFactorBlock(newRecorder.Factors,"new"); newFactorMeanPrevString=g_FactorMean; //draw new outData=outData+"

New:

"; outData+=""; outData+=""; outData+=""+ ""; outData=outData+""; outData=outData+""; outData+=""; outData+=""; outData+=""; outData+=""; outData+=""; outData+=""; outData+=""; outData+="" outData+="
TypeParentMeaning
"+ ""+ " "; outData=outData+"
"+newMeanBlock+"
GrammaPartsParts Meaning
"; outData+="
"; outData+="
"+newFactorBlock+"
"; outData+="
Note
"; outData+="

User Dict

"; outData+=""; /* outData=outData+""; for(var i=0;i"; outData+=""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; } } } */ for(var i=0;i"+ ""; outData=outData+""; outData=outData+""; outData+=""; outData+=""; outData+=""; outData+=""; outData+=""; outData+=""; outData+=""; outData+="" } } } outData=outData+"
dict Type Gramma Parent Meaning Parts Parts Meaning
"+g_DictWordList[i].dictname+""; outData=outData+""; outData=outData+" "; outData=outData+""; outData=outData+"
"+ ""+ " "; outData=outData+"
"+newMeanBlock+"
GrammaPartsParts Meaning
"; outData+="
"; outData+="
"+newFactorBlock+"
"; outData+="
Note
"; outData+="

Other Dict

"; outData+=""; outData=outData+""; for(var i=0;i"; outData+=""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; } } } outData+="
dict Type Gramma Parent Meaning Parts Parts Meaning use
"+g_DictWordList[i].dictname+""+g_DictWordList[i].Type+""+g_DictWordList[i].Gramma+""+g_DictWordList[i].Parent; outData=outData+""+g_DictWordList[i].Mean+"
"+makeMeanLink(g_DictWordList[i].Mean)+"
"+g_DictWordList[i].Factors+""+g_DictWordList[i].FactorMean+"
"; //children for(x in listChildren){ wordChildren=listChildren[x] outData+="

"+wordChildren+"

"; outData+=""; outData=outData+""; for(var i=0;i"; outData+=""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; outData=outData+""; } } } outData+="
dict Type Gramma Parent Meaning Parts Parts Meaning
"+g_DictWordList[i].dictname+""+g_DictWordList[i].Type+""+g_DictWordList[i].Gramma+""+g_DictWordList[i].Parent; outData=outData+""+g_DictWordList[i].Mean+"
"+makeMeanLink(g_DictWordList[i].Mean)+"
"+g_DictWordList[i].Factors+""+g_DictWordList[i].FactorMean+"
"; } return outData; } function makeMeanLink(inStr){ var arrList=inStr.split("$"); var output=""; for(i in arrList){ output+=""+arrList[i]+" " } return(output); } function showCurrWordTable(currWord){ document.getElementById('id_dict_curr_word_inner').innerHTML=dictCurrWordShowAsTable(currWord); } //匹配字典数据到文档 function dictMatchXMLDoc(){ document.getElementById('id_dict_msg').innerHTML=gLocal.gui.dict_match; var docWordCounter=0; var matchedCounter=0; var xDocWords = gXmlBookDataBody.getElementsByTagName("word"); for(var iword=0;iword0){ for(var i=0;i0){ return(arrMean[i]); } else{ return ""; } } return ""; } else{ return ""; } } //test word is pali word or not function isPaliWord(inWord){ if(inWord.length<2){ return false; } if(inWord.match(/[x]/)){ return false; } if(inWord.match(/[q]/)){ return false; } if(inWord.match(/[w]/)){ return false; } if(inWord.match(/[a-y]/)){ return true; } else{ return false; } } function submenu_show_detail(obj){ eParent = obj.parentNode; var x=eParent.getElementsByTagName("div"); if(x[0].style.display=="none"){ x[0].style.display="block"; obj.getElementsByTagName("span")[0].innerHTML="-"; } else{ x[0].style.display="none"; obj.getElementsByTagName("span")[0].innerHTML="+"; } } //在导航窗口中显示与此词匹配的字典中的词 function showMatchedWordsInNavi(wordId){ //var matchedCounter=0; var xDocWords = gXmlBookDataBody.getElementsByTagName("word"); //var outText=""; //var sLastDict=""; var sPaliWord = getNodeText(xDocWords[wordId],"real"); showWordInNavi(sPaliWord); } //在导航窗口中显示与此词匹配的字典中的词 function showWordInNavi(inWord){ var matchedCounter=0; var outText=""; var sLastDict=""; var sPaliWord = inWord; outText=outText+"

"+sPaliWord+"

"; /*将这个词与字典匹配,*/ var iDict=0; var thisWord = sPaliWord; for(iDict=0;iDict"+g_DictWordList[iDict].dictname+""; sLastDict=g_DictWordList[iDict].dictname; } outText=outText+""; outText=outText+"
"; outText=outText+"
"; outText=outText+"" outText=outText+"
"; outText=outText+"
"; outText=outText+"
"; /* outText=outText+""+g_DictWordList[iDict].Mean+""; outText=outText+""+g_DictWordList[iDict].Factors+""; outText=outText+""+g_DictWordList[iDict].FactorMean+""; outText=outText+""+g_DictWordList[iDict].Type+"#"+g_DictWordList[iDict].Gramma+""; */ matchedCounter++; } } document.getElementById("id_dict_matched").innerHTML=outText; document.getElementById('id_dict_curr_word_inner').innerHTML=dictCurrWordShowAsTable(inWord); } function updataWordFromDict(obj,field){ var xDocWords = gXmlBookDataBody.getElementsByTagName("word"); var strValue = obj.innerHTML; var applayTo = document.getElementById("id_dict_applay_to").value; var strCurrPali=getNodeText(xDocWords[g_currEditWord],"pali"); switch(applayTo) { case "current": setNodeText(xDocWords[g_currEditWord],field,strValue); modifyWordDetailByWordIndex(g_currEditWord); break; case "sys": for(i=0;i"); } else if (window.ActiveXObject) {// code for IE6, IE5 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); var_dump("testing Microsoft.XMLHTTP
"); } if (xmlHttp!=null) { var_dump("ok"); xmlHttp.open("POST", "dom_http.php", false); var sendHead="filename="+g_filename+"#"; xmlHttp.send(sendHead+xmlToString(xmlDoc)); var_dump(xmlHttp.responseText); } else { alert("Your browser does not support XMLHTTP."); } } function menu_file_export_csv(){ xmlHttp=null; var_dump(gLocal.gui.loading); if (window.XMLHttpRequest) {// code for IE7, Firefox, Opera, etc. xmlHttp=new XMLHttpRequest(); var_dump("test XMLHttpRequest
"); } else if (window.ActiveXObject) {// code for IE6, IE5 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); var_dump("testing Microsoft.XMLHTTP
"); } if (xmlHttp!=null) { var_dump("ok"); xmlHttp.open("POST", "export_csv.php", false); var sendHead="filename="+g_filename+"#"; xmlHttp.send(sendHead+xmlToString(xmlDoc)); var_dump(xmlHttp.responseText); } else { alert("Your browser does not support XMLHTTP."); } } function menu_file_import_csv(){ var filename = document.getElementById('import_csv_filename').value; dict_loadDataFromCSV(filename); } //import csv begin var dict_CSVXmlHttp=null; function dict_loadDataFromCSV(strFileName){ if(window.XMLHttpRequest) {// code for IE7, Firefox, Opera, etc. dict_CSVXmlHttp=new XMLHttpRequest(); } else if(window.ActiveXObject) {// code for IE6, IE5 dict_CSVXmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } if (dict_CSVXmlHttp!=null) { var d=new Date(); var strLink = "import_csv.php?filename="+strFileName; dict_CSVXmlHttp.onreadystatechange=dict_csv_serverResponse; dict_CSVXmlHttp.open("GET", strLink, true); dict_CSVXmlHttp.send(null); document.getElementById('id_csv_msg_inner').innerHTML="Importing..."+strFileName; } else { alert("Your browser does not support XMLHTTP."); } } function dict_csv_serverResponse() { if (dict_CSVXmlHttp.readyState==4)// 4 = "loaded" { document.getElementById('id_csv_msg_inner').innerHTML="receve csv data"; if (dict_CSVXmlHttp.status==200) {// 200 = "OK" var xmlText = dict_CSVXmlHttp.responseText; if (window.DOMParser) { parser=new DOMParser(); xmlCsv=parser.parseFromString(xmlText,"text/xml"); } else // Internet Explorer { xmlCsv=new ActiveXObject("Microsoft.XMLDOM"); xmlCsv.async="false"; xmlCsv.loadXML(xmlText); } if (xmlCsv == null){ alert("error:can not load dict."); return; } csvDataParse(xmlCsv); } else { document.getElementById('id_dict_match_inner')="Problem retrieving data:" + xmlhttp.statusText; } } } /*Parse csv data and fill this document*/ function csvDataParse(xmlCSVData){ document.getElementById('id_csv_msg_inner').innerHTML="Parseing CSV Data"; var xCSV = xmlCSVData.getElementsByTagName("word"); var xDocWords = gXmlBookDataBody.getElementsByTagName("word"); for(iword=0;iword外面点击,即可关闭它!" p.show(150,150,200,50,document.body) } function setInfoPanalSize(inSize){ var w=window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var h=window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; var objInfoPanal = document.getElementById("id_info_panal"); //show_popup(w); //alert(objInfoPanal.style.right); objInfoPanal.style.left="0px"; objInfoPanal.style.width=(w-20)+"px"; switch(inSize){ case "hidden"://min objInfoPanal.style.display="none"; break; case "min"://min objInfoPanal.style.top=(h-30)+"px"; objInfoPanal.style.height=(30)+"px"; break; case "half"://half objInfoPanal.style.top=h/2+"px"; objInfoPanal.style.height=h/2+"px"; break; case "0.6"://2/3 objInfoPanal.style.top=(h*0.4)+"px"; objInfoPanal.style.height=(h*0.6)+"px"; break; case "max"://max objInfoPanal.style.top="0px"; objInfoPanal.style.height=(h)+"px"; break; } } function windowsSelected(obj){ document.getElementById('word_table').style.display = "none"; document.getElementById('id_dict_match_result').style.display = "none"; document.getElementById('id_dict_curr_word').style.display = "none"; document.getElementById('id_debug').style.display = "none"; switch(obj.value){ case "view_vocabulary": document.getElementById('word_table').style.display = "block"; break; case "view_dict_all": document.getElementById('id_dict_match_result').style.display = "block"; break; case "view_dict_curr": document.getElementById('id_dict_curr_word').style.display = "block"; break; case "view_debug": document.getElementById('id_debug').style.display = "block"; break; } } function userDictUpdata(){ } var dict_DictUpdataXmlHttp=null; function dict_UserDictUpdata(recorderName,thisObj){ thisObj.disabled=true; var xmlText=""; if(window.XMLHttpRequest) {// code for IE7, Firefox, Opera, etc. dict_DictUpdataXmlHttp=new XMLHttpRequest(); } else if(window.ActiveXObject) {// code for IE6, IE5 dict_DictUpdataXmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } if (dict_DictUpdataXmlHttp!=null) { var queryString=""; queryString+=""; var d_id=document.getElementById('id_dict_user_id_'+recorderName).value; var d_pali=document.getElementById('id_dict_user_pali_'+recorderName).value; var d_type=document.getElementById('id_dict_user_type_'+recorderName).value; var d_gramma=document.getElementById('id_dict_user_gramma_'+recorderName).value; var d_parent=document.getElementById('id_dict_user_parent_'+recorderName).value; var d_mean=document.getElementById('id_dict_user_mean_'+recorderName).value; var d_note=document.getElementById('id_dict_user_note_'+recorderName).value; var d_factors=document.getElementById('id_dict_user_factors_'+recorderName).value; var d_fm=document.getElementById('id_dict_user_fm_'+recorderName).value; var d_confer=""; var d_status=""; var d_delete=""; var d_tag=""; queryString+=""+d_id+""; queryString+=""+d_pali+""; queryString+=""+d_type+""; queryString+=""+d_gramma+""; queryString+=""+d_parent+""; queryString+=""+d_mean+""; queryString+=""+d_note+""; queryString+=""+d_factors+""; queryString+=""+d_fm+""; queryString+=""+d_confer+""; queryString+=""+d_status+""; queryString+=""+d_delete+""; queryString+=""+d_tag+""; queryString+=""; queryString+=""; dict_DictUpdataXmlHttp.onreadystatechange=dict_UserDictUpdata_serverResponse; debugOutput("updata user dict start.",0); dict_DictUpdataXmlHttp.open("POST", "dict_updata_user.php", true); dict_DictUpdataXmlHttp.send(queryString); var i=recorderName; g_DictWordUpdataIndex=i; g_DictWordNew.Id = d_id; g_DictWordNew.Pali = d_pali; g_DictWordNew.Mean = d_mean; g_DictWordNew.Type = d_type; g_DictWordNew.Gramma = d_gramma; g_DictWordNew.Parent = d_parent; g_DictWordNew.Factors = d_factors; g_DictWordNew.FactorMean = d_fm; g_DictWordNew.Note = d_note; g_DictWordNew.Confer = d_confer; g_DictWordNew.Status = d_status; g_DictWordNew.Delete = d_delete; g_DictWordNew.dictname="用户字典"; g_DictWordNew.ParentLevel=0; } else { alert("Your browser does not support XMLHTTP."); } } function dict_UserDictUpdata_serverResponse(){ if (dict_DictUpdataXmlHttp.readyState==4)// 4 = "loaded" { debugOutput("server response.",0); if (dict_DictUpdataXmlHttp.status==200) {// 200 = "OK" var serverText = dict_DictUpdataXmlHttp.responseText; debugOutput(serverText,0); obj = JSON.parse(serverText); if(obj.msg[0].server_return==-1){ alert(obj.msg[0].server_error); } else{ var_dump("user dict "+obj.msg[0].server_op+" ok"); switch(obj.msg[0].server_op){ case "insert": g_DictWordNew.Id=obj.msg[0].server_return; g_DictWordList.unshift(g_DictWordNew); break; case "update": g_DictWordList[g_DictWordUpdataIndex]=g_DictWordNew; break; } } showCurrWordTable(g_WordTableCurrWord); modifyWordDetailByWordIndex(g_currEditWord); } else { debugOutput(xmlhttp.statusText,0); } } } // word by word dict updata var dict_wbwUpdataXmlHttp=null; function dict_WbwUpdata(wordIdFrom,wordIdTo){ var xmlText=""; if(window.XMLHttpRequest) {// code for IE7, Firefox, Opera, etc. dict_wbwUpdataXmlHttp=new XMLHttpRequest(); } else if(window.ActiveXObject) {// code for IE6, IE5 dict_wbwUpdataXmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } if (dict_wbwUpdataXmlHttp!=null) { var queryString=""; var x = gXmlBookDataBody.getElementsByTagName("word"); for(var wordID=wordIdFrom; wordID<=wordIdTo;wordID++){ var wordNode = x[wordID]; var d_pali=getNodeText(wordNode,"real"); var d_mean=getNodeText(wordNode,"mean"); var d_factors=getNodeText(wordNode,"org"); var d_fm=getNodeText(wordNode,"om"); var d_case = getNodeText(wordNode,"case"); if(d_pali.length>0 && !(d_mean=="?" && d_factors=="?" && d_fm=="?" && d_case=="?")){ queryString+=""; var iPos=d_case.indexOf("#"); if(iPos>=0){ var d_type=d_case.substring(0,iPos); if(iPos"; queryString+=""+d_type+""; queryString+=""+d_gramma+""; queryString+=""+d_parent+""; queryString+=""+d_mean+""; queryString+=""+d_note+""; queryString+=""+d_factors+""; queryString+=""+d_fm+""; queryString+=""+d_confer+""; queryString+=""+d_status+""; queryString+=""+d_lock+""; queryString+=""+d_tag+""; queryString+=""; } } queryString+=""; dict_wbwUpdataXmlHttp.onreadystatechange=dict_wbwDictUpdata_serverResponse; debugOutput("updata user dict start.",0); dict_wbwUpdataXmlHttp.open("POST", "dict_updata_wbw.php", true); dict_wbwUpdataXmlHttp.send(queryString); } else { alert("Your browser does not support XMLHTTP."); } } function dict_wbwDictUpdata_serverResponse(){ if (dict_wbwUpdataXmlHttp.readyState==4)// 4 = "loaded" { debugOutput("server response.",0); if (dict_wbwUpdataXmlHttp.status==200) {// 200 = "OK" var serverText = dict_wbwUpdataXmlHttp.responseText; alert(serverText); debugOutput(serverText,0); } else { debugOutput(xmlhttp.statusText,0); } } } function uploadAllWordData(){ var x = gXmlBookDataBody.getElementsByTagName("word"); if(x.length>0){ dict_WbwUpdata(0,x.length-1); } else{ } } function setInfoPanalVisibility(){ document.getElementById("id_info_panal").style.display="block"; } function removeFormula(inStr){ if(inStr.indexOf("[")>=0){ return(inStr); } pos=0; copy=true; var output=""; for(i=0;i0 && g_DictWordList[i].Parent!=g_DictWordList[i].Pali){ var arrList=g_DictWordList[i].Parent.split("$"); var paliInParent=false; for(x=0;x0){ arrList=g_DictWordList[i].Factors.split("+"); for(x=0;x0){ return output.join("$"); } else{ return null; } } function showChildrenList(arrChildren){ var outChildrenString=""; var arrChildrenList = new Array(); g_currShowDeep++; if(g_currShowDeep>3){ g_currShowDeep=g_currShowDeep-1; return(""); } outChildrenString+="
"; outChildrenString+="
    "; for(iChild in arrChildren){ outChildrenString+="
  1. "; newChild = getChildrenList(arrChildren[iChild]); if(newChild.length>0){ outChildrenString+=""; } outChildrenString+=g_DictWordList[arrChildren[iChild]].Pali; outChildrenString+='['+g_DictWordList[arrChildren[iChild]].Type+"@"+g_DictWordList[arrChildren[iChild]].Gramma+"]"+g_DictWordList[arrChildren[iChild]].Mean+"["+g_DictWordList[arrChildren[iChild]].Factors+"]"; if(newChild.length>0){ outChildrenString+=showChildrenList(newChild); } outChildrenString+="
  2. "; } outChildrenString+="
"; outChildrenString+="
"; g_currShowDeep--; return(outChildrenString); } function preOpParentInfo(){ for(iDict=0;iDict2){ if(arrFactor[arrFactor.length-3]==g_DictWordList[iDict].Pali && arrFactor[arrFactor.length-2]!="ṇe"){ g_DictWordList[iSub].Parent=g_DictWordList[iDict].Pali; } } } } } if(g_DictWordList[iDict].Type==".v:base."){ var arrHead=arrParentFactor; arrHead.pop(); var sHead=arrHead.join("+"); for(iSub=0;iSub0 || g_DictWordList[iDict].Factors.indexOf(g_DictWordList[wordId].Pali+"+")==0) { { thisChildPali=g_DictWordList[iDict].Pali; thisChildType=g_DictWordList[iDict].Type; if(thisChildPali==g_DictWordList[wordId].Pali && g_DictWordList[iDict].Type==g_DictWordList[wordId].Type){ } else { isFind=false; for(iWord in arrChildList){ if(g_DictWordList[arrChildList[iWord]].Pali==thisChildPali && g_DictWordList[arrChildList[iWord]].Type==thisChildType){ isFind=true; } } if(!isFind){ arrChildList.push(iDict); } } } } } return(arrChildList); } function showParentList(arrParent){ var outChildrenString=""; var arrParentList = new Array(); g_currShowDeep++; if(g_currShowDeep>3){ g_currShowDeep=g_currShowDeep-1; return(""); } outChildrenString+="
    "; for(iParent in arrParent){ outChildrenString+="
  1. "; outChildrenString+=arrParent[iParent]; newParent = getParentList(arrParent[iParent],"base"); outChildrenString+=newParent.length; if(newParent.length>0){ outChildrenString+=showParentList(newParent); } outChildrenString+="
  2. "; } outChildrenString+="
"; g_currShowDeep--; return(outChildrenString); } function getParentList(word,findIn){ var arrParentList = new Array(); for(iDict=0;iDict0){ isFind=false; for(iWord in arrParentList){ if(arrParentList[iWord]==thisParent){ isFind=true; } } if(!isFind){ arrParentList.push(thisParent); } } } } else{ thisParent=g_DictWordList[iDict].Parent; if(thisParent.length>0){ isFind=false; for(iWord in arrParentList){ if(arrParentList[iWord]==thisParent){ isFind=true; } } if(!isFind){ arrParentList.push(thisParent); } } } } } return(arrParentList); } function dictShowCurrWordList(){ preOpParentInfo(); var strWord=""; strWord+="

"+g_findWord+"

"; strWord+="

select a word

"; for(iDict in g_DictWordList){ if(g_findWord==g_DictWordList[iDict].Pali){ strWord+="

"+g_DictWordList[iDict].Pali+"["+g_DictWordList[iDict].Type+"@"+g_DictWordList[iDict].Gramma+"]"+g_DictWordList[iDict].Mean+"["+g_DictWordList[iDict].Factors; } } document.getElementById('id_dict_curr_word_inner').innerHTML=strWord; } //show dict find result function dictFindShow(showId){ var strWordFamily=""; strWordFamily+="

"+g_findWord+"

"; strWordFamily+='

['+g_DictWordList[showId].Type+"@"+g_DictWordList[showId].Gramma+"]"+g_DictWordList[showId].Mean+"["+g_DictWordList[showId].Factors+"]

"; if(g_findMode=="parent"){ pList = getParentList(g_findWord,""); if(pList.length>0){ strWordFamily+=showParentList(pList); } } if(g_findMode=="children"){ cList = getChildrenList(showId); if(cList.length>0){ strWordFamily+=showChildrenList(cList); } } document.getElementById('id_dict_curr_word_inner').innerHTML=strWordFamily; } function showSubNode(obj){ eParent = obj.parentNode; var x=eParent.getElementsByTagName("div"); if(x[0].style.display=="none"){ x[0].style.display="block"; obj.innerHTML="-"; } else{ x[0].style.display="none"; obj.innerHTML="+"; } }