2 % my( $formname, $fields, $action, $url_or_message, $key ) = @_;
3 % $key = '' unless defined $key;
5 % my $url_or_message_link;
6 % if ( ref($url_or_message) ) { #its a message or something
7 % $url_or_message_link =
8 % 'message='. uri_escape( $url_or_message->{'message'} )
10 % $url_or_message_link = "url=$url_or_message";
15 <% include('/elements/xmlhttp.html',
18 'subs' => [ 'start_job' ],
22 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws.js"></SCRIPT>
23 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_iframe.js"></SCRIPT>
24 <SCRIPT TYPE="text/javascript">
25 function OLiframeContent(src, width, height, name) {
26 return ('<iframe src="'+src+'" width="'+width+'" height="'+height+'"'
27 +(name?' name="'+name+'" id="'+name+'"':'')+' scrolling="auto">'
28 +'<div>[iframe not supported]</div></iframe>');
31 function <%$key%>process () {
33 //alert('<%$key%>process for form <%$formname%>');
35 if ( document.<%$formname%>.submit.disabled == false ) {
36 document.<%$formname%>.submit.disabled=true;
39 overlib( 'Submitting job to server...', WIDTH, 444, HEIGHT, 168, CAPTION, 'Please wait...', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', CLOSECLICK, MIDX, 0, MIDY, 0 );
41 var Hash = new Array();
44 for (var i = 0; i<document.<%$formname%>.elements.length; i++) {
45 field = document.<%$formname%>.elements[i];
46 if ( <% join(' || ', map { "(field.name.indexOf('$_') > -1)" } @$fields ) %>
49 if ( field.type == 'select-multiple' ) {
50 //alert('select-multiple ' + field.name);
51 for (var j=0; j < field.options.length; j++) {
52 if ( field.options[j].selected ) {
53 //alert(field.name + ' => ' + field.options[j].value);
54 Hash[x++] = field.name;
55 Hash[x++] = field.options[j].value;
58 } else if ( ( field.type != 'radio' && field.type != 'checkbox' )
59 || ( ( field.type == 'radio' || field.type == 'checkbox' )
60 && document.<%$formname%>.elements[i].checked
64 Hash[x++] = field.name;
65 Hash[x++] = field.value;
71 // jsrsExecute( '<% $action %>', <%$key%>myCallback, 'start_job', Hash );
73 //alert('start_job( ' + Hash + ', <%$key%>myCallback )' );
74 //alert('start_job()' );
75 <%$key%>start_job( Hash, <%$key%>myCallback );
79 function <%$key%>myCallback( jobnum ) {
81 overlib( OLiframeContent('<%$p%>elements/progress-popup.html?jobnum=' + jobnum + ';<%$url_or_message_link%>;formname=<%$formname%>' , 444, 168, 'progress_popup'), CAPTION, 'Please wait...', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', CLOSECLICK, MIDX, 0, MIDY, 0 );