Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  Build a Dashboard Widget
Subject:   Here is the fix!!
Date:   2005-05-07 21:01:16
From:   aaanderson
Response to: Widget does not work, I am working on a fix

After messing with the code for a while, I determine the fix. The new code section is posted at the end of this message and I am working on getting it changed in the actual text of the article.


The problem with the Widget is the way that the widget.system method in Javascript handles the path. In the pre-release versions included a certain set of default values for the path (i am unsure of the exact list), while the release version does not. This new version of the code handles the path and also insulates the values in the command via quoting to prevent any problems passing values.


Thanks for everyones patience....


Andrew


Here is the complte code listing:



<html>
<head>
<title>Dashboard Man Page</title>
<meta http-equiv="Content-Type"
content="text/html;charset=utf-8" >


<style type="text/css">
<!--
.backStyle {
position:absolute;
width:400px;
height:400px;
left:0px;
top:0px;
z-index:0;
visibility: visible;
}


.textStyle {
font-family: Lucida Grande, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
position:absolute;
width:111px;
height:22px;
z-index:1;
left: 128px;
top: 26px;
}


.inputStyle{
position:absolute;
width:123px;
height:23px;
z-index:1;
left: 246px;
top: 24px;
visibility: visible;
}


.outputStyle{
position:absolute;
width:324px;
height:400px;
z-index:1;
left: 33px;
top: 72px;
visibility: visible;
}



-->
</style>
<script type='text/javascript'>
<!--
// get man page
function getManPage()
{
if (document.getElementById('programName').value != null)
{
var commandLine =
'groff -mandoc -Tascii -P-b -P-c `/usr/bin/man -w "'
+ document.getElementById('programName').value+'"`'
+ ' | /bin/cat';
var output = widget.system(commandLine, null);
document.getElementById('outputArea').value = output.outputString;
}
}
-->
</script>


</head>


<body>
<div id="BackgroundLayer" class="backStyle">
<img src="Default.png" width="400" height="600">
<div id="TextLayer" class="textStyle">
<div align="right"> Get More Info On:</div>
</div>
</div>


<div id="InputLayer" class="inputStyle">
<input id="programName" type="text"
size="14" border="0" height="23px" width="123px"
onchange='getManPage();'>
</input>
</div>


<div id="OutputLayer" class="outputStyle">
<textarea id="outputArea" cols="42"
rows="25" readonly>
</textarea>
</div>


</body>
</html>

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Here is the fix!!
    2005-06-08 15:03:18  rayvanderver [View]

    Tried and still cannot get this to work. It shows nothing in the console and nothing on the output area.