test1

Tiglath Suriol tiglathsuriol at gmail.com
Tue Mar 24 22:47:40 EDT 2015


<head>
<style type="text/css">
body {color:black;}
h1 {text-align:center;color:maroon;font-size:30px;font-style:normal;}
td {font-size:12;font-style:monospace;}
}
</style>
<title>{% block title %}{% endblock %}</title>
<script>
</script>
</head>
<body>
<h1>IPDB Data Input Window</h1>
<div style="float: left;width: 40%;margin-left:30px">
<p>
    <table> 
        <tr>
        <form action="/add/" method="POST">
            <table style="border-width:1px; border-color:Black ; border-style :groove ;">
                <tr> 
                    <td>Address:</td><td>{{ form.address }}</td>
                </tr>
                <tr> 
                    <td>Filename:</td><td>{{ form.filename }}</td>
                    <td><input type="submit" value="Add" "></td>
                </tr>
            </table>
       </form>
        </tr>
        <tr>
        <form action="/delete/" method="POST">
            <table style="border-width:1px; border-color:Black ; border-style :groove ;">
                <tr>
                    <td>{{ form.box }}</td>
                    <td><button type="submit">Delete Selected</button></td>
                </tr>
            </table>
       </form>
        </tr>
    </table>
</p>
</div>
<div style="float: right; width: 50%;">
<p>
<form action="/save/" method="POST">
    <table style="border-width:1px; border-color:Black ; border-style :groove ;">
        <tr>
            <td>Description:</td><td>{{ form.description }}</td>
        </tr>
        <tr>
            <td>Expiry date:</td><td>{{ form.expiry }}</td>
        </tr>
        <tr>
            <td><input type="submit" value="Submit" /></td>
        </tr>
    </table>
</form>
</p>
</div>

<script type="text/javascript">

function submitReset()
{
    document.getElementById("frm1").reset();
}

function add()
{
    window.location.replace="http://127.0.0.1:8000/add/"
}

function clearForms() 
{
    // variable declaration
    var x, y, z, type = null;
    // loop through forms on HTML page
    for (x = 0; x < document.forms.length; x++) {
        // loop through each element on form
        for (y = 0; y < document.forms[x].elements.length; y++) {
            // define element type
            type = document.forms[x].elements[y].type;
            // alert before erasing form element
            //alert('form='+x+' element='+y+' type='+type);
            // switch on element type
            switch (type) {
                case 'text':
                case 'textarea':
                case 'password':
                //case "hidden":
                    document.forms[x].elements[y].value = '';
                    break;
                case 'radio':
                case 'checkbox':
                    document.forms[x].elements[y].checked = '';
                    break;
                case 'select-multiple':
                    for (z = 0; z < document.forms[x].elements[y].options.length; z++) {
                        document.forms[x].elements[y].options[z].selected = false;
                    }
                case 'iframe' 
            } // end switch
        } // end for y
    } // end for x
    //x = window.frames["frame1"]; 
    //x.document.body.innerHTML = "";
}
</script>
</body>
</html>

-------------------------------------------
<head>
<style type="text/css">
body {
    font-size:10px;
    color:black;
    backgrounc:FFFFCC; 
}
h1 { 
    text-align:center;
    color:maroon;
    font-size:30px;
    font-style:normal;
}
td {
    font-size:12;
    font-style:monospace;
}
select {
    background: transparent;
    width: 500; 
    height: 300; 
    padding: 5px;
    font-size: 16px;
    border: 1px solid #ccc;
    height: 34px;
} 
#righty {
    float:right ;
    width:20% ;
}
#des {
    float:right ;
    width:50% ;
}
#tab {
    font-size:12;font-style:normal;
}
#msg {
    font-size:12;font-style:monospace;background:FFCC66;
}
#id_box {
    width:300px;height:150;border:1px solid black;background-color:ivory;padding:8px;
}
</style>

