[$] Pr1v473 xHeEl B4ckD00RzZ [$]

Current Path : D:/InetPub/vhosts/kuccs.com.kw/httpdocs/PortalCMS/scripts/editor/scripts/moz/
Upload File
Current File : D:/InetPub/vhosts/kuccs.com.kw/httpdocs/PortalCMS/scripts/editor/scripts/moz/form_text.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=parent.oUtil.langDir;
  document.write("<scr"+"ipt src='../language/"+sLangDir+"/form_text.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()
    {
    parent.oUtil.onSelectionChanged=new Function("realTime()");
    }

function bodyOnLoad()
    {
    loadTxt();

    window.onfocus=doWindowFocus;
    parent.oUtil.onSelectionChanged=new Function("realTime()");

    realTime()
    }

function bodyOnUnload() {
  parent.oUtil.onSelectionChanged=null;
}

function realTime()
    {
    var oEditor=parent.oUtil.oEditor;
    var oSel=oEditor.getSelection();

    var selEl = parent.getSelectedElement(oSel);
    oEl = GetElement(selEl, "INPUT");

    //TEXT or PASSWORD
    var btnInsert = document.getElementById("btnInsert");
    var btnApply = document.getElementById("btnApply");
    var btnOk = document.getElementById("btnOk");

    var inpName = document.getElementById("inpName");
    var inpValue = document.getElementById("inpValue");
    var inpType = document.getElementById("inpType");
    var inpSize = document.getElementById("inpSize");
    var inpMaxLength = document.getElementById("inpMaxLength");
    var inpNumLine = document.getElementById("inpNumLine");

    var idNumLine = document.getElementById("idNumLine");
    var idMaxLength = document.getElementById("idMaxLength");
    var idNumLine = document.getElementById("idNumLine");


    if (oEl)
        {
        if(oEl.type=="text" || oEl.type=="password")
            {
            btnInsert.style.display="none";
            btnApply.style.display="block";
            btnOk.style.display="block";

            inpType.disabled=true;
            idNumLine.style.display="none";
            idMaxLength.style.display="";

            inpType.value=oEl.type;
            if(oEl.NAME)inpName.value=oEl.NAME;
            if(oEl.name)inpName.value=oEl.name;
            inpValue.value=oEl.value;
            if(oEl.size) inpSize.value=oEl.size;
            inpMaxLength.value=oEl.getAttribute("MAXLENGTH");

            inpNumLine.value="";

            return;
            }
        }

    //TEXTAREA
    oEl = GetElement(selEl, "TEXTAREA");
    if (oEl)
        {
        btnInsert.style.display="none";
        btnApply.style.display="block";
        btnOk.style.display="block";

        inpType.disabled=true;
        idNumLine.style.display="";
        idMaxLength.style.display="none";

        inpType.value=oEl.type;
        if(oEl.NAME)inpName.value=oEl.NAME;
        if(oEl.name)inpName.value=oEl.name;
        inpValue.value=oEl.value;
        inpSize.value=oEl.getAttribute("COLS");
        inpNumLine.value=oEl.getAttribute("ROWS");

        inpMaxLength.value="";

        return;
        }

    if (!oEl)
        {
        btnInsert.style.display="block";
        btnApply.style.display="none";
        btnOk.style.display="none";

        inpType.disabled=false;

        inpType.value="text";
        inpName.value="text1";
        inpValue.value="";
        inpSize.value="15";
        idMaxLength.style.display="";
        inpMaxLength.value="";
        inpNumLine.value="";
        }
    }

function doApply()
    {

    var btnInsert = document.getElementById("btnInsert");
    var btnApply = document.getElementById("btnApply");
    var btnOk = document.getElementById("btnOk");

    var inpName = document.getElementById("inpName");
    var inpType = document.getElementById("inpType");
    var inpSize = document.getElementById("inpSize");
    var inpMaxLength = document.getElementById("inpMaxLength");
    var inpNumLine = document.getElementById("inpNumLine");
    var inpValue = document.getElementById("inpValue");

    var idNumLine = document.getElementById("idNumLine");
    var idMaxLength = document.getElementById("idMaxLength");
    var idNumLine = document.getElementById("idNumLine");

    var oEditor=parent.oUtil.oEditor;
    var oSel=oEditor.getSelection();
    var range = null;

    parent.oUtil.obj.saveForUndo();

    var oEl = parent.getSelectedElement(oSel);

    if (oEl.nodeName != "INPUT" && oEl.nodeName != "TEXTAREA") {

        if(inpType.value=="text" || inpType.value=="password")
            {
            oEl = oEditor.document.createElement("INPUT");
            } else
        if(inpType.value=="textarea")
            {
            oEl = oEditor.document.createElement("TEXTAREA");
            }

        oSel = oEditor.getSelection();
        range = oSel.getRangeAt(0);
        range.collapse(true);
        range.insertNode(oEl);
        range = oEditor.document.createRange();
        range.selectNodeContents(oEl);
        oSel = oEditor.getSelection();
        oSel.removeAllRanges();
        oSel.addRange(range);

    }
    if(inpType.value=="text" || inpType.value=="password")
        {
        oEl.type = inpType.value;
        oEl.name = inpName.value;
        oEl.size = inpSize.value!="" ? inpSize.value : "";
        oEl.setAttribute("maxlength", (inpMaxLength.value!="" ? inpMaxLength.value : ""));
        oEl.setAttribute("value", inpValue.value);
        oEl.value=inpValue.value;
        } else
    if(inpType.value=="textarea")
        {
        oEl.name = inpName.value;
        oEl.cols = inpSize.value!="" ? inpSize.value : "";
        oEl.setAttribute("rows", (inpNumLine.value!="" ? inpNumLine.value : ""));
        oEl.setAttribute("value", inpValue.value);
        oEl.value=inpValue.value;
        }

    realTime();

    parent.realTime(parent.oUtil.obj);
    parent.oUtil.obj.selectElement(0);
    window.setTimeout("window.focus()", 10);
    }

function doChangeType()
    {

    var inpName = document.getElementById("inpName");
    var inpType = document.getElementById("inpType");

    var idNumLine = document.getElementById("idNumLine");
    var idMaxLength = document.getElementById("idMaxLength");
    var idNumLine = document.getElementById("idNumLine");


    if(inpType.value=="text" || inpType.value=="password")
        {
        idNumLine.style.display="none";
        idMaxLength.style.display=""
        }
    else
        {
        idNumLine.style.display="";
        idMaxLength.style.display="none"
        }

    if(inpType.value=="text")
        {
        inpName.value="text1"
        }
    if(inpType.value=="textarea")
        {
        inpName.value="textarea1"
        }
    if(inpType.value=="password")
        {
        inpName.value="password1"
        }
    }
</script>
</head>
<body style="overflow:hidden;">

<table width=100% height=100% align=center cellpadding=0 cellspacing=0>
<tr>
<td valign=top style="padding:5px;height:100%">
    <table width=100%>
    <tr>
        <td nowrap width=20><span id=txtLang name=txtLang>Type</span>:&nbsp;&nbsp;</td>
        <td width=100%>
            <select name=inpType id=inpType onchange="doChangeType()" style="width:100%" class="inpSel">
                <option value="text" id="optLang" name="optLang">Text</option>
                <option value="textarea" id="optLang" name="optLang">Textarea</option>
                <option value="password" id="optLang" name="optLang">Password</option>
            </select>
        </td>
    </tr>
    <tr>
        <td nowrap><span id=txtLang name=txtLang>Name</span>:&nbsp;&nbsp;</td>
        <td><INPUT type="text" NAME="inpName" ID="inpName" style="width:100%;padding-left:2px" value="text1" class="inpTxt"></td>
    </tr>
    <tr>
        <td nowrap><span id=txtLang name=txtLang>Size</span>:&nbsp;&nbsp;</td>
        <td><INPUT type="text" NAME="inpSize" id="inpSize" size=3 value=15 class="inpTxt"></td>
    </tr>
    <tr id=idMaxLength style="display:none">
        <td nowrap><span id=txtLang name=txtLang>Max Length</span>:&nbsp;&nbsp;</td>
        <td><INPUT type="text" NAME="inpMaxLength" id="inpMaxLength" size=3 class="inpTxt"></td>
    </tr>
    <tr id=idNumLine style="display:none">
        <td nowrap><span id=txtLang name=txtLang>Num Line</span>:&nbsp;&nbsp;</td>
        <td><INPUT type="text" NAME="inpNumLine" id="inpNumLine" size=3 class="inpTxt"></td>
    </tr>
    <tr>
        <td nowrap valign=top><span id=txtLang name=txtLang>Value</span>:&nbsp;&nbsp;</td>
        <td><TEXTAREA NAME="inpValue" id="inpValue" rows=5 style="width:100%" class="inpTxt"></TEXTAREA></td>
    </tr>
    </table>

</td>
</tr>
<tr>
<td class="dialogFooter" align="right">
    <table cellpadding=0 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>