2011-06-26 23:05:38 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
|
|
|
package require cgi
|
2012-05-21 20:23:41 +00:00
|
|
|
source /mod/webif/lib/setup
|
|
|
|
require ts.class
|
2011-06-26 23:05:38 +00:00
|
|
|
|
|
|
|
puts "Content-Type: text/html"
|
|
|
|
puts ""
|
|
|
|
|
|
|
|
cgi_input
|
|
|
|
#cgi_dump
|
|
|
|
|
2012-11-18 12:07:53 +00:00
|
|
|
set file [cgi_get renamefile "-"]
|
|
|
|
if {$file eq "-"} exit
|
2011-06-26 23:05:38 +00:00
|
|
|
|
2012-11-18 12:07:53 +00:00
|
|
|
set newfile [string trim [cgi_get rename]]
|
|
|
|
set dir [file dirname $file]
|
2011-06-26 23:05:38 +00:00
|
|
|
|
|
|
|
if {[file isdirectory $file]} {
|
|
|
|
#puts "Directory."
|
|
|
|
if {$newfile ne ""} {
|
|
|
|
set newfile "${dir}/${newfile}"
|
|
|
|
file rename $file $newfile
|
|
|
|
}
|
|
|
|
} elseif {[set ts [ts fetch $file]] != 0} {
|
|
|
|
#puts "TS file."
|
|
|
|
|
2012-11-18 12:07:53 +00:00
|
|
|
foreach attr {title synopsis guidance} {
|
|
|
|
if {[catch {
|
|
|
|
set new [string trim [cgi_get "rename_$attr"]]
|
|
|
|
set old [$ts get $attr]
|
|
|
|
if {[string length $new] > 0 && $new ne $old} {
|
|
|
|
$ts set$attr $new
|
|
|
|
}
|
|
|
|
} msg]} {
|
|
|
|
puts "$attr: $msg"
|
2011-06-26 23:05:38 +00:00
|
|
|
}
|
|
|
|
}
|
2012-11-18 12:07:53 +00:00
|
|
|
|
|
|
|
if {"$dir/$newfile.ts" ne "$file"} { ts renamegroup $file $newfile }
|
2011-06-26 23:05:38 +00:00
|
|
|
} else {
|
|
|
|
#puts "Normal file."
|
|
|
|
if {$newfile ne ""} { ts renamegroup $file $newfile }
|
|
|
|
}
|
|
|
|
|