My Google Gadget goes partially out of the screen - google-gadget

When i add this as Gadget to google calendar ,it partially goes out of the screen...How should i correct such that the gadget will appear with in the screen...
Here is a code where it creates a gadget asking for username and password and login button..
I just want to know the procedure too make the gadget to appear with in the screen
enter code here
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="ABC Google Calendar Gadget" width="180" author="abc" author_email="abcgmail.com" description="My First Test">
<Require feature="dynamic-height"/>
<Require feature="google.calendar-0.5"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<html style="overflow: hidden;">
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<style>
//.login {
// display: block;
//}
//.event {
// display: none;
/}
</style>
</head>
<body class="loc-en ff ff3">
<script>
var _message = 'This is My first Gadget!';
function validateForm(){
alert("Hello");
$('.login').hide();
$('.event').show();
}
function createEventfun(){
alert("create event");
var eventData = {
title: 'NewYear',
details: 'Hi all',
location: 'My room',
allDay: true,
startTime: {year: 2013, month: 04, date: 21},
endTime: {year: 2013, month: 04, date: 22},
attendees: [
{email: 'nirupama.ninusah#gmail.com'}
],
rrule: 'RRULE:FREQ=YEARLY'
};
google.calendar.composeEvent(eventData);
}
function load()
{
alert("Page is loaded");
}
function changeWidth(){
var e1 = document.getElementById("gadgetcell");
e1.style.width = 180;
alert("Page is loaded and width of gadgetcell is modified to 180");
}
</script>
<div class="login" align="left">
<table border="1" height="200" width="100%">
<tr>
<td>
<image src="http://abc.com/Portals/78096/images/abc_logo.jpg" height="60" width="90"/>
</td>
</tr>
<tr>
<td align="left">
<table border="0">
<tr>
<td>Userid</td>
<td><input type="text" name="userid" size=10/><br></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" size=10/><br></td>
</tr>
<tr>
<td>VidyoURL</td>
<td><input type="text" name="url" size=10/><br></td>
</tr>
<tr>
<td><button onClick="validateForm()" style="background-color:red;color:white">LOGIN</button></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="event" style="width: 180px;">
<table border="1">
<tr>
<td>
<image src="http://abc.com/Portals/78096/image/abc_logo.jpg" height="60" width="90"/>
</td>
</tr>
<tr>
<td align="center">
<table border="0" height="200" width="100%">
<tr>
<span>User Successfully Aunthenticated</span>
</tr>
<tr>
<button onclick="createEventfun()" style="background-color:red;color:white">CREATE VIDYO EVENT</button>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
]]></Content>
</Module>

Look at Managing Gadget Height:
- A <Require feature="dynamic-height"/> tag (under <ModulePrefs>) to tell the
gadget to load the dynamic-height library.
- A call to the JavaScript function gadgets.window.adjustHeight() whenever there
is a change in content, or another event occurs that requires the gadget to
resize itself.
I added this script to all views and it works:
<script type="text/javascript" charset="utf-8">
function resize(){
gadgets.window.adjustHeight();
}
window.onload=resize;
</script>
Don't forget about "Required feature" tag

Related

Automating using Selenium

