jump to navigation

Primavera Gadgets for Vista December 5, 2006

Posted by Patricio in Primavera, Software Engineering.
trackback

In order to create a Vista Gadget, you need:

  1. A “manifest” file named Gadget.xml that contains all the settings for your gadget.
  2. An HTML file with your scripting code.

The manifest file contains the gadget configuration and its format is something like this:

<?xml version=”1.0″ encoding=”utf-8″ ?>
<gadget>
<name>Primavera Gadget</name>
<author>Patricio Fernandes</author>
<description>Primavera BSS Gadget</description>
<icons>
<icon>MyGadgetIcon.jpg</icon>
</icons>
<version value=”1.0.0.0″ MinPlatformVersion=”0.1″></version>
<sidebar>
<type>html</type>
<permissions>full</permissions>
<code>PrimaveraGadget.html</code>
<website>www.primaverabss.com</website>
</sidebar>
</gadget>

here PrimaveraGadget.html is the HTML file with the scripting code.

This HTML file is nothing more than a web page that uses scripting (VBScript or Jscript) to retrieve data from a Primavera database (SQL Server) and display them. So, you can write your own HTML file that will contain something like this:

<html>
<head>
<title>My First Gadget</title>
<style>
body{width:120;height:160}
</style>
</head>

<script language=”VBScript”>
Set myConn = CreateObject(“ADODB.Connection”)
Set myRecordset = CreateObject(“ADODB.Recordset” )
myConn.Open = DB_CONNECTION_STRING
myRecordset.Open mySQLCmdText, myConn
myRecordset.MoveFirst
WHILE NOT myRecordset.EOF
Response.Write(myRecordset(“myField”) & “<br/>”)
myRecordset.MoveNext
WEND
myRecordset.Close
Set myRecordset = Nothing

myConn.Close
Set myConn = Nothing

</script>
</html>

where DB_CONNECTION_STRING is the connection string that connects to Primavera database and mySQLCmdText is the query that you want to execute (for example a query to retrieve the last 10 Orders).

To install the Gadget on your sidebar, open the Gadgets folder under %userprofile%\appdata\local\microsoft\windows sidebar\gadgets, then create a new folder for your newly created Gadget (called for example PrimaveraGadget.gadget). Remember that the .gadget extension is a must!!

Now place your HTML file and your gadget.xml file into this folder and restart the Windows Sidebar. If you try to add a new gadget on the sidebar, your newly created gadget should appear in the gadget picker dialog box.

Advertisements

Comments»

1. Jose Dionisio - January 2, 2007

O que faz ou pode fazer este gadget afinal?

2. Patricio - January 2, 2007

Este pequeno exemplo que fiz para testar os gadgets apresenta uma lista de itens com uma imagem de fundo, muito simples…

Tenho de colocar uma imagem para ficar mais claro.

3. Patricio - January 2, 2007

Uma utilização possível dos gadgets poderia ser a apresentação de alertas, indicadores (algo parecido com as cotações na bolsa), etc..
São tipicamente pequenos componentes.

Está também muito em voga a utilização dos RSS Feeds para disponibilizar informação… (tenho que experimentar isto :-))

4. Cool Gadgets - April 16, 2007

i’ll try that if i have the time…its seemmed good…

5. Jerome - March 26, 2008

This is cool. I didn’t gadget can link with database server. This article has just given me fresh ideas. Thank’s


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: