# Edit Tivo Menus
#
# Enables you to edit the text of all tivo menus
#
proc OpenObject {db objspec} {
if {[string range $objspec 0 0] == "/"} {
set obj [db $db open $objspec]
} elseif { [regexp {([0-9]*)/(.*)} $objspec junk fsid subobjid] } {
set obj [db $db openidconstruction $fsid $subobjid]
} else {
set obj [db $db openid $objspec]
}
return $obj
}
proc action_menuedit {chan path env} {
global db
global evrc evmw
set setvalue ""
set searchtext " "
eval $env
puts $chan [html_start "Edit Tivo Menus"]
if { $setvalue != "" } {
set obj [string range $path 1 10]
puts $chan "
Setting value of $obj to $setvalue
"
transaction {
set x [OpenObject $db $obj]
dbobj $x set "String" "$setvalue"
}
puts $chan "
" } else { puts $chan [html_table_start "" "Find Menu Text" "colspan=2"] puts $chan "
" puts $chan [html_table_end] puts $chan [html_table_start "" "Edit Tivo Menus" "colspan=2"] RetryTransaction { set swsystemfsid [lindex [mfs find /SwSystem/ACTIVE] 0] } RetryTransaction { set objSwSystem [db $db openid $swsystemfsid] set objResourceGroup [dbobj $objSwSystem get ResourceGroup] set objStrResGroup [lindex $objResourceGroup 1] set objStrResGroupItemList [dbobj $objStrResGroup get Item] foreach Item $objStrResGroupItemList { set menutext [string trim [dbobj $Item get String] "{}"] if {[string first [string tolower $searchtext ] [string tolower $menutext] ] > -1} { puts $chan [tr "" [td [ObjectIds $Item]] [td [html_form_start "GET" "[ObjectIds $Item]"][html_form_text 1 120 "setvalue" $menutext][html_form_end]]] } } } puts $chan [html_table_end] } puts $chan [html_link "/resources/UpdateResources" "Update Resources"] puts $chan [html_end] } register_module "menuedit" "Edit Menus" "Edit Tivo Menus"