[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qexo-general] application example
From: |
Marco Vezzoli |
Subject: |
[Qexo-general] application example |
Date: |
Thu, 11 Jul 2002 15:47:51 +0200 |
Here is a simple prototype I wrote for my own use; it draws simple gantt
chart like PyGantt.
It can be added to the documentation as an example and distributed with
the kawa implementation.
If I'll have more time I would like to turn it into an effective web
application.
Any contributions are welcome.
Installation & use:
-Put both files in the same directory
-type 'kawa --xquery gantt.xqy >gantt.html' or equivalent
-type 'netscape gantt.html'
-play with project.xml and goto the second step
My todo list:
-servlet version
-color setup file
bye
Marco
--
(--cafe babe--)
Marco Vezzoli address@hidden
CR&D Intranet Developement STMicroelectronics
tel. +39 039 603 6852 fax. +39 039 603 5055
<project name="porting">
<task name="t84_transfer" >
<task name="code" >
<task name="upload" status="done" begin="20" end="28">
caricamento e verifica del codice di parsing nel cluster
<people name="Marco Vezzoli"/>
<people name="Giancarlo Dal Brun"/>
</task>
<task name="analysis" status="wip" begin="28" end="31"/>
</task>
<task name="database" >
<task name="tables" status="wip" begin="26" end="29">
<people name="Marco Vezzoli"/>
<people name="Oliver Donzelli"/>
</task>
<task name="scripts" >
<people name="Marco Vezzoli"/>
<people name="Oliver Donzelli"/>
</task>
<task name="snapshot" >
<people name="Marco Vezzoli"/>
<people name="Oliver Donzelli"/>
</task>
<task name="ha" >
<people name="Marco Vezzoli"/>
<people name="Enrico Carniti"/>
<people name="Giancarlo Dal Brun"/>
<people name="Laura Maggioni"/>
</task>
</task>
<task name="data" >
<task name="scripts" />
<task name="snapshot" status="done" begin="20" end="28">
<people name="Marco Vezzoli"/>
</task>
</task>
</task>
</project>
define function result-table($doc){
let $begins := (begin($doc),for $task in $doc//task return begin($task)) ,
$ends := (end($doc) ,for $task in $doc//task return end($task))
return
let $min := min($begins),
$max := max($ends) return
<TABLE>
{header($min,$max)}{extract-task($doc/project,0,$min,$max)}
</TABLE>
}
define function header($min,$max){
<TR>
<TH colspan="2">tasks</TH>
{
for $date in ($min to $max) return
<TH>{$date}</TH>
}
</TR>
}
define function task-line($t,$pmin){
let $begins := (begin($t),for $task in $t//task return begin($task)) ,
$ends := (end($t) ,for $task in $t//task return end($task))
return
let $min := min($begins),
$max := max($ends) return
let $len := $max - $min , $start := $min - $pmin return
if ($len > 0) then
( if ($start > 0) then colorbar("FFFFFF",$start,"") else "",
colorbar(status-color($t),$len + 1 ,"X"))
else <TD></TD>
}
define function status-color($task){
if ($task/@status) then
if ($task/@status = "done") then "22FFAA" else
if ($task/@status = "wip") then "FFAA22" else
"AA22FF"
else "000000"
}
define function extract-task($doc,$indentation,$pmin){
for $t in $doc/task return
(<TR>
<TD><FONT COLOR="FFFFFF">{for $i in (0 to $indentation) return
"__"}</FONT>+{string($t/@name)}</TD><TD>
</TD>{
task-line($t,$pmin)
}
</TR>,extract-task($t,$indentation+1,$pmin))
}
define function begin($task){
if ($task/@begin)
then number($task/@begin)
else 999
}
define function end($task){
if ($task/@end)
then number($task/@end)
else 0
}
define function colorbar($color,$len,$message){
<TD COLSPAN="{$len}" BGCOLOR="{$color}">{$message}</TD>
}
define function linebar($len){
<TD COLSPAN="{$len}"><HR /></TD>
}
let $doc := document("project.xml") return
<HTML>
<HEAD>
<TITLE>Gantt Chart</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<H1>Gantt Chart {string($doc/project/@name)}</H1>
{result-table($doc)}
</BODY>
</HTML>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qexo-general] application example,
Marco Vezzoli <=