<h1>IPDB Asset Input</h1>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9/jquery.min.js"> </script>
<script language="JavaScript" type="text/javascript">
<!--

window.onload = function pop()
{
    {% if popup %}
        alert("This is a pop up!!!") ;
    {% endif %}
    document.getElementById('id_address').focus()
}

function append()
{
    var elSel = document.getElementById('id_box');

    var addr = document.getElementById('id_address').value ;
    if (addr.length > 0) {
        var newEntry = document.createElement('option');
        newEntry.text = addr ; 
        newEntry.value = addr ; 
        try {
          elSel.add(newEntry, null); // standards compliant; doesn't work in IE
        }
        catch(ex) {
          elSel.add(newEntry); // IE only
        }
        document.getElementById('id_address').value = "";
        document.getElementById('id_address').focus()
    }
}

function removeSelected()
{
    var box = document.getElementById('id_box');
    var i;
    for (i = box.length - 1; i>=0; i--) {
        if (box.options[i].selected) {
            box.remove(i);
        }
    }
}

function submitForm()
{
    var box = document.getElementById('id_box');
    var cache = document.getElementById('id_cache');
    var file = document.getElementById('id_file');

    for (var i = 0; i < box.options.length; i++) { 
         if (cache.value.length > 0) {
             cache.value += "," ;
         }
         cache.value += box.options[i].value ; 
    } 
    if (cache.value.length > 0 || file.value.length > 0) {
        document.input.submit();
        cache.value = "";
        file.value = "" ;
    }
}

var filename = "" ;

function addfile()
{
    var box = document.getElementById('id_box');
    var f = document.getElementById('id_file').value;

    if (f.length > 0) {
        if (filename.length > 0) {
            var i;
            for (i = box.length - 1; i >= 0; i--) {
                if (box.options[i].text == filename) {
                    box.remove(i);
                }
            }
        }
        var newEntry = document.createElement('option');
        newEntry.text = f ; 
        newEntry.value = "__file__" ; 
        
        try {
            box.add(newEntry, null); // standards compliant; doesn't work in IE
        }
        catch(ex) {
            box.add(newEntry); // IE only
        }
        filename = f ;
        //alert("adding filename: " + filename);
    }
}

//-->
</script>
</head>
<body>
    {% if errors %}
        <ul>
            {% for error in errors %}
            <li>{{ error }}</li>
            {% endfor %}
        </ul>
    {% endif %}

    <form name="input" action="/input/" method="post" enctype="multipart/form-data">{% csrf_token %}
    <table id="tab">
        <tr>
            <th>IP Address, Address Range, or FQDN</th><th></th><th>Select CSV file</th>
        </tr>
        <tr>
            <td><input id="id_address" type="text" name="address" onkeydown="if(event.keyCode==13){append();return false;}" maxlength="128" />
            <input type="button" id="addbtn" onclick="append();" value="Add"/></td>
            <td>       OR/AND       </td>
            <td><input id="id_file" type="file" name="file" onchange="addfile();"> </td>
            <td>    Rating:      </td><td><input type="radio" name="rating" value="0" checked> Neutral<br>
            <input type="radio" name="rating" value="1">  Good<br>
            <input type="radio" name="rating" value="-1"> Bad</td>
        </tr>
    </table>
        <p id="des"><br>
            Source
            <input id="id_source" type="text" name="source" maxlength="128" /><br>
            Description <br>
            <textarea rows="9" cols="60" id="id_description" maxlength="1024" name="description"></textarea> 
        </p>
        <p>Assets to Submit <br> 
            <select multiple="multiple" name="box" id="id_box"></select>
        </p>
        <p><input type="button" onclick="removeSelected();"  value="Remove Selected"/></p>
        <input type=hidden maxlength="1024000" name="cache" id="id_cache">
        <input id="righty" type="button" onclick="submitForm();"value="Submit">
        <div id="msg">
            <p>
                {% if err %}
                    <ul>
                        {% for e in err %}
                            <li style="font-size:14px; color:red; font-weight:bold; font-style:italic;">{{ e }}</li>
                        {% endfor %}
                    </ul>
                {% endif %}
                {% if msg %}
                    <p style="font-size:14px; color:#538b01; font-weight:bold; font-style:italic;"> {{ msg }}</p>
                {% endif %}
            </p>
        </div>
    </form>