I am trying to find the text from the Select Elements "[New List]". The HTML code behind this is :
<div id="pageBody">
<div class="grid">
<div class="col_12 bgColor column">
<form method="POST" action="pickListEdit.cfm" name="formMain" id="formMain">
<input type="hidden" id="usrAction" name="usrAction" value="NONE"/>
<input type="hidden" id="listtype" name="listtype" value="ACCTS"/>
<input type="hidden" id="listmodified" name="listmodified" value="0"/>
<table cellpadding="0" cellspacing="0" border="0" width="620">
<tbody>
<tr class="alt first last">
<td>
<table cellpadding="0" cellspacing="0" border="0" width="360">
<tbody>
<tr class="alt first">
<td width="150" align="right" class="critH2">
<td height="1" align="left">
<select name="listkey" size="1" onchange="formSubmit('GET');"class="selectfont">
<option value="0">[New List]</option>
</select>
</td>
</tr>
<tr class="alt last">
</tbody>
</table>
</td>
<td width="10"/>
<td width="10"/>
<td valign="top">
</tr>
</tbody>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="600">
</form>
</div>
</div>
</div>
</div>
</body>
The C# code that I am using is :
var AccPic = Driver.Instance.FindElement(By.ClassName("selectfont"));
var selectelement = new SelectElement(AccPic);
selectelement.SelectByText(AP);
The problem is it is unable to find the field name. What I need to do is find the element [New List] and select it. Can someone please help.
Assuming it's the only option tag on the page:
var newList = Driver.Instance.FindElement(By.TagName("option"));
var selectedElement = new SelectElement(newlist);

Any Dijit component is rendered as TextField

Please find my code which intents to develop a Form. Help me in understanding why the CheckBox and NumberSpinner are rendered as TextFields.
I have imported all the required classes and dojo config attribute is configured properly
<%# taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%# taglib prefix="fmt" uri=`enter code here`"http://java.sun.com/jstl/fmt" %>
<%#include file="/webclient/admin/jspf/NotificationOperations.jspf" %>
<!-- load dojo and provide config via data attribute -->
<script type="text/javascript" src="/webclient/map/js/dojo/dojo.js" data-dojo-config="parseOnLoad: true"></script>
<script>
require([
"dojo/parser",
"dijit/form/CheckBox",
"dijit/form/NumberSpinner",
"dojo/domReady!"
], function(parser){
parser.parse();
});
</script>
<%#include file="/webclient/common/jspf/jsUtility.jspf" %>
<html>
<head>
<body class="claro">
<style>
#import "/webclient/common/js/dojo/dgrid/css/skins/claro.css";
h2 {
margin: 12px;
}
.heading {
font-weight: bold;
padding-bottom: 0.25em;
}
.ui-widget{
margin: 10px;
}
</style>
<table width="100%" height="100%">
<tr><td>
<div id="DomainMapContainer" >
<tr class="spacer"><td> </td></tr>
<tr><td>
<form id="addProfile" data-dojo-type="dijit/form/Form" data-dojo-props='encType:"multipart/form-data", action:"/prov/createRFC2544TestProfile.do?action=createRFC2544TestProfile", method:"POST", target:"formSubmitIframe"'>
<table>
<tr>
<td><label for="profileName">Profile Name</label></td>
<td>
<input data-dojo-type="dijit/form/TextBox" data-dojo-props='id:"profileName", name:"profileName", required:"true"'/>
</td>
</tr>
<tr>
<td><label for="comments">Comments</label></td>
<td>
<input data-dojo-type="dijit/form/TextArea" data-dojo-props='id:"comments", name:"comments", rows:"5", cols:"40"'/>
</td>
</tr>
<tr>
<td><label for="frameSize">Frame Size</label></td>
<td>
<table>
<tr>
<td><label for="cb_1"><input data-dojo-type="dijit/form/CheckBox" id="cb_1" name="cb_1" value="64" checked/> 64</label></td>
<td><label for="cb_2"><input data-dojo-type="dijit/form/CheckBox" id="cb_2" name="cb_2" value="128"/> 128</label></td>
</table>
</td>
</tr>
</table>
<fieldset>
<legend><label> Throughput Test</label></legend>
<table>
<tr>
<td><label for="tTestDuration">Test Duration</label></td>
<td><input data-dojo-type="dijit/form/NumberSpinner" id="tTestDuration" value="60" data-dojo-props="smallDelta:1, constraints:{min:1,max:600,places:0}" name="tTestDuration"/>(Seconds)</td>
</tr>
<tr>
<td><label for="tTestMinFrameRate">Minimum Frame Rate</label></td>
<td><input data-dojo-type="dijit/form/NumberSpinner" id="tTestMinFrameRate" value="0" data-dojo-props="smallDelta:1, constraints:{min:1,max:10000,places:0}" name="tTestMinFrameRate"/>(Mbps)</td>
</tr>
<tr>
<td><label for="tTestMaxFrameRate">Maximum Frame Rate</label></td>
<td><input data-dojo-type="dijit/form/NumberSpinner" id="tTestMaxFrameRate" value="100" data-dojo-props="smallDelta:1, constraints:{min:1,max:10000,places:0}" name="tTestMaxFrameRate"/>(Mbps)</td>
</tr>
<tr>
<td><label for="tTestStepSize">Step Size</label></td>
<td><input data-dojo-type="dijit/form/NumberSpinner" id="tTestStepSize" value="5" data-dojo-props="smallDelta:1, constraints:{min:1,max:100,places:0}" name="tTestStepSize"/>(Mbps)</td>
</tr>
<tr>
<td><label for="tTestAcceptableLoss">Step Size</label></td>
<td><input data-dojo-type="dijit/form/NumberSpinner" id="tTestAcceptableLoss" value="0" data-dojo-props="smallDelta:0.1, constraints:{min:0,max:10,places:0}" name="tTestAcceptableLoss"/>(%)</td>
</tr>
</table>
</fieldset>
</form>
</td></tr>
</div>
</td></tr>
</table>
</body>
</head>
</html>
I'm seeing a few things here, first of all you're missing a closing </tr> tag when you close the "frame size" table. I suppose that it won't cause errors, but you can never be too sure.
You're also closing your </head> tag at the bottom of the page. You should close it before the <body> starts.
Then the real problem is that your widgets are not working because there are errors while parsing your HTML. The cause of the error is the "comments" text area. The correct module name you should use is dijit/form/Textarea, so the "a" of area should be in lowercase.
Besides that, you should also add the dijit/form/Textarea module to your list of modules (in your require() block).
If you did all that it should work, as you can see in this fiddle: http://jsfiddle.net/9U5AB/

