fix error on default browse directory

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@545 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2011-12-06 00:13:41 +00:00
parent 659fd40fe9
commit 1045587fbd
7 changed files with 136 additions and 5 deletions

View File

@ -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

View File

@ -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 "<div class=va>"
@ -192,7 +201,7 @@ puts {
<tr style="display: none" class=tstype>
<th>
<label for="renametitle" style="padding-top: 0.5em">
<b>New EPG Title</b>
<b>New Medialist Title</b>
</label>
</th>
<td>
@ -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 "<a href=# id=selectall>Select all</a> | <a href=# id=deselectall>none</a>"
# Sort icons
puts "<div id=sortdiv>"
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 "
<a href=$env(REQUEST_URI)?$env(QUERY_STRING)&order=$index>"
set tag "Sort"
}
puts "<img class=va border=0 src=/img/$img.gif> $tag by $descr"
if {$order != $index} {
puts "</a>"
}
}
puts "</div>"
puts "</fieldset>"
puts "<div class=brow>"

View File

@ -21,6 +21,7 @@ span.pl { padding-left: 2em; }
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
<script type="text/javascript" src="/js/jquery.progressbar.js"></script>
<script type="text/javascript" src="/js/touchbridge.js"></script>
<p><b>
Drag the files below into order, enter a name for the resulting file and then

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

View File

@ -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 );

View File

@ -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]