diff --git a/var/mongoose/cgi-bin/browse.jim b/var/mongoose/cgi-bin/browse.jim index 18fbe3ab..19a82f78 100755 --- a/var/mongoose/cgi-bin/browse.jim +++ b/var/mongoose/cgi-bin/browse.jim @@ -33,6 +33,14 @@ if {$order eq "-"} { set model [system model] set dustbin [system dustbin 1] +proc icon {img {hover ""} {extra ""}} { + puts -nonewline "\"$hover\"" +} + proc directory {file bfile} { global flatten @@ -51,14 +59,8 @@ proc directory {file bfile} { set noflat 0 if $flatten { if {[string match {\[*\]} [file tail $file]]} { set noflat 1 } - if {[file exists "$file/.noflatten"]} { - set noflat 1 - } - - if $noflat { - puts "\"No-flatten\"" - } + if {[file exists "$file/.noflatten"]} { set noflat 1 } + if $noflat { icon "/img/flat-tyre.png" "No-flatten" } } puts -nonewline " @@ -155,39 +157,32 @@ proc entry {file} {{i 0}} { set def SD set img "172_1_26_SD" } - puts "" + icon "/images/$img.png" # Locked if {[$ts flag "Locked"] > 0} { set locked 1 - puts "" + icon "/images/178_1_00_Icon_Lock.png" "Locked" } # Encrypted if {[$ts flag "Encrypted"] > 0} { set encd 1 - puts "" + icon "/images/749_1_26_Video_Encryption.png" "" } if {![$ts flag "ODEncrypted"]} { - puts "" set odencd 0 + icon "/img/Decrypted.png" "Decrypted" } # Guidance if {[$ts flag "Guidance"] > 0} { - puts "" + icon "/images/174_1_26_GuidancePolicy.png" } # Indexed if {$::model eq "HDR" && [llength [$ts dlnaloc]]} { - puts "\"Indexed" + icon "/img/dlna.png" "Indexed by DLNA Server" set dlna 1 } diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js index ddb7a90e..80a45fc1 100755 --- a/var/mongoose/cgi-bin/browse/browse.js +++ b/var/mongoose/cgi-bin/browse/browse.js @@ -436,6 +436,13 @@ var dmenuclick = function(action, el, pos) // Disable items which are not yet implemented. $('#optmenu').disableContextMenuItems('#title'); + var $buttons = { + "Close" : function() {$(this).dialog('close');} + }; + var $buttonsp = $.extend( + {"Play" : function() { doplay(); }}, + $buttons); + // Create reusable dialogue. var $dialog = $('#dialogue').dialog({ title: "Media Details", @@ -443,23 +450,43 @@ var dmenuclick = function(action, el, pos) height: 600, width: 700, show: 'scale', hide: 'fade', draggable: true, resizable: true, - buttons: { - "Close": function() { - $(this).dialog('close'); - } - }, + buttons: $buttons, close: function(e,u) { $('#dialogue').empty().html( 'loading'); } }); + function doplay() + { + var file = $dialog.attr('file'); + var type = $dialog.attr('type'); + + disableall(); + + window.location = '/cgi-bin/browse/play.jim?' + + 'dir=' + encodeURIComponent(dir) + + '&file=' + file; + } + // Bind dialogue open to filenames. $('a.bf').click(function(e) { e.preventDefault(); + var file = $(this).attr('file'); var type = $(this).attr('type'); + var opt = $(this).nextAll('a').find('img.opt'); + var url = '/cgi-bin/browse/file.jim?file=' + file + '&type=' + type; - $('#dialogue').load(url); + $dialog.load(url); + + $dialog.attr('file', file); + $dialog.attr('type', type); + + if (type == 'ts' && + (opt.attr('odencd') == 0 || opt.attr('dlna') == 1)) + $dialog.dialog("option", "buttons", $buttonsp); + else + $dialog.dialog("option", "buttons", $buttons); $dialog.dialog('open'); }); diff --git a/var/mongoose/cgi-bin/browse/delete.jim b/var/mongoose/cgi-bin/browse/delete.jim index bc542320..a3c38e73 100755 --- a/var/mongoose/cgi-bin/browse/delete.jim +++ b/var/mongoose/cgi-bin/browse/delete.jim @@ -10,6 +10,7 @@ cgi_input #cgi_dump set dir [cgi_get dir] +regsub -all {([\\["$])} $dir {\\\1} dir #puts "DIR: ($dir)" @@ -33,15 +34,17 @@ proc touch {file} { puts "
Deleting...
" puts "