Auto login form with Visual Basic

I need make an auto login form application with Visual Basic 10.0 for the following code:
</script>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<table cellpadding="0" cellspacing="0" border="0" height="100%">
<tr>
<td rowspan="10" width="50%" height="100%" background="images/bg1222.jpg" style="background-position:right top; background-repeat:repeat-y"></td>
<td rowspan="10" width="1" bgcolor="#000000"></td>
<td valign="top">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td width=100%>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="778" height="153">
<param name="movie" value="images/hed2.swf">
<param name="quality" value="high">
<embed src="images/hed2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="778" height="153"></embed>
</object>
</td>
</tr>
</table>
</td>
<!--<td rowspan="10" width="0" bgcolor="#000000"></td>-->
<td rowspan="10" width="50%" height="100%" background="images/bg1223.jpg" style="background-position:left top; background-repeat:repeat-y"></td>
</tr>
<tr>
<td width="780" height="30" align="center" valign="bottom" background="images/footer.gif"></td>
</tr>
<tr>
<td height="583" valign="top" style="background-repeat:repeat-y;" >
<br><br><br><br><br><br><br>
<center>
<form action="/cse/login/login1_check.jsp" name="first" method="post">
<table width="25%" height="90" border="0" class='formtable1'>
<caption align="top">
<strong> User Login </strong>
<br>
</caption>
<tr>
</tr>
<tr>
<td width="24%" height="32">
<div align="right"> User ID: </div>
</td>
<td width="76%">
<label>
<input name="uid" type="text" >
</label>
</td>
</tr>
<tr>
<td height="43">
<div align="right"> Password: </div>
</td>
<td>
<label>
<input name="password" type="password" >
</label>
</td>
</tr>
</table>
<input type="submit" name="sub" value="Login">
</form>
</center>`enter code here`
Say username is user and password is pass.
It should be auto filled and clicked in the submit button. What would the code be for Visual Basic 10.0?
Try this:
If Not String.IsNullOrEmpty(My.Settings.Username) And Not String.IsNullOrEmpty(My.Settings.Password) Then
TxtUsername.Text = My.Settings.Username
TxtPassword.Text = My.Settings.Password
End If
You first need to take all the elements that you want to interact to. If they have an ID, you don't need to search, simply get the element with:
Dim elem As HtmlElement = Webbrowser1.Document.GetElementById("myId")
If not, you need to search for yours, for example:
Dim inputs As New List(Of HtmlElement)(a.Document.GetElementsByTagName("input"))
For Each elem As HtmlElement In inputs
If elem.GetAttribute("name").Equals("uid") Then
'...
End If
Next
To set a value of a input:
elem.SetAttributte("value", passwordVar)
To click a clickable element (such a submit input):
elem.InvokeMember("submit")
Or:
elem.InvokeMember("click")

