feat: NAPALM driver for HPE OfficeConnect 1820/1920S
These switches have no CLI at all — no SSH, no Telnet and no ArubaOS-Switch REST API — so the ProCurve driver cannot serve them despite the shared vendor. The only management surface is the web UI, which ships its table data as JavaScript array literals; those parse with ast.literal_eval, so the driver needs no HTML parser and no dependency beyond napalm/requests. Read-only by design: the platform exposes a single administrator account with no privilege levels, and serves HTTPS only after a certificate has been uploaded, so the polling credential is necessarily the admin credential over a plain channel. Implements get_facts, get_interfaces, get_vlans, get_vlans_detail and get_mac_address_table, plus HTTP/SNMP fingerprints for discovery. Tested against an HPE OfficeConnect 1820 8G PoE+ (65W), J9982A, PT.02.19.
This commit is contained in:
+531
@@ -0,0 +1,531 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!-- Copyright © 2017-2022 Hewlett Packard Enterprise Development LP. -->
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Get Connected</title>
|
||||
<link rel="shortcut icon" href="/htdocs/login/favicon.ico?">
|
||||
<link type="text/css" media="screen" rel="stylesheet" href="/htdocs/static/bt1707389424/css/jquery-ui-1.12.1.custom.css">
|
||||
<link type="text/css" media="screen" rel="stylesheet" href="/htdocs/static/bt1707389424/jquery/datatables_1_9_4/css/jquery.dataTables_themeroller.css">
|
||||
<link type="text/css" media="screen" rel="stylesheet" href="/htdocs/static/bt1707389424/css/style_datatables_custom.css">
|
||||
<link type="text/css" media="screen" rel="stylesheet" href="/htdocs/static/bt1707389424/css/style_common_pages.css">
|
||||
<link type="text/css" media="screen" rel="stylesheet" href="/htdocs/static/bt1707389424/css/tabs.css">
|
||||
<!--[if ie 7]>
|
||||
<link rel="stylesheet" href="/htdocs/static/bt1707389424/css/style_browser_fixups_ie7.css" type="text/css">
|
||||
<![endif]-->
|
||||
<!--[if gte ie 7]>
|
||||
<link rel="stylesheet" href="/htdocs/static/bt1707389424/css/style_browser_fixups_ie7plus.css" type="text/css">
|
||||
<![endif]-->
|
||||
<script type="text/javascript" src="/htdocs/static/bt1707389424/jquery/jquery_3_5_1/jquery-3.5.1.min.js"></script>
|
||||
<script type="text/javascript" src="/htdocs/static/bt1707389424/jquery/jquery_ui_1_12_1/jquery-ui-1.12.1.min.js"></script>
|
||||
<script type="text/javascript" src="/htdocs/static/bt1707389424/jquery/datatables_1_9_4/jquery.dataTables.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body class="ui-state-default fp_jqtds_page_body fp_corner_bottom">
|
||||
<a name="focus_top" id="focus_top"></a>
|
||||
|
||||
<div id="fp_div_page_title_bar" class="fp_jqtds_h1">
|
||||
<div id="fp_div_page_title_text">Get Connected</div>
|
||||
<div id="fp_div_title_bar_tooltip">
|
||||
<a class="fp_anchor_tooltip" href="/htdocs/lang/en_us/help/base/help_network_ipv4_cfg.lsp" target="_blank">
|
||||
<img src="/htdocs/static/bt1707389424/images/icon_help_black24-helpText.png" title="Help" alt="Help" border="0">
|
||||
</a>
|
||||
</div><!-- fp_div_title_bar_tooltip -->
|
||||
</div><!-- fp_div_page_title_bar -->
|
||||
|
||||
<div class="fp_page_container">
|
||||
|
||||
<form id="form1" name="form1" method="post" action="/htdocs/pages/base/network_ipv4_cfg.lsp">
|
||||
|
||||
<div class="fp_sub_container">
|
||||
<table class="fp_page_table_class" id="table_1" cellpadding="0" cellspacing="0" >
|
||||
<tbody>
|
||||
|
||||
<!-- Network Details -->
|
||||
<tr>
|
||||
<td colspan="3"><div class="fp_jqtds_h2 fp_sub_title fp_sub_title_first">Network Details</div></td>
|
||||
</tr>
|
||||
|
||||
<tr> <!-- Protocol Type -->
|
||||
<td class="ui-widget-content fp_data_label">Protocol Type</td>
|
||||
<td class="ui-widget-content fp_data_value" id="protocol_type">
|
||||
<input type="radio" name="protocol_type_sel[]" id="protocol_type_sel_static" value="static" checked="checked" class="fp_inputfield" onchange="net_config_change(this);">
|
||||
<label for="protocol_type_sel_static">Static </label>
|
||||
<input type="radio" name="protocol_type_sel[]" id="protocol_type_sel_dhcp" value="dhcp" class="fp_inputfield" onchange="net_config_change(this);">
|
||||
<label for="protocol_type_sel_dhcp">DHCP </label>
|
||||
|
||||
<button title="Refresh DHCP Lease" id="b_form1_refresh_dhcp" class="fp_button_icon ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" type="submit" onclick="jslib_b_pressed_g='refresh_dhcp';"> </button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr> <!-- IP Address -->
|
||||
<td class="ui-widget-content fp_data_label">IP Address</td>
|
||||
<td class="ui-widget-content fp_data_value">
|
||||
<input class="fp_inputfield" type="text" id="ip_addr" name="ip_addr" size="15" maxlength="15"
|
||||
value="192.0.2.20"> (x.x.x.x)</td>
|
||||
</tr>
|
||||
|
||||
<tr> <!-- Subnet Mask -->
|
||||
<td class="ui-widget-content fp_data_label">Subnet Mask</td>
|
||||
<td class="ui-widget-content fp_data_value">
|
||||
<input class="fp_inputfield" type="text" id="subnet_mask" name="subnet_mask" size="15" maxlength="15"
|
||||
value="255.255.255.0"> (x.x.x.x)</td>
|
||||
</tr>
|
||||
|
||||
<tr> <!-- Gateway Address -->
|
||||
<td class="ui-widget-content fp_data_label">Gateway Address</td>
|
||||
<td class="ui-widget-content fp_data_value">
|
||||
<input class="fp_inputfield" type="text" id="gateway_address" name="gateway_address" size="15" maxlength="15"
|
||||
value="192.0.2.1"> (x.x.x.x)</td>
|
||||
</tr>
|
||||
|
||||
<tr> <!-- MAC Address -->
|
||||
<td class="ui-widget-content fp_data_label">MAC Address</td>
|
||||
<td class="ui-widget-content fp_data_value" id="mac_address">00:11:22:33:44:05</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- fp_sub_container -->
|
||||
|
||||
<div class="fp_sub_container">
|
||||
<table class="fp_page_table_class" id="table_2" cellpadding="0" cellspacing="0" >
|
||||
<tbody>
|
||||
|
||||
<!-- Web Parameters -->
|
||||
<tr>
|
||||
<td colspan="3"><div class="fp_jqtds_h2 fp_sub_title">Web Parameters</div></td>
|
||||
</tr>
|
||||
|
||||
<tr> <!-- Session Timeout -->
|
||||
<td class="ui-widget-content fp_data_label">Session Timeout (Minutes)</td>
|
||||
<td class="ui-widget-content fp_data_value">
|
||||
<input class="fp_inputfield" type="text" id="session_timeout" name="session_timeout" size="15" maxlength="2"
|
||||
value="5"> (1 to 60)</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- fp_sub_container -->
|
||||
|
||||
<div class="fp_sub_container">
|
||||
<table class="fp_page_table_class" id="table_3" cellpadding="0" cellspacing="0" >
|
||||
<tbody>
|
||||
|
||||
<!-- Management Access -->
|
||||
<tr>
|
||||
<td colspan="3"><div class="fp_jqtds_h2 fp_sub_title">Management Access</div></td>
|
||||
</tr>
|
||||
|
||||
<tr> <!-- Management VLAN ID -->
|
||||
<td class="ui-widget-content fp_data_label">Management VLAN ID</td>
|
||||
<td class="ui-widget-content fp_data_value" id="mvlan">
|
||||
<select name="mgmt_vlan_id_sel[]" id="mgmt_vlan_id_sel">
|
||||
<option id="mgmt_vlan_id_sel_1" value="1">1</option>
|
||||
<option id="mgmt_vlan_id_sel_10" value="10" selected="selected">10</option>
|
||||
<option id="mgmt_vlan_id_sel_20" value="20">20</option>
|
||||
<option id="mgmt_vlan_id_sel_30" value="30">30</option>
|
||||
<option id="mgmt_vlan_id_sel_40" value="40">40</option>
|
||||
<option id="mgmt_vlan_id_sel_50" value="50">50</option>
|
||||
<option id="mgmt_vlan_id_sel_60" value="60">60</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr> <!-- Management Port -->
|
||||
<td class="ui-widget-content fp_data_label">Management Port</td>
|
||||
<td class="ui-widget-content fp_data_value" id="mport">
|
||||
<select name="mgmt_port_sel[]" id="mgmt_port_sel">
|
||||
<option id="mgmt_port_sel_none" value="none" selected="selected">None</option>
|
||||
<option id="mgmt_port_sel_2" value="2">2</option>
|
||||
<option id="mgmt_port_sel_3" value="3">3</option>
|
||||
<option id="mgmt_port_sel_4" value="4">4</option>
|
||||
<option id="mgmt_port_sel_8" value="8">8</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- fp_sub_container -->
|
||||
|
||||
<div class="fp_sub_container">
|
||||
<table class="fp_page_table_class" id="table_4" cellpadding="0" cellspacing="0" >
|
||||
<tbody>
|
||||
|
||||
<!-- SNMP -->
|
||||
<tr>
|
||||
<td colspan="3"><div class="fp_jqtds_h2 fp_sub_title">SNMP</div></td>
|
||||
</tr>
|
||||
|
||||
<tr> <!-- SNMP -->
|
||||
<td class="ui-widget-content fp_data_label">SNMP</td>
|
||||
<td class="ui-widget-content fp_data_value">
|
||||
<input type="radio" name="snmp_sel[]" id="snmp_sel_enabled" value="enabled" checked="checked">
|
||||
<label for="snmp_sel_enabled">Enabled </label>
|
||||
<input type="radio" name="snmp_sel[]" id="snmp_sel_disabled" value="disabled">
|
||||
<label for="snmp_sel_disabled">Disabled </label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr> <!-- Community Name -->
|
||||
<td class="ui-widget-content fp_data_label">Community Name</td>
|
||||
<td class="ui-widget-content fp_data_value">
|
||||
<input class="fp_inputfield" type="text" id="community_name" name="community_name" size="15" maxlength="20"
|
||||
value="public"> (1 to 20 characters)</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- fp_sub_container -->
|
||||
|
||||
|
||||
<div id="page_buttons" class="fp_button_row">
|
||||
<input class="fp_button ui-button ui-widget ui-state-default" type="submit" id="b_form1_submit" name="b_form1_submit" value="Apply" onclick="jslib_b_pressed_g='submit';">
|
||||
|
||||
<input class="fp_button ui-button ui-widget ui-state-default" type="submit" id="b_form1_refresh" name="b_form1_refresh" value="Refresh" onclick="jslib_b_pressed_g='refresh';">
|
||||
|
||||
<input class="fp_button ui-button ui-widget ui-state-default" type="reset" id="b_form1_cancel" name="b_form1_cancel" value="Cancel" onclick="jslib_b_pressed_g='cancel';">
|
||||
</div> <!-- fp_button_row -->
|
||||
<input type="hidden" id="change_mvlan" name="change_mvlan" value="no">
|
||||
<input type="hidden" id="change_mport" name="change_mport" value="no">
|
||||
</form> <!-- form1 -->
|
||||
|
||||
|
||||
</div><!-- fp_page_container -->
|
||||
|
||||
<script type="text/javascript" language="JavaScript">
|
||||
<!--
|
||||
var jslib_msgs = parent.jslib_msgs_tbl;
|
||||
-->
|
||||
</script>
|
||||
<script type="text/javascript" src="/htdocs/static/bt1707389424/js/web-utils-combo.js"></script>
|
||||
<script type="text/javascript" src="/htdocs/static/bt1707389424/jquery/plugins/jquery-plugins-combo.js"></script>
|
||||
<script type="text/javascript" src="/htdocs/static/bt1707389424/jquery/datatables_1_9_4/jquery.dataTables-plugins.js"></script>
|
||||
<script type="text/javascript" src="/htdocs/lang/en_us/culture/globalize.culture.en-US.20120606.js"></script>
|
||||
|
||||
<script type="text/javascript" language="JavaScript">
|
||||
<!--
|
||||
|
||||
var prop =
|
||||
{
|
||||
gateway_address: new FieldProp({ defval: "", dname: "Gateway Address", formfield: "gateway_address", max: 15, min: 7, optional: true, regex: /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, type: 2 }),
|
||||
ip_addr: new FieldProp({ defval: "", dname: "IP Address", formfield: "ip_addr", max: 15, min: 7, optional: true, regex: /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, type: 2 }),
|
||||
community_name: new FieldProp({ defval: "", dname: "Community Name", formfield: "community_name", max: 20, min: 1, regex: /^[ -~]+$/, type: 2 }),
|
||||
session_timeout: new FieldProp({ defval: "5", dname: "Session Timeout", formfield: "session_timeout", max: 60, min: 1, regex: /^\d+$/, type: 3 }),
|
||||
subnet_mask: new FieldProp({ defval: "", dname: "Subnet Mask", formfield: "subnet_mask", max: 15, min: 7, optional: true, regex: /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, type: 2 })
|
||||
};
|
||||
jslib_form_validation_bind($('#form1').get(0), prop);
|
||||
|
||||
var errorMsg = "";
|
||||
|
||||
// individual form field validation function wrappers
|
||||
// (used for onChange and onSubmit events)
|
||||
//
|
||||
function ip_cfg_validate(field)
|
||||
{
|
||||
var proto = $("#protocol_type :checked").val();
|
||||
// Validate only for static
|
||||
if(proto !== "static")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (field.value.length > 0 && !ipv4_address_validate(field.value))
|
||||
{
|
||||
return { errmsg: "Improper address format" }
|
||||
}
|
||||
if (field.value.length === 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(field.name == 'ip_addr'){
|
||||
if(field.value == "255.255.255.255"){
|
||||
return { errmsg: "Invalid address" }
|
||||
}
|
||||
if (errorMsg == "The IP address and subnet mask combination is not valid"){
|
||||
return { errmsg: "Invalid address" }
|
||||
}
|
||||
}
|
||||
if(field.name == 'subnet_mask'){
|
||||
if (errorMsg == "The subnet mask is not valid"){
|
||||
return { errmsg: "Invalid address" }
|
||||
}
|
||||
}
|
||||
if(field.name == 'gateway_address'){
|
||||
if (errorMsg == "Gateway is not valid"){
|
||||
return { errmsg: "Invalid address" }
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
prop.ip_addr.uservalidate = ip_cfg_validate;
|
||||
prop.subnet_mask.uservalidate = ip_cfg_validate;
|
||||
prop.gateway_address.uservalidate = ip_cfg_validate;
|
||||
|
||||
prop.community_name.uservalidate = function(field) {
|
||||
if($('#snmp_sel_disabled').is(':checked'))
|
||||
return true;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
// Enable/disable network configuration entries: IP address, netmask and gateway
|
||||
// It depends on the selected network configuration protocol {'static', 'dhcp'}
|
||||
function net_conf_entries_update(net_cfg_proto)
|
||||
{
|
||||
if(net_cfg_proto !== "static")
|
||||
{
|
||||
// Show warning message for protocol change
|
||||
alert("Changing protocol mode will reset IP configuration!");
|
||||
}
|
||||
if (net_cfg_proto === "static")
|
||||
{
|
||||
$("#ip_addr, #subnet_mask, #gateway_address").prop("disabled", false);
|
||||
$("#ip_addr").val("192.0.2.20");
|
||||
$("#subnet_mask").val("255.255.255.0");
|
||||
$("#gateway_address").val("192.0.2.1");
|
||||
$("#b_form1_refresh_dhcp").button("disable");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#ip_addr, #subnet_mask, #gateway_address").prop("disabled", true);
|
||||
$("#b_form1_refresh_dhcp").button("enable");
|
||||
}
|
||||
}
|
||||
|
||||
// Issues request to refresh DHCP
|
||||
function dhcp_refresh()
|
||||
{
|
||||
$.get("/htdocs/lua/ajax/net_ipv4_dhcp_refresh_ajax.lua");
|
||||
}
|
||||
|
||||
// Enable/disable DHCP refresh button
|
||||
function dhcp_refresh_update(net_cfg_proto)
|
||||
{
|
||||
if (net_cfg_proto === "dhcp")
|
||||
{
|
||||
$("#b_form1_refresh_dhcp").button("enable");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#b_form1_refresh_dhcp").button("disable");
|
||||
}
|
||||
}
|
||||
|
||||
// select list onchange handlers (client-side)
|
||||
function net_config_change(field)
|
||||
{
|
||||
net_conf_entries_update(field.value);
|
||||
}
|
||||
|
||||
$("#mvlan").change(function() {
|
||||
var val = confirm("You are changing the management VLAN. If the management VLAN is not set correctly you may lose network connection.");
|
||||
|
||||
if (val == false) {
|
||||
$("#mgmt_vlan_id_sel_10").prop("selected", true);
|
||||
$("#change_mvlan").val("yes");
|
||||
}
|
||||
else {
|
||||
$("#change_mvlan").val("yes");
|
||||
$("#b_form1_submit").trigger('click');
|
||||
}
|
||||
});
|
||||
|
||||
$("#mport").change(function() {
|
||||
var val = confirm("You are changing the management port. If the management VLAN and port is not set correctly, you may lose network connection.");
|
||||
|
||||
if (val == false) {
|
||||
$("#mgmt_port_sel_none").prop("selected", true);
|
||||
$("#change_mport").val("no");
|
||||
}
|
||||
else {
|
||||
$("#change_mport").val("yes");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(document).ready( function ()
|
||||
{
|
||||
// Disable fields not related to DHCP
|
||||
if(false)
|
||||
{
|
||||
$('#ip_addr').prop('disabled', true);
|
||||
$('#subnet_mask').prop('disabled', true);
|
||||
$('#gateway_address').prop('disabled', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMsg = "";
|
||||
$('#ip_addr').change();
|
||||
$('#subnet_mask').change();
|
||||
$('#gateway_address').change();
|
||||
errorMsg = "";
|
||||
}
|
||||
|
||||
// Refresh DHCP Button Icon
|
||||
$("#b_form1_refresh_dhcp")
|
||||
.button({
|
||||
icons: { primary: "ui-icon-refresh" },
|
||||
text: false,
|
||||
disabled: true
|
||||
}).bind('click', dhcp_refresh);
|
||||
|
||||
// Update DHCP refresh button
|
||||
dhcp_refresh_update($("#protocol_type :checked").val());
|
||||
|
||||
// popup message if managment port select as none
|
||||
|
||||
$( "#mgmt_port_sel" ).change(function() {
|
||||
if($( "#mgmt_port_sel option:selected" ).val() == "none" && $( "#mgmt_vlan_id_sel option:selected" ).val() != 1){
|
||||
var retVal = confirm("The management VLAN is not the default VLAN and you are changing the management port to None. If the management VLAN and port is not set correctly, you may lose network connection.");
|
||||
if (retVal == false) {
|
||||
$("#mgmt_port_sel_none").prop("selected", true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$( "#b_form1_submit" ).click(function() {
|
||||
if($( "#mgmt_port_sel option:selected" ).val() == "none" && $( "#mgmt_vlan_id_sel option:selected" ).val() != 1){
|
||||
var retVal = confirm("The management VLAN is not the default VLAN and you are changing the management port to None. If the management VLAN and port is not set correctly, you may lose network connection.");
|
||||
if (retVal == false) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Add on reset handler
|
||||
$("#form1").bind("reset", function() {
|
||||
setTimeout(function() { // Need this delay so we read the reset values
|
||||
net_conf_entries_update($("#protocol_type :checked").val());
|
||||
}, 1);
|
||||
});
|
||||
|
||||
// specific to SNMP package
|
||||
if (false)
|
||||
{
|
||||
$('#community_name').val("");
|
||||
$('#community_name').prop('disabled', true);
|
||||
}
|
||||
$("#snmp_sel_disabled, #snmp_sel_enabled").change(function() {
|
||||
if ($(this).prop('id') === 'snmp_sel_disabled')
|
||||
{
|
||||
$('#community_name').val("");
|
||||
$('#community_name').prop('disabled', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#community_name').prop('disabled', false);
|
||||
var communityName = "public";
|
||||
if (communityName == '')
|
||||
{
|
||||
communityName = "public";
|
||||
}
|
||||
$('#community_name').val(communityName);
|
||||
}
|
||||
});
|
||||
$('#community_name').prop('disabled', false);
|
||||
});
|
||||
|
||||
-->
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" language="JavaScript">
|
||||
<!--
|
||||
$(document).ready( function()
|
||||
{
|
||||
var page_is_valid = true;
|
||||
|
||||
// format all culture-specific elements using the current locale
|
||||
culture_format(parent.culture);
|
||||
|
||||
|
||||
var myNav = navigator.userAgent.toLowerCase();
|
||||
var isIe = false;
|
||||
if (myNav.indexOf('msie') != -1)
|
||||
{
|
||||
var myVer = parseInt(myNav.split('msie')[1]);
|
||||
}
|
||||
|
||||
if ((isIe == true) && (myVer < 8)) {
|
||||
$('input[type=radio],[type=checkbox]').live('click', function () {
|
||||
this.blur();
|
||||
this.focus();
|
||||
});
|
||||
}
|
||||
|
||||
$(':input').bind('keypress', function(e) {
|
||||
var key = (window.event) ? window.event.keyCode : e.which; // IE vs. FF
|
||||
var $this = $(this);
|
||||
if ( ($this.is(':not(:button, :submit, :reset, textarea)')) ) {
|
||||
return (key != 13);
|
||||
}
|
||||
});
|
||||
|
||||
$(".fp_button").button();
|
||||
$(".fp_button_cancel").button();
|
||||
|
||||
$('form input[type="reset"]').click(function(e) {
|
||||
if( $('#sorttable1').length ){
|
||||
fp_dt_reset_handler("#sorttable1");
|
||||
}
|
||||
return jslib_form_reset(this.form);
|
||||
});
|
||||
|
||||
$(":submit,:button").click(function(e) {
|
||||
// remember which button was clicked last by storing into hidden field
|
||||
var button = $(this).attr("id");
|
||||
var form_id = $(e.target).closest("form").attr("id");
|
||||
if (form_id)
|
||||
{
|
||||
$("#b_"+form_id+"_clicked").val(button);
|
||||
}
|
||||
page_is_valid = jslib_form_validate(document.forms[0], prop);
|
||||
|
||||
return page_is_valid;
|
||||
});
|
||||
|
||||
// add a hidden field to each form to record which submit button
|
||||
// was clicked so that it gets presented in the POST data
|
||||
$("form").each(function() {
|
||||
var $this = $(this);
|
||||
var bid = "b_" + $this.attr("id") + "_clicked";
|
||||
var b_clicked = '<input type="hidden" id="' + bid + '" name="' + bid + '">';
|
||||
$(b_clicked).appendTo($this);
|
||||
});
|
||||
$(window).resize(function() {
|
||||
if(this.resizeTO) clearTimeout(this.resizeTO);
|
||||
this.resizeTO = setTimeout(function() {
|
||||
$(this).trigger('resizeEnd');
|
||||
}, 500);
|
||||
});
|
||||
$(window).bind('resizeEnd', function() {
|
||||
iframe_auto_resize();
|
||||
});
|
||||
iframe_auto_resize();
|
||||
$('form input[type="submit"]').click(function(e) {
|
||||
var form_id = $(e.target).closest("form").attr("id");
|
||||
var f_s = "b_"+form_id+"_submit";
|
||||
var f_r = "b_"+form_id+"_refresh";
|
||||
var f_click = $("#b_"+form_id+"_clicked").val();
|
||||
if (((f_click == f_s) || (f_click == f_r)) && page_is_valid)
|
||||
{
|
||||
parent.progress_modal_open();
|
||||
}
|
||||
});
|
||||
parent.progress_modal_handler(parent.ple.PAGE_LOADED);
|
||||
|
||||
check_error();
|
||||
focus_init("");
|
||||
});
|
||||
-->
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user