Author: jfthomps
Date: Fri Mar  2 19:44:11 2012
New Revision: 1296409

URL: http://svn.apache.org/viewvc?rev=1296409&view=rev
Log:
VCL-444
time delay the display of the Get RDP File button to allow vcld to grant access

requests.js - added showRDPbutton

requests.php: modified connectRequest - added div before Get RDP File button 
for showing a counter; enclosed Get RDP File button in a div that starts out 
hidden; showRDPbutton gets called on page load to show the Get RDP File button 
after 5 seconds and to show a count down to that

utils.php: modified getDojoHTML - added sections for connectRequest

Modified:
    incubator/vcl/trunk/web/.ht-inc/requests.php
    incubator/vcl/trunk/web/.ht-inc/utils.php
    incubator/vcl/trunk/web/js/requests.js

Modified: incubator/vcl/trunk/web/.ht-inc/requests.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/requests.php?rev=1296409&r1=1296408&r2=1296409&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/requests.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/requests.php Fri Mar  2 19:44:11 2012
@@ -3029,6 +3029,8 @@ function connectRequest() {
                                     $res['connectport']);
                        print preg_replace($froms, $tos, 
$method['connecttext']);
                        if($method['description'] == 'Remote Desktop') {
+                               print "<div id=\"counterdiv\"></div>\n";
+                               print "<div id=\"connectdiv\" 
class=\"hidden\">\n";
                                print "<FORM action=\"" . BASEURL . SCRIPT . 
"\" method=post>\n";
                                $cdata = array('requestid' => $requestid,
                                               'resid' => 
$res['reservationid']);
@@ -3037,6 +3039,7 @@ function connectRequest() {
                                print "<INPUT type=hidden name=continuation 
value=\"$cont\">\n";
                                print "<INPUT type=submit value=\"Get RDP 
File\">\n";
                                print "</FORM>\n";
+                               print "</div>\n";
                        }
                }
                if($cluster)

Modified: incubator/vcl/trunk/web/.ht-inc/utils.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/utils.php?rev=1296409&r1=1296408&r2=1296409&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/utils.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/utils.php Fri Mar  2 19:44:11 2012
@@ -10282,6 +10282,9 @@ function getDojoHTML($refresh) {
                                              'dojox.layout.FloatingPane',
                                              'dijit.form.FilteringSelect');
                        break;
+               case 'connectRequest':
+                       $dojoRequires = array('dojo.parser');
+                       break;
                case 'viewRequestInfo':
                        $dojoRequires = array('dojo.parser',
                                              'dijit.Dialog',
@@ -10485,6 +10488,16 @@ function getDojoHTML($refresh) {
        if(empty($dojoRequires))
                return '';
        switch($mode) {
+               case "connectRequest":
+                       $rt .= "<script type=\"text/javascript\" 
src=\"dojo/dojo/dojo.js\"\n";
+                       $rt .= "   djConfig=\"parseOnLoad: true\">\n";
+                       $rt .= "</script>\n";
+                       $rt .= "<script type=\"text/javascript\" 
src=\"js/requests.js\"></script>\n";
+                       $rt .= "<script type=\"text/javascript\">\n";
+                       $rt .= "   dojo.addOnLoad(showRDPbutton);\n";
+                       $rt .= "</script>\n";
+                       return $rt;
+
                case "viewRequests":
                        $rt .= "<style type=\"text/css\">\n";
                        $rt .= "   @import 
\"themes/$skin/css/dojo/$skin.css\";\n";

Modified: incubator/vcl/trunk/web/js/requests.js
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/js/requests.js?rev=1296409&r1=1296408&r2=1296409&view=diff
==============================================================================
--- incubator/vcl/trunk/web/js/requests.js (original)
+++ incubator/vcl/trunk/web/js/requests.js Fri Mar  2 19:44:11 2012
@@ -656,3 +656,32 @@ function submitRebReinstReservation() {
        dijit.byId('rebootreinstalldlg').hide();
        RPCwrapper(data, generalReqCB);
 }
+
+function showRDPbutton() {
+       if(! dojo.byId('counterdiv') || ! dojo.byId('connectdiv'))
+               return;
+       var timeInterval = 5;
+       if(typeof timeInterval === 'undefined' || parseInt(timeInterval) <= 0) {
+               timeInterval = 1
+       }
+       if(timeInterval == 1)
+               dojo.byId('counterdiv').innerHTML = " Ready to connect in " + 
timeInterval + " second";
+       else
+               dojo.byId('counterdiv').innerHTML = " Ready to connect in " + 
timeInterval + " seconds";
+       var si = setInterval(function() {
+               if(timeInterval === 0) {
+                       clearInterval(si);
+               } else {
+                       timeInterval--;
+                       if(timeInterval !== 0) {
+                               if(timeInterval == 1)
+                                       dojo.byId('counterdiv').innerHTML = " 
Ready to connect in " + timeInterval + " second";
+                               else
+                                       dojo.byId('counterdiv').innerHTML = " 
Ready to connect in " + timeInterval + " seconds";
+                       } else {
+                               dojo.addClass('counterdiv', 'hidden');
+                               dojo.removeClass('connectdiv', 'hidden');
+                       }
+               }
+       }, 1000);
+}


Reply via email to