checkpoint

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@588 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2011-12-28 21:36:35 +00:00
parent 822de81971
commit 7c038a1776
8 changed files with 366 additions and 128 deletions

View File

@ -196,131 +196,16 @@ header
puts {
<link href=/css/jquery.contextMenu.css rel=stylesheet type=text/css />
<script type="text/javascript" src="/js/jquery.contextMenu.js"></script>
<ul id=optmenu class=contextMenu>
<li class=delete><a href=#delete>Delete</a></li>
<li><a href=#lock>Toggle Lock</a></li>
<li><a href=#enc>Toggle Enc</a></li>
<li><a href=#new>Toggle New</a></li>
<li><a href=#rename>Rename</a></li>
<li><a href=#download>Download</a></li>
}
if {[system model] eq "HDR"} {
puts { <li class="separator"><a href=#decrypt>Decrypt</a></li> }
}
if {[system pkginst ffmpeg]} {
puts { <li><a href=#audio>Extract Audio</a></li> }
}
if $nicesplice {
puts { <li class="cut separator"><a href=#crop>Crop</a></li> }
}
puts {
</ul>
<ul id=doptmenu class=contextMenu>
<li class=delete><a href=#delete>Delete</a></li>
<li><a href=#rename>Rename</a></li>
}
if $flatten {
puts { <li class="separator"><a href=#flat>No-Flatten</a></li> }
}
puts {
</ul>
<div id=renameform title="Rename media file" style="display: none">
<form id=renameform_form>
<input type=hidden name="renameorig" id="renameorig" value="">
<input type=hidden name="titleorig" id="titleorig" value="">
<table border=0>
<tr>
<th>
<label for="rename">
<b>New Filename</b>
</label>
</th>
<td>
<input type=text name="rename" id="rename"
value="" size=70 maxlength=255
class="text ui-widget-content ui-corner-all">
</td>
</tr>
<tr style="display: none" class=tstype>
<th>
<label for="renametitle" style="padding-top: 0.5em">
<b>New Medialist Title</b>
</label>
</th>
<td>
<input type=text name="renametitle" id="renametitle"
value="" size=70 maxlength=48
class="text ui-widget-content ui-corner-all">
</td>
</tr>
<tr style="display: none" class=tstype>
<td colspan=2 id=synopsis style="font-style: italic"></td>
</tr>
</table>
</form>
</div>
<div id=drenameform title="Rename directory" style="display: none">
<form id=drenameform_form>
<input type=hidden name="renameorig" id="drenameorig" value="">
<table border=0>
<tr>
<th>
<label for="drename">
<b>New Directory Name</b>
</label>
</th>
<td>
<input type=text name="rename" id="drename"
value="" size=70 maxlength=255
class="text ui-widget-content ui-corner-all">
</td>
</tr>
</table>
</form>
</div>
<div id=savestreamform title="Save streamed content"
style="display: none">
<div class=pre id=savestream_detail></div>
<form id=savestream_form>
}
puts "<input type=hidden name=dir value=\"$dir\">"
puts {
<table border=0>
<tr>
<th>
<label for="savestream_name">
<b>Filename</b>
</label>
</th>
<td>
<input type=text name="savestream_name"
id="savestream_name"
value="" size=70 maxlength=255
class="text ui-widget-content ui-corner-all">
<img id=savestream_spin src=/img/loading.gif>
</td>
</tr>
</table>
</form>
</div>
<div id=dialogue></div>
<div id=confirm title="Confirmation Required"></div>
<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=/cgi-bin/browse/browse.js></script>
<link type=text/css rel=stylesheet href=/cgi-bin/browse/style.css />
}
puts "<span style=\"display:none\" id=dir>$dir</span>"
source /mod/var/mongoose/cgi-bin/browse/assets.jim
puts "
<span style=\"display:none\" id=dir>$dir</span>
<fieldset class=cleft style=\"margin: 0 1em 1em 1em\">
<legend style=\"font-size: 1.5em; padding: 0 0.5em 0.5em 0.5em;\">
"

View File

@ -0,0 +1,131 @@
#!/mod/bin/jimsh
puts {
<div id=jbar></div>
<ul id=optmenu class=contextMenu>
<li class=delete><a href=#delete>Delete</a></li>
<li class=cut><a href=#cut>Cut to clipboard</a></li>
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
<li class=separator><a href=#rename>Rename</a></li>
<li><a href=#download>Download</a></li>
}
if {[system model] eq "HDR"} {
puts { <li class="separator"><a href=#decrypt>Decrypt</a></li> }
}
if {[system pkginst ffmpeg]} {
puts { <li><a href=#audio>Extract Audio</a></li> }
}
if $nicesplice {
puts { <li class="cut"><a href=#crop>Crop</a></li> }
}
puts {
<li class=separator><a href=#lock>Toggle Lock</a></li>
<li><a href=#enc>Toggle Enc</a></li>
<li><a href=#new>Toggle New</a></li>
</ul>
<ul id=doptmenu class=contextMenu>
<li class=delete><a href=#delete>Delete</a></li>
<li class=cut><a href=#cut>Cut to clipboard</a></li>
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
<li class=separator><a href=#rename>Rename</a></li>
}
if $flatten {
puts { <li class="separator"><a href=#flat>No-Flatten</a></li> }
}
puts {
</ul>
<div id=renameform title="Rename media file" style="display: none">
<form id=renameform_form>
<input type=hidden name="renameorig" id="renameorig" value="">
<input type=hidden name="titleorig" id="titleorig" value="">
<table border=0>
<tr>
<th>
<label for="rename">
<b>New Filename</b>
</label>
</th>
<td>
<input type=text name="rename" id="rename"
value="" size=70 maxlength=255
class="text ui-widget-content ui-corner-all">
</td>
</tr>
<tr style="display: none" class=tstype>
<th>
<label for="renametitle" style="padding-top: 0.5em">
<b>New Medialist Title</b>
</label>
</th>
<td>
<input type=text name="renametitle" id="renametitle"
value="" size=70 maxlength=48
class="text ui-widget-content ui-corner-all">
</td>
</tr>
<tr style="display: none" class=tstype>
<td colspan=2 id=synopsis style="font-style: italic"></td>
</tr>
</table>
</form>
</div>
<div id=drenameform title="Rename directory" style="display: none">
<form id=drenameform_form>
<input type=hidden name="renameorig" id="drenameorig" value="">
<table border=0>
<tr>
<th>
<label for="drename">
<b>New Directory Name</b>
</label>
</th>
<td>
<input type=text name="rename" id="drename"
value="" size=70 maxlength=255
class="text ui-widget-content ui-corner-all">
</td>
</tr>
</table>
</form>
</div>
<div id=savestreamform title="Save streamed content"
style="display: none">
<div class=pre id=savestream_detail></div>
<form id=savestream_form>
}
puts "<input type=hidden name=dir value=\"$dir\">"
puts {
<table border=0>
<tr>
<th>
<label for="savestream_name">
<b>Filename</b>
</label>
</th>
<td>
<input type=text name="savestream_name"
id="savestream_name"
value="" size=70 maxlength=255
class="text ui-widget-content ui-corner-all">
<img id=savestream_spin src=/img/loading.gif>
</td>
</tr>
</table>
</form>
</div>
<div id=dialogue></div>
<div id=confirm title="Confirmation Required"></div>
}

View File

@ -24,6 +24,33 @@ function disableall()
$('button,a,input').disable();
}
function reloadclipboard()
{
$('#clipboard')
.empty()
.html('<img src=/img/loading.gif> <i>Loading...</i>')
.load('/cgi-bin/browse/clipboard.jim', function() {
// Start Clipboard post-load actions
$('#clipclear').button().click(function() {
$.get('/cgi-bin/browse/clipboard.jim?act=clear', function() {
reloadclipboard();
});
});
$('a.clipdel').click(function() {
$.get('/cgi-bin/browse/clipboard.jim?act=remove&path=' +
$(this).attr('path'), function() {
reloadclipboard();
});
});
// End Clipboard post-load actions
});
}
function epginfo_callback(data, status, xhr)
{
var width = 85;
@ -245,6 +272,14 @@ var menuclick = function(action, el, pos)
type, id);
break;
case 'cut':
case 'copy':
$.get('/cgi-bin/browse/clipboard.jim?act=add&mode=' + action +
'&path=' + file, function() {
reloadclipboard();
});
break;
case 'lock':
confirm_action('change the lock on', lock_callback,
file, type, id);
@ -334,6 +369,14 @@ var dmenuclick = function(action, el, pos)
}
break;
case 'cut':
case 'copy':
$.get('/cgi-bin/browse/clipboard.jim?act=add&mode=' + action +
'&path=' + file, function() {
reloadclipboard();
});
break;
case 'rename':
$('#drename').val(decodeURIComponent(bfile));
$('#drenameorig').val(decodeURIComponent(file));
@ -458,7 +501,7 @@ var dmenuclick = function(action, el, pos)
new_folder_callback);
// Load clipboard
$('#clipboard').load('/cgi-bin/browse/clipboard.jim');
reloadclipboard();
// Uncheck everything
$('input.fs:checked').attr('checked', false);

View File

@ -2,12 +2,13 @@
package require cgi
source /mod/var/mongoose/lib/setup
require classdump
require clipboard.class
puts "Content-Type: text/html"
puts ""
cgi_input
cgi_input 1
#cgi_dump
set cb [[clipboard new {path "/tmp/webif-browse.cb"}] load]
@ -20,12 +21,55 @@ switch $action {
puts "<i>Clipboard is empty</i>"
exit
}
puts "<div class=cliplist>"
foreach file [$cb get items] {
set img "page_white_copy"
if {[$file get action] eq "cut"} {
set img "cut"
}
set path [$file get path]
set xpath [cgi_quote_html $path]
puts "<span title=\"$xpath\" alt=\"$xpath\">"
puts "<img src=/img/context/$img.png>"
set dfile [file tail $path]
if {[string length $dfile] > 25} {
set dfile "[string range $dfile 0 22]..."
}
if {[file isdirectory $path]} {
puts "<img height=16
src=/images/711_1_09_Media_Folder.png>"
}
puts [cgi_quote_html $dfile]
puts "<a class=clipdel href=# alt=\"Remove\" title=\"Remove\"
path=\"[cgi_quote_url $path]\">
<img src=/img/close.png height=16></a>"
puts "</span>"
}
puts "</div>"
puts "<button id=clipclear>Empty clipboard</button>"
}
add {
if {[set path [cgi_get path]] eq "0"} {
puts "No path."
exit
}
set mode [cgi_get mode copy]
foreach p [split $path ","] {
set p [cgi_unquote_input $p]
if {![$cb present $p]} {
$cb add $mode $p
puts "Added $p for $mode<br>"
}
}
$cb save
}
del {
remove {
$cb remove [cgi_unquote_input [cgi_get path]]
$cb save
}
clear {
$cb clear
$cb save
}
}

View File

@ -5,3 +5,8 @@ div.brow
clear: left;
}
div.cliplist span
{
display: block;
}

View File

@ -0,0 +1,48 @@
.jbar{
height:50px;
width:100%;
background-color: #ffffcc;
color: #ff4000;
position:fixed;
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=95);
opacity: 0.95;
-moz-opacity: 0.95;
text-align:center;
left:0px;
z-index:9999999;
margin:0px;
padding:0px;
}
.jbar-top{
top:0px;
border-top:2px solid #fff;
border-bottom: 1px solid #ebebeb;
}
.jbar-bottom{
bottom:0px;
border-bottom:2px solid #fff;
border-top: 1px solid #ebebeb;
color:#777;
}
.jbar-content{
line-height:46px;
font-size: 18px;
font-family:'Lucida Grande',sans-serif;
}
a.jbar-cross{
position:absolute;
width:31px;
height:31px;
background:transparent url(/images/cross.png) no-repeat top left;
cursor:pointer;
right:10px;
}
a.jbar-cross:hover{
background-image: url(/images/cross_hover.png)
}
.jbar-top a.jbar-cross{
top:8px;
}
.jbar-bottom a.jbar-cross{
bottom:8px;
}

View File

@ -0,0 +1,53 @@
(function($) {
$.fn.bar = function(options) {
var opts = $.extend({}, $.fn.bar.defaults, options);
return this.each(function() {
$this = $(this);
var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
// $this.click(function(e){
if(!$('.jbar').length){
timeout = setTimeout('$.fn.bar.removebar()',o.time);
var _message_span = $(document.createElement('span')).addClass('jbar-content').html(o.message);
_message_span.css({"color" : o.color});
var _wrap_bar;
(o.position == 'bottom') ?
_wrap_bar = $(document.createElement('div')).addClass('jbar jbar-bottom'):
_wrap_bar = $(document.createElement('div')).addClass('jbar jbar-top') ;
_wrap_bar.css({"background-color" : o.background_color});
if(o.removebutton){
var _remove_cross = $(document.createElement('a')).addClass('jbar-cross');
_remove_cross.click(function(e){$.fn.bar.removebar();})
}
else{
_wrap_bar.css({"cursor" : "pointer"});
_wrap_bar.click(function(e){$.fn.bar.removebar();})
}
_wrap_bar.append(_message_span).append(_remove_cross).hide().insertBefore($('.content')).fadeIn('fast');
}
// })
});
};
var timeout;
$.fn.bar.removebar = function(txt) {
if($('.jbar').length){
clearTimeout(timeout);
$('.jbar').fadeOut('fast',function(){
$(this).remove();
});
}
};
$.fn.bar.defaults = {
background_color : '#FFFFFF',
color : '#000',
position : 'top',
removebutton : true,
time : 5000
};
})(jQuery);

View File

@ -8,12 +8,11 @@ class clipboard {
class clipboarditem {
action ""
type ""
path ""
}
clipboarditem method _parse {line} {
lassign [split $line "|"] action type path
lassign [split $line "|"] action path
}
proc {clipboarditem load} {line} {
@ -25,7 +24,7 @@ proc {clipboarditem load} {line} {
clipboard method save {} {
set fd [open $path w]
foreach item $items {
puts $fd "[$item get action]|[$item get type]|[$item get path]"
puts $fd "[$item get action]|[$item get path]"
}
$fd close
}
@ -38,7 +37,7 @@ clipboard method load {} {
foreach line [split [$fd read] "\n"] {
set ci [clipboarditem load $line]
if {[file exists [$ci get path]]} {
lappend $items $ci
lappend items $ci
} else {
set changed 1
}
@ -48,11 +47,41 @@ clipboard method load {} {
return $self
}
clipboard method present {xfile} {
foreach item $items {
if {[$item get path] eq $xfile} {
return 1
}
}
return 0
}
clipboard method index {xfile} {
set index -1
foreach item $items {
incr index
if {[$item get path] eq $xfile} {
return $index
}
}
return -1
}
clipboard method clear {} {
set items {}
}
clipboard method size {} {
return [llength $items]
}
clipboard method add {action type path} {
lappend $items [clipboarditem load "$action|$type|$path"]
clipboard method add {xaction xpath} {
lappend items [clipboarditem load "$xaction|$xpath"]
}
clipboard method remove {xpath} {
set index [$self index $xpath]
if {$index < 0} { return }
set items [lreplace $items $index $index]
}