diff --git a/CONTROL/control b/CONTROL/control index b6ad90b..2c519df 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 0.8.3 +Version: 0.8.3-1 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-1),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.1),ssmtp diff --git a/var/mongoose/cgi-bin/browse.jim b/var/mongoose/cgi-bin/browse.jim index 04c90e0..ff8e380 100755 --- a/var/mongoose/cgi-bin/browse.jim +++ b/var/mongoose/cgi-bin/browse.jim @@ -2,7 +2,7 @@ package require cgi source /mod/var/mongoose/lib/setup -require ts.class pretty_size system.class +require ts.class pretty_size system.class settings.class puts "Content-Type: text/html" puts "" @@ -18,6 +18,15 @@ cgi_input #set env(REQUEST_URI) '' #set _cgi(dir) "/media/My Video/\[Don't Die Young\]" +if {![dict exists $env QUERY_STRING]} { set env(QUERY_STRING) "root" } + +set order [cgi_get order -] +if {$order eq "-"} { + set order [[settings new] sortorder] +} else { + [settings new] sortorder $order +} + proc directory {file bfile} { regsub -all " +" $bfile "" tbfile puts "
" @@ -192,7 +201,7 @@ puts { @@ -274,12 +283,59 @@ regsub -all -- {\/+} "$dir/*" "/" dir # Escape square brackets (for glob) regsub -all {([\\[])} $dir {\\\1} dir -foreach file [lsort [glob -nocomplain "$dir"]] { - entry $file +proc s_time {a b} { + set ad [file isdirectory $a] + set bd [file isdirectory $b] + + if {$ad && !$bd} { return -1 } + if {$bd && !$ad} { return 1 } + if {$ad && $bd} { + if {$a < $b} { return -1 } + if {$a > $b} { return 1 } + return 0 + } + + file stat $a l + set at $l(ctime) + file stat $b l + set bt $l(ctime) + + if {$at < $bt} { return -1 } + if {$at > $bt} { return 1 } + return 0 } +set files [glob -nocomplain $dir] +switch $order { + 1 { set files [lsort -command s_time $files] } + default { set files [lsort $files] } +} + +foreach file $files { entry $file } + puts "Select all | none" +# Sort icons +puts "
" +set sortlist {{0 sort_name name} {1 sort_date date}} +foreach sl $sortlist { + lassign $sl index img descr + + if {$index} { puts " | " } + + set tag "Currently sorting" + if {$order != $index} { + puts " + " + set tag "Sort" + } + puts " $tag by $descr" + if {$order != $index} { + puts "" + } +} +puts "
" + puts "" puts "
" diff --git a/var/mongoose/cgi-bin/browse/join.jim b/var/mongoose/cgi-bin/browse/join.jim index f335160..74705de 100755 --- a/var/mongoose/cgi-bin/browse/join.jim +++ b/var/mongoose/cgi-bin/browse/join.jim @@ -21,6 +21,7 @@ span.pl { padding-left: 2em; } +

Drag the files below into order, enter a name for the resulting file and then diff --git a/var/mongoose/html/img/sort_date.gif b/var/mongoose/html/img/sort_date.gif new file mode 100644 index 0000000..7600325 Binary files /dev/null and b/var/mongoose/html/img/sort_date.gif differ diff --git a/var/mongoose/html/img/sort_name.gif b/var/mongoose/html/img/sort_name.gif new file mode 100644 index 0000000..128b347 Binary files /dev/null and b/var/mongoose/html/img/sort_name.gif differ diff --git a/var/mongoose/html/js/touchbridge.js b/var/mongoose/html/js/touchbridge.js new file mode 100644 index 0000000..027d1ad --- /dev/null +++ b/var/mongoose/html/js/touchbridge.js @@ -0,0 +1,70 @@ +/* + * Content-Type:text/javascript + * + * A bridge between iPad and iPhone touch events and jquery draggable, + * sortable etc. mouse interactions. + * @author Oleg Slobodskoi + * + * modified by John Hardy to use with any touch device + * fixed breakage caused by jquery.ui so that mouseHandled internal flag is reset + * before each touchStart event + * + */ +(function( $ ) { + + $.support.touch = typeof Touch === 'object'; + + if (!$.support.touch) { + return; + } + + var proto = $.ui.mouse.prototype, + _mouseInit = proto._mouseInit; + + $.extend( proto, { + _mouseInit: function() { + this.element + .bind( "touchstart." + this.widgetName, $.proxy( this, "_touchStart" ) ); + _mouseInit.apply( this, arguments ); + }, + + _touchStart: function( event ) { + if ( event.originalEvent.targetTouches.length != 1 ) { + return false; + } + + this.element + .bind( "touchmove." + this.widgetName, $.proxy( this, "_touchMove" ) ) + .bind( "touchend." + this.widgetName, $.proxy( this, "_touchEnd" ) ); + + this._modifyEvent( event ); + + $( document ).trigger($.Event("mouseup")); //reset mouseHandled flag in ui.mouse + this._mouseDown( event ); + + return false; + }, + + _touchMove: function( event ) { + this._modifyEvent( event ); + this._mouseMove( event ); + }, + + _touchEnd: function( event ) { + this.element + .unbind( "touchmove." + this.widgetName ) + .unbind( "touchend." + this.widgetName ); + this._mouseUp( event ); + }, + + _modifyEvent: function( event ) { + event.which = 1; + var target = event.originalEvent.targetTouches[0]; + event.pageX = target.clientX; + event.pageY = target.clientY; + } + + }); + +})( jQuery ); + diff --git a/var/mongoose/lib/settings.class b/var/mongoose/lib/settings.class index bf3b194..232a631 100644 --- a/var/mongoose/lib/settings.class +++ b/var/mongoose/lib/settings.class @@ -116,6 +116,10 @@ settings method pkgdev {{val -1}} { return [$self _nval_setting pkgdev $val] } +settings method sortorder {{val -1}} { + return [$self _nval_setting sortorder $val] +} + settings method channel_groups {} { set ret "" set db [sqlite3.open /var/lib/humaxtv/setup.db]