</body>
</html>

--------------------------------------

<html>
<head>
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}/css/common.css">
<title>{% block title %}{% endblock %}</title>
<script type="text/javascript">
window.onload = function set_search_key()
{
    //{% if search_key %}
        //var key = "{{ search_key }}" ;
        //var a = key.split(".") ;
        //alert("key = " + key + " a[0] = " + a[0] + " a[1] = " + a[1]) ;
        //sessionStorage.setItem("num_pages", a[1]) ;
        //sessionStorage.setItem("search_key", key) ;
        //sessionStorage.setItem("current_page", 0) ;
    //{% else %}
        //sessionStorage.setItem("num_pages", 0) ;
        //sessionStorage.setItem("search_key", "null") ;
        //sessionStorage.setItem("current_page", 0) ;
    //{% endif %}
    //alert("key current_page num_pages " + sessionStorage.getItem("search_key") + " | " + sessionStorage.getItem("current_page") + " | " + sessionStorage.getItem("num_pages")) ;

    {% if results %}
        var n = 0 ;
        var box = document.getElementById('id_box');
        {% for i,s in results %}
            //var newEntry   = document.createElement('option');
            ////newEntry.text  = res.rows[i].str ; 
            ////newEntry.value = res.rows[i].id ; 
            var newEntry = new Option(unescape("{{ s }}".replace(/ /g, "%A0")), "{{ i }}") ;
            if (n % 2) {
                newEntry.style.setProperty('background', 'LightCyan');
            } else {
                newEntry.style.setProperty('background', 'PaleTurquoise');
            }
            newEntry.style.setProperty('font', 'monospace');
            try {
                box.add(newEntry, null);  //  Standards compliant; does not work in IE.
            }
                catch(ex) {
                box.add(newEntry);        //  IE only.
            }
            n = n + 1 ;
        {% endfor %}
    {% endif %}

}
</script>
<script type="text/javascript" src="{{ STATIC_URL }}/js/search.js"></script>
</head>
<h1 id="gradient" >IPDB Search</h1>
<body>
<div id="outerDiv">
<div float:left; width: 40%; margin-left:30px">
<form name="search" action="/search/" method="POST">{% csrf_token %}
<p>
    <table> 
        <tr>
            <table id="inputTable">
                <th>IP Address Search Query</th>
                <tr> 
                    <td><input id="address" type="text" name="address" maxlength="128" /></td>
                </tr>
                <th>Textual Search Query</th>
                <tr> 
                    <td><input id="text" type="text" name="text" maxlength="128" /></td>
                    <td><input id="formButton" type="button" onclick="submitForm();" value="Submit"></td>
                </tr>
            </table>
    </table>
    <input type="hidden" maxlength="64" name="search_key" id="id_search_key">
    {% if match_q %}
        <p id="par1">Search Results for: {{ match_q }}<br> 
    {% else %}
        <p id="par1">Search Results <br> 
    {% endif %}
        <pre id="par1">     NAME       COUNTRY   RATING      DESCRIPTION</pre>
            <select multiple="multiple" style="font:12px monospace" name="box" id="id_box" ondblclick="send_asset();"> </select>
        </p>
    <p>
        {% if nomatch_q %}
            <p id="par2">
                 No matches found for: {{ nomatch_q }} 
            </p>
        {% endif %}
        {% if err %}
            <p >
                <li style="font-size:14px; color:red; font-weight:bold; font-style:italic;">{{ err }}</li>
            </p>
        {% endif %}
    </p>
    </form>
</div>
</div>
</body>
</html>

------------------------------





More information about the Python-list mailing list