1 <% include('/elements/xmlhttp.html',
4 'subs' => [ 'start_job' ],
9 <% include('/elements/init_overlib.html') %>
11 <SCRIPT TYPE="text/javascript">
13 function <%$key%>process () {
15 //alert('<%$key%>process for form <%$formname%>');
17 if ( document.<%$formname%>.submit.disabled == false ) {
18 document.<%$formname%>.submit.disabled=true;
21 overlib( 'Submitting job to server...', WIDTH, 444, HEIGHT, 168, CAPTION, 'Please wait...', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', CLOSECLICK, MIDX, 0, MIDY, 0 );
23 var Hash = new Array();
26 for (var i = 0; i<document.<%$formname%>.elements.length; i++) {
27 field = document.<%$formname%>.elements[i];
28 if ( <% join(' || ', map { "(field.name.indexOf('$_') > -1)" } @$fields ) %>
31 if ( field.type == 'select-multiple' ) {
32 //alert('select-multiple ' + field.name);
33 for (var j=0; j < field.options.length; j++) {
34 if ( field.options[j].selected ) {
35 //alert(field.name + ' => ' + field.options[j].value);
36 Hash[x++] = field.name;
37 Hash[x++] = field.options[j].value;
40 } else if ( ( field.type != 'radio' && field.type != 'checkbox' )
41 || ( ( field.type == 'radio' || field.type == 'checkbox' )
42 && document.<%$formname%>.elements[i].checked
46 Hash[x++] = field.name;
47 Hash[x++] = field.value;
53 // jsrsExecute( '<% $action %>', <%$key%>myCallback, 'start_job', Hash );
55 //alert('start_job( ' + Hash + ', <%$key%>myCallback )' );
56 //alert('start_job()' );
57 <%$key%>start_job( Hash, <%$key%>myCallback );
61 function <%$key%>myCallback( jobnum ) {
63 overlib( OLiframeContent('<%$p%>elements/progress-popup.html?jobnum=' + jobnum + ';<%$url_or_message_link%>;formname=<%$formname%>' , 444, 168, '<% $popup_name %>'), CAPTION, 'Please wait...', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', CLOSECLICK, MIDX, 0, MIDY, 0 );
71 my( $formname, $fields, $action, $url_or_message, $key ) = @_;
72 $key = '' unless defined $key;
74 my $url_or_message_link;
75 if ( ref($url_or_message) ) { #its a message or something
76 $url_or_message_link = 'message='. uri_escape( $url_or_message->{'message'} );
77 $url_or_message_link .= ';url='. uri_escape( $url_or_message->{'url'} )
78 if $url_or_message->{'url'};
80 $url_or_message_link = "url=$url_or_message";
83 #stupid safari is caching the "location" of popup iframs, and submitting them
84 #instead of displaying them. this should prevent that.
85 my $popup_name = 'popup-'.time. "-$$-". rand() * 2**32;