Input field is filled, but content is not saved using Selenium IDE

Using Selenium IDE, I'm able to fill an input field (using "type" command), but when I "save" the value, this value is lost. Doing the same by hand, everything works fine.
Any hint to solve this issue? I've already tried using typeKeys command.
The code inside the target page is:
<!-- language-all: lang-html -->
<div id="editDiv" class="editDialog">
<table cellspacing="0" width="100%">
<tbody>
<tr>
<td width="25%" style="">period</td>
<td align="right" width="25%" style="padding: 6px;">
<input id="period" type="text" onblur="changeValue(this.id, this.value, undefined)">
<br>
<label>da 0 a 9</label>
</td>
</tr>
</tbody>
</table>
<table cellspacing="0" width="100%">
<input type="button" value="Save" onclick="applyChanges()">
<input type="button" value="Cancel" onclick="removeEditDialog(false)">
</div>
To help more on this issue:
function changeValue(id, value, paramPos) {
var par = tempGlobalParams[id] ? tempGlobalParams[id] : tempGlobalPaintingsParams[paramPos][id];
if(checkRules(id, value, paramPos)){
par.custom = value;
}

How do I insert value into labels using dojo

I am trying to dynamically insert the values in the labels which I will hide from sighted users but will be read by screen readers for visually impaired users that are displayed in the columns. How can I accomplish this using dojo?
<html>
<head>
<title>Dojo Labels</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/dojo/1.3.2/dojo/dojo.xd.js"></script>
<style type="text/css">
.style1
{
width: 154px;
}
</style>
</head>
<body>
<table style="width: 51%; height: 204px;">
<tr>
<td class="style1">
<input id="Checkbox1" type="checkbox" />
<label for="Checkbox1"></label>
</td>
<td>
John
</td>
<td>
Doe
</td>
</tr>
<tr>
<td class="style1">
<input id="Checkbox2" type="checkbox" />
<label for="Checkbox2"></label>
</td>
<td>
Jane
</td>
<td>
Doe
</td>
</tr>
<tr>
<td class="style1">
<input id="Checkbox3" type="checkbox" />
<label for="Checkbox3"></label>
</td>
<td>
John
</td>
<td>
Smith
</td>
</tr>
</table>
</body>
</html>
If you just need to dynamically change label then you can try this:
dojo.query("label[for=Checkbox1]")[0].innerHTML = "text";
But if you need logic to detect if it is a screen reader or a browser then I cannot help. But you probably could always render label with text just add style display:none;
<label for="Checkbox2" style="display:none;">text</label>
not exactly sure if I understand exactly what you are doing, but dojo provides a method that allows you to modify a DOM node's attribute values. It's called dojo.attr()
Maybe this one will help.
To get label content : dijit.byId("btnButtonName").get("label")=="SomeName");
To set label content : dijit.byId("btnButtonName").set("label", "SomeName");