Author: tyrell
Date: Sat Jan 26 18:47:44 2008
New Revision: 12974

Log:

Adding an optional 'focusable element' to the dialog constructor. This element 
will get focus once the dialog is loaded in the ui.

Modified:
   trunk/mashup/java/modules/www/css/mashup-main.css
   trunk/mashup/java/modules/www/js/mashup-utils.js

Modified: trunk/mashup/java/modules/www/css/mashup-main.css
==============================================================================
--- trunk/mashup/java/modules/www/css/mashup-main.css   (original)
+++ trunk/mashup/java/modules/www/css/mashup-main.css   Sat Jan 26 18:47:44 2008
@@ -107,7 +107,7 @@
     font-weight: bold;
        text-align:left;
     background-image: url( ../images/w_top_bg.gif );
-
+    padding-top: 4px;
 }
 
 #d_Body {

Modified: trunk/mashup/java/modules/www/js/mashup-utils.js
==============================================================================
--- trunk/mashup/java/modules/www/js/mashup-utils.js    (original)
+++ trunk/mashup/java/modules/www/js/mashup-utils.js    Sat Jan 26 18:47:44 2008
@@ -158,7 +158,7 @@
     YAHOO.util.Event.onContentReady('doc3', function() {
         // Instantiate the Dialog
         WSO2.MashupUtils.dialog("Share " + serviceName +
-                                " with others", strFrmService, 500, 100);
+                                " with others", strFrmService, 500, 100, 
'txtDestUsername');
     });
 };
 
@@ -235,9 +235,9 @@
     parent.setAttribute("id", "MashupCreationDialog");
 
     var lblMashupName = document.createElement("label");
-       var txtStrong = document.createElement("strong");
+    var txtStrong = document.createElement("strong");
     txtStrong.appendChild(document.createTextNode("Enter the name for your new 
Mashup: "));
-       lblMashupName.appendChild(txtStrong);
+    lblMashupName.appendChild(txtStrong);
     parent.appendChild(lblMashupName);
 
     parent.appendChild(document.createElement("br"));
@@ -268,7 +268,7 @@
 
     YAHOO.util.Event.onContentReady('doc3', function() {
         // Instantiate the Dialog
-        WSO2.MashupUtils.dialog("Create a new mashup", parent.innerHTML, 100, 
100);
+        WSO2.MashupUtils.dialog("Create a new mashup", parent.innerHTML, 100, 
100, 'txtMashupName');
     });
 };
 
@@ -518,16 +518,17 @@
 
     //Creating the form content
     var downloadForm = '<form method="post" style="display:inline;" 
id="downloadForm" name="downloadForm" 
action="services/ServiceSharingHelper/downloadService">' +
-                       '<input size="10" id="txtServiceName" 
name="serviceName" type="hidden" value="'+ serviceName + '">' +
+                       '<input size="10" id="txtServiceName" 
name="serviceName" type="hidden" value="' +
+                       serviceName + '">' +
                        '<table width="100%"  border="0" cellspacing="0" 
cellpadding="0">' +
-                         '<tr><td nowrap height="25"><b>Your Mashup Server 
User Name: </b></td><td><input size="40" name="username" 
type="text"></td></tr>' +
-                         '<tr><td nowrap height="25"><b>Your Mashup Server 
Password: </b></td><td><input size="40" name="password" 
type="password"></td></tr>' +
-                         '<tr><td nowrap height="25"><b>Your Mashup Server 
Address: </b></td><td><input size="40" name="remoteServer" type="text" 
value="https://localhost:7443/";></td></tr>' +
-                         '<tr><td height="30" valign="bottom"><input 
type="button" value="Download" 
onclick="WSO2.MashupUtils.makeMashupDownloadRequest();"/></td><td>&nbsp;</td></tr>'
 +
+                       '<tr><td nowrap height="25"><b>Your Mashup Server User 
Name: </b></td><td><input size="40" name="username" id="txtUserName" 
type="text"></td></tr>' +
+                       '<tr><td nowrap height="25"><b>Your Mashup Server 
Password: </b></td><td><input size="40" name="password" 
type="password"></td></tr>' +
+                       '<tr><td nowrap height="25"><b>Your Mashup Server 
Address: </b></td><td><input size="40" name="remoteServer" type="text" 
value="https://localhost:7443/";></td></tr>' +
+                       '<tr><td height="30" valign="bottom"><input 
type="button" value="Download" 
onclick="WSO2.MashupUtils.makeMashupDownloadRequest();"/></td><td>&nbsp;</td></tr>'
 +
                        '</table>' +
                        '</form>';
 
-    WSO2.MashupUtils.dialog("Download " + serviceName, downloadForm, 500, 100);
+    WSO2.MashupUtils.dialog("Download " + serviceName, downloadForm, 500, 
100,'txtUserName');
 
 };
 
@@ -540,7 +541,7 @@
     function handleFailure(o) {
         var responseText = o.responseText.split("at")[0];
         WSO2.MashupUtils.dialog("Error", "Failed to download the 
mashup.<br><br>" +
-                                        responseText , 400, 100);
+                                         responseText, 400, 100);
     }
 
     var callback =
@@ -622,13 +623,13 @@
 
 WSO2.MashupUtils.createCookie = function(name, value, days) {
     var expires = "";
-    
+
     if (days) {
         var date = new Date();
         date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
         expires = "; expires=" + date.toGMTString();
     }
-    
+
     document.cookie = name + "=" + value + expires + "; path=/";
 };
 
@@ -645,7 +646,7 @@
     wso2.mashup.services.activationOfService(serviceName, serviceState, 
callback, params);
 };
 
-WSO2.MashupUtils.dialog = function(strTitle, strBody, width, height) {
+WSO2.MashupUtils.dialog = function(strTitle, strBody, width, height, 
elementToFocusAfterLoading) {
     if (document.getElementById('lyrDialog') == null) {
         var pageBody = document.getElementsByTagName('BODY')[0];
 
@@ -690,6 +691,12 @@
 
         pageBody.appendChild(dialogContent);
 
+        YAHOO.util.Event.onContentReady('doc3', function() {
+            if (elementToFocusAfterLoading != null) {
+                document.getElementById(elementToFocusAfterLoading).focus();
+            }
+        });
+
     } else {
         document.getElementById('lyrDialog').style.display = "block";
     }

_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to