0byt3m1n1
Path:
/
data
/
17
/
1
/
18
/
11
/
1670011
/
user
/
1801231
/
htdocs
/
marketting
/
js
/
scripts
/
moz
/
[
Home
]
File: form_list.htm
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="../style/editor.css" rel="stylesheet" type="text/css"> <script> var sLangDir=window.opener.oUtil.langDir; document.write("<scr"+"ipt src='../language/"+sLangDir+"/form_list.js'></scr"+"ipt>"); </script> <script>writeTitle()</script> <script> function GetElement(oElement,sMatchTag) { while (oElement!=null&&oElement.tagName!=sMatchTag) { if(oElement.tagName=="BODY")return null; oElement=oElement.parentNode; } return oElement; } function doWindowFocus() { window.opener.oUtil.onSelectionChanged=new Function("realTime()"); } function bodyOnLoad() { window.onfocus=doWindowFocus; window.opener.oUtil.onSelectionChanged=new Function("realTime()"); realTime() } function realTime() { var oEditor=window.opener.oUtil.oEditor; var oSel=oEditor.getSelection(); var selEl = window.opener.getSelectedElement(oSel); oEl = GetElement(selEl, "SELECT"); var btnInsert = document.getElementById("btnInsert"); var btnApply = document.getElementById("btnApply"); var btnOk = document.getElementById("btnOk"); var inpName = document.getElementById("inpName"); var inpSize = document.getElementById("inpSize"); var chkMultiple = document.getElementById("chkMultiple"); var selOptions = document.getElementById("selOptions"); var inpValue = document.getElementById("inpValue"); var inpDisplayed = document.getElementById("inpDisplayed"); if (oEl) { btnInsert.style.display="none"; btnApply.style.display="block"; btnOk.style.display="block"; if(oEl.name)inpName.value=oEl.name; if(oEl.size)inpSize.value=oEl.size; if(oEl.multiple) chkMultiple.checked=true; else chkMultiple.checked=false; doMultiple(); //MULTIPLE or NOT //remove all selOptions.options.length = 0; for(var i=0;i<oEl.options.length;i++) { var sDisplayed = oEl.options[i].text; var sValue = oEl.options[i].value; var oOption = document.createElement("OPTION") oOption.value = sValue; oOption.text = sValue + " ... " + sDisplayed; if(oEl.options[i].selected) oOption.selected=true; selOptions.options[selOptions.options.length] = oOption; } } else { btnInsert.style.display="block"; btnApply.style.display="none"; btnOk.style.display="none"; inpName.value="list1"; inpSize.value="1"; chkMultiple.checked=false; //remove all selOptions.options.length = 0; } inpValue.value=""; inpDisplayed.value=""; } function doApply() { var oEditor=window.opener.oUtil.oEditor; var oSel=oEditor.getSelection(); var selEl = window.opener.getSelectedElement(oSel); oEl = GetElement(selEl, "SELECT"); var inpName = document.getElementById("inpName"); var inpSize = document.getElementById("inpSize"); var chkMultiple = document.getElementById("chkMultiple"); var selOptions = document.getElementById("selOptions"); var inpValue = document.getElementById("inpValue"); var inpDisplayed = document.getElementById("inpDisplayed"); window.opener.oUtil.obj.saveForUndo(); if(oEl) { oEl.size = (inpSize.value!="" ? inpSize.value : oEl.size); oEl.name = (inpName.value!="" ? inpName.value : oEl.value); oEl.multiple = chkMultiple.checked ? "multiple" : ""; } else { var elm = oEditor.document.createElement("SELECT"); elm.size = inpSize.value; elm.name = inpName.value; elm.multiple = chkMultiple.checked ? "multiple" : ""; oEl = elm; oSel = oEditor.getSelection(); range = oSel.getRangeAt(0); range.collapse(true); range.insertNode(elm); } //remove all oEl.options.length = 0; for(var i=0;i<selOptions.options.length;i++) { var sTmp = selOptions.options[i].text; var arrTmp = sTmp.split(" ... "); var oOption = oEditor.document.createElement("OPTION") oOption.text = arrTmp[1] oOption.value = arrTmp[0] if(selOptions.options[i].selected) oOption.selected=true; oEl.options[oEl.options.length] = oOption; } range = oEditor.document.createRange(); range.selectNodeContents(oEl); oSel = oEditor.getSelection(); oSel.removeAllRanges(); oSel.addRange(range); realTime(); window.opener.realTime(window.opener.oUtil.obj); window.opener.oUtil.obj.selectElement(0); window.setTimeout("window.focus()", 10); } /*** List ***/ function doListAdd() { var inpDisplayed = document.getElementById("inpDisplayed"); var inpValue = document.getElementById("inpValue"); var selOptions = document.getElementById("selOptions"); if (inpValue.value=="") {inpValue.focus(); return;} if (inpDisplayed.value=="") inpDisplayed.value = inpValue.value; var oOption = document.createElement("OPTION"); oOption.text = inpValue.value + " ... " + inpDisplayed.value; selOptions.options[selOptions.options.length] = oOption; inpValue.value=""; inpDisplayed.value=""; inpValue.focus(); } function doListDel() { var selOptions = document.getElementById("selOptions"); if(selOptions.selectedIndex==-1)return; selOptions.options[selOptions.selectedIndex] = null; } function doListUp() { var selOptions = document.getElementById("selOptions"); if(selOptions.selectedIndex==-1)return; if(selOptions.selectedIndex==0) return; var selIndex = parseInt(selOptions.selectedIndex); var oSelect = selOptions.options[selIndex]; selOptions.options[selIndex] = selOptions.options[selIndex-1].cloneNode(true); selOptions.options[selIndex-1] = oSelect; oSelect.selected = true; selOptions.selectedIndex = selIndex-1; } function doListDown() { var selOptions = document.getElementById("selOptions"); if(selOptions.selectedIndex==-1)return; if(selOptions.selectedIndex==selOptions.options.length-1) return; var selIndex = parseInt(selOptions.selectedIndex); var oSelect = selOptions.options[selIndex]; selOptions.options[selIndex] = selOptions.options[selIndex+1].cloneNode(true); selOptions.options[selIndex+1] = oSelect; oSelect.selected = true; selOptions.selectedIndex = selIndex+1; } function doMultiple() { var selOptions = document.getElementById("selOptions"); var chkMultiple = document.getElementById("chkMultiple"); if(chkMultiple.checked) selOptions.multiple="multiple"; else selOptions.removeAttribute("multiple"); } </script> </head> <body onload="loadTxt();bodyOnLoad()" style="overflow:hidden;"> <table width=100% height=100% align=center cellpadding=0 cellspacing=0> <tr> <td valign=top style="padding:5;height:100%"> <table width=100%> <tr> <td nowrap><span id=txtLang name=txtLang>Name</span>: </td> <td width=100% style="padding-left:5;"><INPUT type="text" ID="inpName" NAME="inpName" style="width:100%" value="list1" class="inpTxt"></td> </tr> <tr> <td nowrap><span id=txtLang name=txtLang>Size</span>: </td> <td style="padding-left:5"><INPUT type="text" ID="inpSize" NAME="inpSize" size=3 class="inpTxt"></td> </tr> <tr> <td nowrap><span id=txtLang name=txtLang>Multiple select</span>: </td> <td style="padding-left:5"><INPUT type="checkbox" ID="chkMultiple" NAME="chkMultiple" onclick="doMultiple()" class="inpChk"> </td> </tr> <tr> <td colspan=2><span id=txtLang name=txtLang>Values</span>:</td> </tr> </table> <table width=100%> <tr> <td> <table cellpadding=0 cellspacing=0 width=100%> <tr> <td nowrap style="padding-right:4"> <INPUT type="text" ID="inpValue" NAME="inpValue" style="width:50%" class="inpTxt"> <INPUT type="text" ID="inpDisplayed" NAME="inpDisplayed" style="width:50%" class="inpTxt"> </td> <td> <INPUT type="button" name=btnAdd id=btnAdd value=" add " style="width:70px" onclick="doListAdd()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'"> </td> </tr> <tr> <td width=100%> <SELECT size=8 style="width:100%" ID="selOptions" NAME="selOptions" multiple class="inpSel"> </SELECT> </td> <td> <INPUT type="button" name=btnUp id=btnUp value=" up " style="width:70px" onclick="doListUp()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'"><br> <INPUT type="button" name=btnDown id=btnDown value=" down " style="width:70px" onclick="doListDown()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'"><br> <INPUT type="button" name=btnDel id=btnDel value=" del " style="width:70px" onclick="doListDel()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'"> </td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td class="dialogFooter" style="padding:6px;" align="right"> <table cellpadding=1 cellspacing=0> <td> <input type=button name=btnCancel id=btnCancel value="cancel" onclick="self.close()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'"> </td> <td> <input type=button name=btnInsert id=btnInsert value="insert" onclick="doApply();self.close()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'"> </td> <td> <input type=button name=btnApply id=btnApply value="apply" style="display:none" onclick="doApply()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'"> </td> <td> <input type=button name=btnOk id=btnOk value=" ok " style="display:none;" onclick="doApply();self.close()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'"> </td> </table> </td> </tr> </table> </body> </html>