Index: server/teapot_index
==================================================================
--- server/teapot_index
+++ server/teapot_index
@@ -96,28 +96,10 @@
}
return [array get pkginfo]
}
-proc generate_tpm {entlist} {
- set pkgs [list]
- foreach part $entlist {
- set pkginfo [list]
- foreach enttype $part {
- set pkg [lindex $enttype 0]
- lappend pkginfo $pkg
- }
- lappend pkgs $pkginfo
- }
-
- set ret {}
-
- return $ret
-}
-
proc complete_entpath {type entinfo_arrlist} {
array set entinfo $entinfo_arrlist
set req_fields $::entity_definition($type)
@@ -131,21 +113,52 @@
lappend retval $req_field $entinfo($req_field)
}
return $retval
}
+
+proc generate_tpm {entlist} {
+ set ents [list]
+ foreach part $entlist {
+ set entinfo [list]
+
+ foreach enttype $part {
+ set type [lindex $enttype 0]
+ set ent [lindex $enttype 1]
+
+ if {$type == "entity"} {
+ # Only include the entity type if it is complete...
+ set work [complete_entpath $ent [join $part]]
+
+ if {$work == ""} {
+ continue
+ }
+ }
+
+ lappend entinfo $ent
+ }
+
+ lappend ents $entinfo
+ }
+
+ set ret {}
+
+ return $ret
+}
proc generate_table {fields numitems} {
set ret ""
foreach field $fields {
append ret "
\n"
unset -nocomplain entinfo
foreach enttype [lrange $field 0 [expr $numitems - 1]] {
- set item [lindex $enttype 0]
- set type [lindex $enttype 1]
+ set type [lindex $enttype 0]
+ set item [lindex $enttype 1]
set entinfo($type) $item
}
if {[info exists entinfo(entity)]} {
@@ -155,12 +168,12 @@
}
set entpath_parts [list]
foreach enttype [lrange $field 0 [expr $numitems - 1]] {
- set item [lindex $enttype 0]
- set type [lindex $enttype 1]
+ set type [lindex $enttype 0]
+ set item [lindex $enttype 1]
if {$type != "entity"} {
lappend entpath_parts $type $item
}
@@ -192,11 +205,11 @@
set altindexfile [file join $dstdir entity index.html]
set pkglist [list]
foreach ent [array names pkginfo] {
set pkg [lindex $ent 0]
- set addent [list [list $pkg name]]
+ set addent [list [list name $pkg]]
if {[lsearch -exact $pkglist $addent] != -1} {
continue
}
lappend pkglist $addent
@@ -239,11 +252,11 @@
foreach ent [array names pkginfo] {
set pkg [lindex $ent 0]
set ver [lindex $ent 1]
set arch [lindex $ent 2]
- lappend pkglist [list [list package entity] [list $pkg name] [list $ver ver] [list $arch arch] [list 0 unknown]]
+ lappend pkglist [list [list entity package] [list name $pkg] [list ver $ver] [list arch $arch] [list unknown 0]]
}
set pkglist [lsort -dictionary $pkglist]
set fd [open $indexfile w]
@@ -391,13 +404,13 @@
set field [lindex $req_fields $idx]
set value [lindex $pkgent $idx]
set currpkginfo($field) $value
}
- set currpkgdata [list [list $entity_type entity]]
+ set currpkgdata [list [list entity $entity_type]]
foreach dispfield $dispfields {
- lappend currpkgdata [list $currpkginfo($dispfield) $dispfield]
+ lappend currpkgdata [list $dispfield $currpkginfo($dispfield)]
}
if {[lsearch -exact $pkglist $currpkgdata] != -1} {
continue
}