schedule restructure

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@876 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2012-03-31 21:16:31 +00:00
parent 8fb6570882
commit 2bbf69f820
15 changed files with 434 additions and 120 deletions

View File

@ -4,6 +4,6 @@ Section: web
Version: 0.9.3-5
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.6),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file
Depends: mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.6),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync
Suggests: ffmpeg,webif-iphone
Description: An evolving web interface for the Humax.

View File

@ -214,9 +214,9 @@ header
puts {
<link href=/css/jquery.contextMenu.css rel=stylesheet type=text/css />
<script type="text/javascript" src="/js/jquery.contextMenu.js"></script>
<script type=text/javascript src=/js/jquery.contextMenu.js></script>
<link href=/css/jquery.bar.css rel=stylesheet type=text/css />
<script type="text/javascript" src="/js/jquery.bar.js"></script>
<script type=text/javascript src=/js/jquery.bar.js></script>
<script type=text/javascript src=/js/enadis.js></script>
<script type=text/javascript src=/cgi-bin/browse/browse.js></script>
<link type=text/css rel=stylesheet href=/cgi-bin/browse/style.css />

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -36,11 +36,11 @@ $(document).ready(function() {
<div class=left>
<center>
<a href=/sched.shtml>
<a href=/sched/sched.jim>
<img src=/images/321_1_00_Menu_CHList.png border=0 width=217 height=228>
</a>
<br>
<a href=/sched.shtml>
<a href=/sched/sched.jim>
<b>Scheduled Events</b>
</a>
<br>

View File

@ -1,6 +0,0 @@
<!--#include virtual="/lib/header.shtml" -->
<script type="text/javascript" src="/js/jquery.tablesorter.js"></script>
<link type=text/css href=/css/tsort.css rel=Stylesheet />
<!--#exec cmd="/mod/var/mongoose/include/sched.jim" -->
<!--#include virtual="/lib/footer.shtml" -->

23
var/mongoose/html/sched/ar.jim Executable file
View File

@ -0,0 +1,23 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require rsv.class system.class
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
set slot [cgi_get slot 0]
set table [cgi_get table TBL_RESERVATION]
set event [rsv slot $table $slot]
$event clear_ulslot
$event set_unpad
$event insert
system restartpending

View File

@ -0,0 +1,78 @@
#!/mod/bin/jimsh
lassign [system padding] pre post
proc padval {num str def} {
puts -nonewline "<option value=$num"
if {$num == $def} {
puts -nonewline " selected"
}
puts ">$str"
}
puts {
<ul id=optmenu class=contextMenu style="width: 200px">
<li class=delete><a href=#delete>Delete</a></li>
<li class=separator><a href=#ar>Enable AR</a></li>
<li class=separator><a href=#folder>Change Folder</a></li>
</ul>
<div id=padding style="display: none">
<form id=paddingf method=post action=pad.jim>
<input type=hidden id=paddingsid name=sid value=0>
<table class=keyval>
<tr>
<th>Start Padding</th>
<td><select id=prepadding name=pre
class="ui-widget-content ui-corner-all">
}
padval 0 "Off" $pre
padval 60 "1 minute" $pre
padval 120 "2 minutes" $pre
padval 300 "5 minutes" $pre
padval 600 "10 minutes" $pre
puts {
</select></td>
</tr><tr>
<th>End Padding</th>
<td><select id=postpadding name=post
class="ui-widget-content ui-corner-all">
}
padval 0 "Off" $post
padval 60 "1 minute" $post
padval 120 "2 minutes" $post
padval 300 "5 minutes" $post
padval 600 "10 minutes" $post
puts {
</select></td>
</tr>
</table>
</form>
</div>
<div id=fchange title="Change folder" style="display: none">
<form id=fchangeform>
<input type=hidden name=sid id=fchangeslot value=0>
<table border=0>
<tr>
<th>
<label for="name">
<b>New Folder Name</b>
</label>
</th>
<td>
<input type=text name="name" id="fchangename"
value="" size=70 maxlength=255
class="text ui-widget-content ui-corner-all">
</td>
</tr>
</table>
</form>
</div>
}

View File

@ -0,0 +1,28 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require rsv.class system.class
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
set slot [cgi_get sid 0]
set table [cgi_get table TBL_RESERVATION]
set folder [cgi_get name -]
if {$folder eq "-"} {
puts "Error - no folder."
exit
}
set event [rsv slot $table $slot]
$event clear_ulslot
$event set_folder $folder
$event insert
system restartpending

View File

@ -63,7 +63,12 @@ puts "
</td>
</tr><tr>
<th>Event Name</th>
<td>[$event name]</td>
<td>[$event name]"
if {[$event get ucRecKind] == 4 && [$event name] ne [$event folder]} {
puts "<span class=also>(Folder: [$event folder])</span>"
}
puts "</td>
</tr><tr>
<th>Start</th>
"

25
var/mongoose/html/sched/pad.jim Executable file
View File

@ -0,0 +1,25 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require rsv.class system.class
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
set slot [cgi_get slot 0]
set table [cgi_get table TBL_RESERVATION]
set pre [cgi_get pre 120]
set post [cgi_get post 300]
set event [rsv slot $table $slot]
$event clear_ulslot
$event set_pad $pre $post
$event insert
system restartpending

View File

@ -1,100 +1,23 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require altrow rsv.class progressbar epg.class
require altrow rsv.class progressbar epg.class system.class
puts "Content-Type: text/html"
puts ""
header
puts {
<script type=text/javascript src=/js/jquery.tablesorter.js></script>
<link type=text/css href=/css/tsort.css rel=Stylesheet />
<link href=/css/jquery.contextMenu.css rel=stylesheet type=text/css />
<script type=text/javascript src=/js/jquery.contextMenu.js></script>
<script type=text/javascript src=/js/jquery.form.js></script>
<script type=text/javascript src=script.js></script>
<div id=dialogue></div>
<script type=text/javascript>
$.tablesorter.addParser({
id: 'programme',
is: function () { return false; },
format: function(s) {
return s.toLowerCase().replace(/---/, 'zzz');
},
type: 'text'
});
$.tablesorter.addParser({
id: 'date',
is: function () { return false; },
format: function(s) {
var d = new Date(s.substring(0, s.length - 4));
return d.getTime();
},
type: 'numeric'
});
$(document).ready(function() {
$('table.tablesorter').tablesorter({
headers: {
1: { sorter: false },
3: { sorter: 'programme' },
4: { sorter: 'date' },
5: { sorter: 'date' },
5: { sorter: false },
6: { sorter: false },
7: { sorter: false }
}
});
$('table.tablesorter thead th').filter('[class!=header]')
.addClass('headerplain');
});
$(document).ready(function() {
function docancel()
{
var table = $('#dialogue').attr('table');
var slot = $('#dialogue').attr('slot');
if (confirm('Really remove scheduled event?'))
{
$.get('/cgi-bin/sched_cancel.jim?slot=' + slot +
'&table=' + table, function() {
window.location.reload(true);
});
$('#dialogue').dialog('close');
}
}
var $buttons1 = {
"Close" : function() {$(this).dialog('close');}
};
var $buttons2 = $.extend(
{"Cancel Event": function() { docancel() }},
$buttons1);
var $dialog = $('#dialogue').dialog({
title: "Schedule Details",
modal: false, autoOpen: false,
height: 500, width: 700,
show: 'scale', hide: 'fade',
draggable: true, resizable: true,
buttons: $buttons2,
close: function(e,u) { $('#dialogue').empty().html(
'<img src="/img/loading.gif" alt="loading">'); }
});
function schedpopup(e, o)
{
e.preventDefault();
var slot = o.attr('slot');
var table = o.attr('table');
$('#dialogue').attr('slot', slot).attr('table', table);
var url = '/cgi-bin/sched_info.jim?slot=' + slot +
'&table=' + table;
$('#dialogue').load(url);
$dialog.dialog('open');
}
$('a.schedule').click(function(e) { schedpopup(e, $(this)) });
$('table.tablesorter tbody tr').hover(
function() { $(this).addClass('hover'); },
function() { $(this).removeClass('hover'); });
});
</script>
}
proc eventheader {{table TBL_RESERVATION} note} {
@ -128,7 +51,10 @@ proc eventheader {{table TBL_RESERVATION} note} {
proc eventrow {event {table TBL_RESERVATION}} {
set name [$event name]
altrow
set attrs "table=$table sid=[$event get ulslot] \
reckind=[$event get ucRecKind] rsvtype=[$event get ersvtype] \
ar=[expr ! [$event padded]]"
altrow $attrs
set rsvicon [$event icon]
set RKIcon [$event RKIcon]
@ -162,6 +88,7 @@ proc eventrow {event {table TBL_RESERVATION}} {
1 { set icon "close" }
2 { set icon "ar" }
3 { set icon "pad" }
4 { set icon "folder" }
}
puts "<td align=center>
<img class=va width=30 src=/img/$icon.png></td>"
@ -183,8 +110,11 @@ proc eventrow {event {table TBL_RESERVATION}} {
puts "<td nowrap>
<a slot=[$event get ulslot] table=$table
href=# class=schedule>$name</a>
</td>"
href=# class=schedule>$name</a>"
if {[$event get ucRecKind] == 4 && $name ne [$event folder]} {
puts "<br><span class=also>&nbsp;(Folder: [$event folder])</span>"
}
puts "</td>"
set s [$event get nsttime]
set d [$event get nduration]
@ -214,13 +144,10 @@ proc eventrow {event {table TBL_RESERVATION}} {
puts "[clock format [$event get nduration] -format %T]</td>"
}
puts "<td nowrap>$rsvicon $RKIcon</td><td>"
if {[$event get aulEventToRecordInfo] != ""} {
puts "<img src=/img/lightning.png
alt=\"Accepted by Humax\"
title=\"Accepted by Humax\">"
}
puts "</td>";
puts "<td nowrap>$rsvicon $RKIcon</td>"
puts "<td><a href=# class=smenu sid=[$event get ulslot]>
<img border=0 src=/img/more_btn.gif></a></td>"
puts "</tr>"
}
@ -261,3 +188,7 @@ puts {
</script>
}
source assets.jim
footer

209
var/mongoose/html/sched/script.js Executable file
View File

@ -0,0 +1,209 @@
$.tablesorter.addParser({
id: 'programme',
is: function () { return false; },
format: function(s) {
return s.toLowerCase().replace(/---/, 'zzz');
},
type: 'text'
});
$.tablesorter.addParser({
id: 'date',
is: function () { return false; },
format: function(s) {
var d = new Date(s.substring(0, s.length - 4));
return d.getTime();
},
type: 'numeric'
});
$(document).ready(function() {
$('table.tablesorter').tablesorter({
headers: {
1: { sorter: false },
3: { sorter: 'programme' },
4: { sorter: 'date' },
5: { sorter: 'date' },
5: { sorter: false },
6: { sorter: false },
7: { sorter: false }
}
});
$('table.tablesorter thead th').filter('[class!=header]')
.addClass('headerplain');
function docancel()
{
var table = $('#dialogue').attr('table');
var slot = $('#dialogue').attr('slot');
if (confirm('Really remove scheduled event?'))
{
$.get('cancel.jim?slot=' + slot +
'&table=' + table, function() {
window.location.reload(true);
});
$('#dialogue').dialog('close');
}
}
var $buttons1 = {
"Close" : function() {$(this).dialog('close');}
};
var $buttons2 = $.extend(
{"Cancel Event": function() { docancel() }},
$buttons1);
var $dialog = $('#dialogue').dialog({
title: "Schedule Details",
modal: false, autoOpen: false,
height: 500, width: 700,
show: 'scale', hide: 'fade',
draggable: true, resizable: true,
buttons: $buttons2,
close: function(e,u) { $('#dialogue').empty().html(
'<img src="/img/loading.gif" alt="loading">'); }
});
function schedpopup(e, o)
{
e.preventDefault();
var slot = o.attr('slot');
var table = o.attr('table');
$('#dialogue').attr('slot', slot).attr('table', table);
var url = 'info.jim?slot=' + slot +
'&table=' + table;
$('#dialogue').load(url);
$dialog.dialog('open');
}
$('a.schedule').click(function(e) { schedpopup(e, $(this)) });
$('table.tablesorter tbody tr').hover(
function() { $(this).addClass('hover'); },
function() { $(this).removeClass('hover'); });
$('button').button();
// Menu
var $paddialog = $('#padding').dialog({
title: "Padding values",
modal: true, autoOpen: false,
height: 'auto', width: 'auto',
show: 'scale', hide: 'fade',
draggable: false, resizable: false,
buttons: {
"Confirm": function() {
$('#paddingf').ajaxSubmit({
dataType: 'text',
success: function(data) {
window.location.reload(true);
}
});
},
"Cancel": function() { $(this).dialog('close'); }
}
});
$('#fchange').dialog({
autoOpen: false,
height: 'auto', width: 'auto',
modal: true,
buttons: {
"Update": function() {
var s = $('#fchangeform').serialize();
$.get('folder.jim?' + s,
function() { window.location.reload(true); });
},
"Close": function() {
$(this).dialog('close');
}
},
close: function() {
$('#changeslot').val(0);
$('#fchangename').val('');
}
});
function preparemenu(el, menu)
{
if (!$(el).is("tr"))
el = $(el).closest('tr');
if ($(el).attr('table') != 'pending' && $(el).attr('rsvtype') == 3)
{
if ($(el).attr('ar') == 1)
$('#optmenu').changeContextMenuItem('#ar',
'Disable AR');
else
$('#optmenu').changeContextMenuItem('#ar',
'Enable AR');
$('#optmenu').enableContextMenuItems('#ar');
}
else
$('#optmenu').disableContextMenuItems('#ar');
if ($(el).attr('table') != 'pending' && $(el).attr('reckind') == 4)
$('#optmenu').enableContextMenuItems('#folder');
else
$('#optmenu').disableContextMenuItems('#folder');
}
function menuclick(action, el, pos)
{
if (!$(el).is("tr"))
el = $(el).closest('tr');
var sid = $(el).attr('sid');
//if (window.console)
//console.log("Got %s, el: %o, id: %d", action, el, sid);
switch (action)
{
case 'delete':
var table = $(el).attr('table');
if (confirm('Are you sure you want to delete this entry?'))
$.get('cancel.jim?slot=' + sid +
'&table=' + table,
function() {
window.location.reload(true);
});
break;
case 'ar':
if ($(el).attr('ar') == 1)
{
$('#paddingsid').val(sid);
$paddialog.dialog('open');
}
else
$.get('ar.jim?slot=' + sid,
function() {
window.location.reload(true);
});
break;
case 'folder':
$('#fchangeslot').val(sid);
$('#fchangename').val($(el).find('a.schedule').text());
$('#fchange').dialog('open');
break;
default:
alert('Unhandled menu event, ' + action);
}
}
$('table.schedule tbody tr').hover(
function() { $(this).addClass('hover'); },
function() { $(this).removeClass('hover'); })
.contextMenu({menu: 'optmenu', beforeShow: preparemenu}, menuclick);
$('a.smenu')
.contextMenu({menu: 'optmenu', leftButton: true, beforeShow: preparemenu}, menuclick);
});

View File

@ -1,11 +1,16 @@
if {![exists -proc altrow]} {
proc altrow {} {{i 0}} {
proc altrow {{attrs ""}} {{i 0}} {
puts -nonewline "<tr class="
if { $i == 0 } {
puts "<tr class=odd>"
puts -nonewline "odd"
} else {
puts "<tr class=even>"
puts -nonewline "even"
}
if {$attrs ne ""} {
puts -nonewline " $attrs"
}
puts ">";
set i [expr ! $i]
}
}

View File

@ -69,11 +69,22 @@ rsv method clear_ulslot {} {
set ulslot -1
}
rsv method name {} {
set name [string range $szevtname 1 end]
if {[string first "i7" $name] == 0} {
set name [string range $name 2 end]
rsv method _strip {str} {
if {[string range $str 1 2] eq "i7"} {
set str [string range $str 3 end]
}
if {[string first "\025" $str] == 0} {
set str [string range $str 1 end]
}
return $str
}
rsv method folder {} {
return [$self _strip $szFPBRecPath]
}
rsv method name {} {
set name [$self _strip $szevtname]
if {$name == ""} {
switch $ersvtype {
1 { set name "--- Unnamed reminder ---" }
@ -140,6 +151,11 @@ rsv method set_unpad {} {
set action 2
}
rsv method set_folder {name} {
set action 4
set szFPBRecPath $name
}
rsv method set_pad {{pre 60} {post 60}} {
set action 3
set ulPreOffset $pre