From 46bc6e545a17e77202aaf01ec0cd8d5a46567525 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 25 Aug 2015 08:08:24 -0300 Subject: Move main pfSense content to src/ --- src/usr/local/www/headjs.php | 186 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 src/usr/local/www/headjs.php (limited to 'src/usr/local/www/headjs.php') diff --git a/src/usr/local/www/headjs.php b/src/usr/local/www/headjs.php new file mode 100644 index 0000000..5e4148f --- /dev/null +++ b/src/usr/local/www/headjs.php @@ -0,0 +1,186 @@ +loader<\/div>\"; + jQuery('#submit').before(to_insert); + } + } + + function submit_form(e) { + // debugging helper + //alert(Form.serialize($('iform'))); + + if (jQuery('#inputerrors')) { + jQuery('#inputerrors').html('
Loading...<\/i><\/b><\/center>'); + } + + /* dsh: Introduced because pkg_edit tries to set some hidden fields + * if executing submit's onclick event. The click gets deleted + * by Ajax. Hence using onkeydown instead. + */ + if (jQuery('#submit').prop('keydown')) { + jQuery('#submit').keydown(); + jQuery('#submit').css('visibility','hidden'); + } + if (jQuery('#cancelbutton')) { + jQuery('#cancelbutton').css('visibility','hidden'); + } + jQuery('#loading').css('visibility','visible'); + // submit the form using Ajax + } + + function formSubmitted(resp) { + var responseText = resp.responseText; + + // debugging helper + // alert(responseText); + + if (responseText.indexOf('html') > 0) { + /* somehow we have been fed an html page! */ + //alert('Somehow we have been fed an html page! Forwarding to /.'); + document.location.href = '/'; + } + + eval(responseText); + } + + /* this function will be called if an HTTP error will be triggered */ + function formFailure(resp) { + showajaxmessage(resp.responseText); + if (jQuery('#submit')) { + jQuery('#submit').css('visibility','visible'); + } + if (jQuery('#cancelbutton')) { + jQuery('#cancelbutton').css('visibility','visible'); + } + if (jQuery('#loading')) { + jQuery('#loading').css('visibility','hidden'); + } + } + + function showajaxmessage(message) { + var message_html; + + if (message == '') { + NiftyCheck(); + Rounded(\"div#redbox\",\"all\",\"#FFF\",\"#990000\",\"smooth\"); + Rounded(\"td#blackbox\",\"all\",\"#FFF\",\"#000000\",\"smooth\"); + + if (jQuery('#submit')) { + jQuery('#submit').css('visibility','visible'); + } + if (jQuery('#cancelbutton')) { + jQuery('#cancelbutton').css('visibility','visible'); + } + if (jQuery('#loading')) { + jQuery('#loading').css('visibility','hidden'); + } + + return; + } + + message_html = '
'; + message_html += '
'; + message_html += '
'; + message_html += '\"exclamation\"'; + message_html += '<\/td>'; + message_html += '' + message + '<\/b><\/font><\/td>'; + + if (message.indexOf('apply') > 0) { + message_html += ''; + message_html += ''; + message_html += '<\/td>'; + } + + message_html += '<\/tr><\/table><\/div><\/td><\/table>
'; + jQuery('#inputerrors').html(message_html); + + NiftyCheck(); + Rounded(\"div#redbox\",\"all\",\"#FFF\",\"#990000\",\"smooth\"); + Rounded(\"td#blackbox\",\"all\",\"#FFF\",\"#000000\",\"smooth\"); + + if (jQuery('#submit')) { + jQuery('#submit').css('visibility','visible'); + } + if (jQuery('#cancelbutton')) { + jQuery('#cancelbutton').css('visibility','visible'); + } + if (jQuery('#loading')) { + jQuery('#loading').css('visibility','hidden'); + } + if (jQuery('#inputerrors')) { + window.scrollTo(0, 0); + } + } + "; + + return $headjs; +} + +?> -- cgit v1.1