update pkg management and add update-all, add reset firmware button

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@443 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2011-10-05 22:07:22 +00:00
parent c3a41bed59
commit 8949bfaa02
9 changed files with 177 additions and 41 deletions

View File

@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
Version: 0.7.4
Version: 0.7.5
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),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.5),hmt(>=1.0.6),ssmtp

7
var/mongoose/cgi-bin/cfwreset Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
echo "Content-Type: text/plain"
echo
/bin/rm -rf /mod/*

View File

@ -48,7 +48,7 @@ proc pkgrow {pkg} {
puts "<td align=center><small><button id=\"[$pkg get name]\"
action=[string tolower $type]
class=[string tolower $type]>$type</button></small></td>"
class=\"va [string tolower $type]\">$type</button></small></td>"
puts "</tr>"
}

View File

@ -60,7 +60,13 @@ handle_int_update pkgdev $pkgdev "Development Package Display"
header
puts {<script type="text/javascript" src="/js/jquery.form.js"></script>}
puts {
<script type="text/javascript" src="/js/jquery.form.js"></script>
<script type="text/javascript" src="/js/jconfirmaction.jquery.js"></script>
<link href=/css/jconfirmaction.jquery.css rel=stylesheet type=text/css />
<script type="text/javascript" src="/js/iphone-style-checkboxes.js"></script>
<link href=/css/iphone-style-checkboxes.css rel=stylesheet type=text/css />
}
puts {
<script type=text/javascript>
@ -83,9 +89,6 @@ puts {
}
puts "
<link href=/css/iphone-style-checkboxes.css rel=stylesheet type=text/css />
<script type=\"text/javascript\" src=\"/js/iphone-style-checkboxes.js\">
</script>
<fieldset style=\"display: inline\">
<legend>
General Settings
@ -223,5 +226,24 @@ puts "
eval_plugins settings
puts {
<br><br>
<fieldset style="display: inline">
<legend> Reset Custom Firmware </legend>
<button id=cfwreset>
Click to remove all packages and settings installed by the custom firmware.
</button>
</fieldset>
<script type=text/javascript>
$('#cfwreset').jConfirmAction({
yesAnswer: "Delete"
}, function(el) {
$('html').html('Restart the Humax using the remote control.');
$.get('/cgi-bin/cfwreset');
});
</script>
}
footer

View File

@ -0,0 +1,37 @@
.jcaquestion {
position: absolute;
display: inline;
text-align: center;
width: 174px;
height: 78px;
font-size: 13px;
line-height: 1.5em;
background: url('/img/bubble.png') left top no-repeat;
padding: 10px 0 0 0;
text-shadow: 0px 1px 0px #fff;
margin-left: -7em;
margin-top: -6em;
opacity: 0;
}
.jcayes, .jcacancel {
margin-top: .5em;
margin-right: .5em;
cursor: pointer;
display: inline-block;
width: 63px;
height: 21px;
color: #fff;
text-shadow: 0px 1px 0px #000;
background: url('/img/button.png') left top no-repeat;
}
.jcatitle {
font-size: 30px;
margin-bottom: 1.5em;
font-weight: bold;
font-style: italic;
text-shadow: 0px 2px 0px #fff;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,50 @@
/*
* jQuery Plugin : jConfirmAction
*
* by Hidayat Sagita
* http://www.webstuffshare.com
* Licensed Under GPL version 2 license.
*
*/
(function($){
jQuery.fn.jConfirmAction = function (options, callback) {
// Some jConfirmAction options (limited to customize language) :
// question : a text for your question.
// yesAnswer : a text for Yes answer.
// cancelAnswer : a text for Cancel/No answer.
var theOptions = jQuery.extend ({
question: "Are You Sure?",
yesAnswer: "Yes",
cancelAnswer: "Cancel"
}, options);
return this.each (function () {
$(this).click(function(e) {
e.preventDefault();
var p = $(this);
if($(this).next('.question').length <= 0)
$(this).after('<div class="jcaquestion">'+theOptions.question+'<br/> <span class="jcayes">'+theOptions.yesAnswer+'</span><span class="jcacancel">'+theOptions.cancelAnswer+'</span></div>');
$(this).next('.jcaquestion').animate({opacity: 1}, 300);
$('.jcayes').bind('click', function() {
callback(p);
});
$('.jcacancel').bind('click', function(){
$(this).parents('.jcaquestion').fadeOut(300, function() {
$(this).remove();
});
});
});
});
}
})(jQuery);

