From f6bf03691d711769466c9e9d76a82dda4e679bbc Mon Sep 17 00:00:00 2001 From: hummypkg Date: Sat, 3 Sep 2011 23:26:54 +0000 Subject: [PATCH] use findhsvc class git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@352 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- var/mongoose/cgi-bin/backup/restore.jim | 22 ++----------------- var/mongoose/lib/findhsvc | 29 +++++++++++-------------- var/mongoose/lib/rsv.class | 14 +++++++----- 4 files changed, 24 insertions(+), 43 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 2203710..7fbf565 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 0.6.7 +Version: 0.6.8 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.3),hmt(>=1.0.6),ssmtp diff --git a/var/mongoose/cgi-bin/backup/restore.jim b/var/mongoose/cgi-bin/backup/restore.jim index 52da331..7bc7e3f 100755 --- a/var/mongoose/cgi-bin/backup/restore.jim +++ b/var/mongoose/cgi-bin/backup/restore.jim @@ -3,7 +3,7 @@ package require cgi source /mod/var/mongoose/lib/setup -require rsv.class +require rsv.class findhsvc set dir /mod/var/backup @@ -33,24 +33,6 @@ if {[catch { set fd [open $ffile r] } msg]} { exit } -proc findhsvc {channel} { - global rsvdb - - set hsvc [$rsvdb query " - select hSvc - from channel.TBL_SVC - where szSvcName = '$channel' - or szSvcname = '\025$channel' - limit 1 - "] - - if {[llength $hsvc] == 1} { - return [lindex [lindex $hsvc 0] 1] - } else { - return 0 - } -} - puts "Restoring scheduled events..." $rsvdb query {begin transaction;} @@ -111,7 +93,7 @@ foreach line $data { set group [lindex $vals 1] set type [lindex $vals 2] set chan [lindex $vals 3] - set hsvc [findhsvc $chan] + set hsvc [get_channel_attr $chan] if {$grp != $group} { set grp $group diff --git a/var/mongoose/lib/findhsvc b/var/mongoose/lib/findhsvc index 293d494..ba4a87f 100755 --- a/var/mongoose/lib/findhsvc +++ b/var/mongoose/lib/findhsvc @@ -1,41 +1,38 @@ -if {![exists -proc findhsvc]} { - +if {![exists -proc get_channel_attr]} { require rsv.class - proc findhsvc {channel} { + proc get_channel_attr {channel {field hSvc}} { global rsvdb - set hsvc [$rsvdb query " - select hSvc + set ff [$rsvdb query " + select $field from channel.TBL_SVC where szSvcName = '$channel' or szSvcname = '\025$channel' limit 1 "] - if {[llength $hsvc] == 1} { - return [lindex [lindex $hsvc 0] 1] - } else { - return 0 + if {[llength $ff] == 1} { + return [lindex [lindex $ff 0] 1] } + return "" } - proc findhsvcbylcn {lcn} { + proc get_channel_attr_bylcn {lcn {field hSvc}} { global rsvdb - set hsvc [$rsvdb query " - select hSvc + set ff [$rsvdb query " + select $field from channel.TBL_SVC where usLcn = $lcn limit 1 "] - if {[llength $hsvc] == 1} { - return [lindex [lindex $hsvc 0] 1] - } else { - return 0 + if {[llength $ff] == 1} { + return [lindex [lindex $ff 0] 1] } + return 0 } } diff --git a/var/mongoose/lib/rsv.class b/var/mongoose/lib/rsv.class index 4678fe3..8e8c3c6 100755 --- a/var/mongoose/lib/rsv.class +++ b/var/mongoose/lib/rsv.class @@ -82,7 +82,7 @@ rsv method channel_name {} { rsv method icon {} { set rsvicon "" - switch [$self get ersvtype] { + switch $ersvtype { 1 { set rsvicon "175_1_00_Reservation_Watch.png" } 2 { set rsvicon "175_1_00_Reservation_Watch.png" } 3 { set rsvicon "175_1_11_Reservation_Record.png" } @@ -94,16 +94,18 @@ rsv method icon {} { } rsv method RKIcon {} { - if {[$self get ucRecKind] == 4} { - set RKIcon "175_1_11_Series_Record.png" - } else { - switch [$self get erepeat] { + switch $ucRecKind { + 2 { set RKIcon "178_1_26_Icon_Split.png" } + 4 { set RKIcon "175_1_11_Series_Record.png" } + default { + switch $erepeat { 1 {set RKIcon "521_1_00_RP_Daily_C.png"} 2 {set RKIcon "521_1_00_RP_Weekly_C.png"} 3 {set RKIcon "521_1_00_RP_Weekdays_C.png"} 4 {set RKIcon "521_1_00_RP_Weekend_C.png"} default {set RKIcon ""} } + } } return $RKIcon } @@ -113,7 +115,7 @@ rsv method set_delete {} { } rsv method remove_pending {} { - $::rsvdb query "delete from pending where ulslot = [$self get ulslot]" + $::rsvdb query "delete from pending where ulslot = $ulslot" } rsv method fix_hsvc {} {