View File

@ -25,16 +25,18 @@ button.upgrade
<button class=va id=opkgupdate style="display: none">
Update package list from Internet
</button>
<button class=va id=opkgupgradeall style="display: none">
Upgrade all packages
</button>
</small>
</div>
<div id=results class=shadowbox
style="width: 90%; display: none; margin: 1 0 1em 0">
<div>
<pre id=result_txt>
Updating package list...
</pre>
</div>
<div id=refreshing class=shadowbox
style="display: none; margin: 1 0 1em 0">
<div>
<img border=0 src=/img/loading.gif>
Refreshing...
</div>
</div>
<div id=dialogue style="display: none; align: center">
@ -42,7 +44,7 @@ Update package list from Internet
<div id=dspinner><img border=0 src=/img/loading.gif>Processing request...</div>
</div>
<!-- <script type=text/javascript src=/js/iajax.js></script> -->
<script type=text/javascript src=/js/iajax.js></script>
<script type=text/javascript>
var opkg = '/cgi-bin/opkg.jim?cmd=';
@ -54,6 +56,11 @@ $(document).ready(function() {
.click(function() { execopkg('update'); })
.fadeIn('slow');
$('#opkgupgradeall')
.button()
.click(function() { execopkg('upgrade'); })
.fadeIn('slow');
$('#pkgtabs').tabs({
load: setup_buttons,
spinner: '<img border=0 src=/img/loading.gif> ' +
@ -68,41 +75,54 @@ $(document).ready(function() {
draggable: true, resizable: true,
buttons: { "Close":
function() {$(this).dialog('close');}},
close: function(e,u) { window.location.reload(true); }
close: function(e,u) {
$('#refreshing').show('slow');
$('#pkgtabs').hide('fast');
window.location.reload(true);
}
});
// jQuery.ajaxSetup({progressInterval: 1});
//
// function loaddata(data, isfinal)
// {
// console.log('loaddata called, final=' + isfinal);
// console.log('Data: ' + data);
// $('#dresults').append(data);
// if (isfinal)
// $('#dspinner').hide('slow');
// }
jQuery.ajaxSetup({progressInterval: 1});
function loaddata(data, isfinal)
{
//console.log('loaddata called, final=' + isfinal);
//console.log('Data: ' + data);
$('#dresults').append(data);
if (isfinal)
{
$('#dspinner').hide('slow');
if (!$('#dresults').text())
$('#dresults').append('Nothing to do.');
}
}
function execopkg(arg)
{
$('button.va')
.attr('disabled', true)
.addClass('ui-state-disabled');
$('#dspinner').show();
$('#dresults').empty();
$dialog.dialog('open');
$('#dresults').load(opkg + arg, function() {
$('#dspinner').hide('slow');
});
// $('#dresults').empty();
// $.ajax({
// type: "GET",
// url: opkg + arg,
// progress: loaddata,
// success: function(data) {
// console.log("ajax success");
// loaddata(data, true);
// },
// error: function(_, _, e) {
// console.log("ajax error");
// alert(e);
// }
// $('#dresults').load(opkg + arg, function() {
// $('#dspinner').hide('slow');
// });
$.ajax({
type: "GET",
url: opkg + arg,
progress: loaddata,
success: function(data) {
//console.log("ajax success");
loaddata(data, true);
},
error: function(_, _, e) {
//console.log("ajax error");
alert(e);
}
});
}
function setup_buttons()