forked from hummypkg/webif
working towards auto-\*
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1060 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
50346e5d4b
commit
101f5a7946
@ -63,9 +63,30 @@ proc directory {file bfile} {
|
||||
if $noflat { icon "/img/flat-tyre.png" "No-flatten" }
|
||||
}
|
||||
|
||||
set autosqueeze 0
|
||||
if {[file exists "$file/.autosqueeze"]} {
|
||||
set autosqueeze 1
|
||||
icon "/img/compress.png" "Auto-squeeze"
|
||||
}
|
||||
|
||||
set autodedup 0
|
||||
if {[file exists "$file/.autodedup"]} {
|
||||
set autodedup 1
|
||||
icon "/img/dedup.png" "Auto-dedup"
|
||||
}
|
||||
|
||||
set autodecrypt 0
|
||||
if {[file exists "$file/.autodecrypt"]} {
|
||||
set autodecrypt 1
|
||||
icon "/img/decrypt.png" "Auto-decrypt"
|
||||
}
|
||||
|
||||
puts -nonewline "
|
||||
<a href=#>
|
||||
<img class=\"dopt va\" border=0 width=45 "
|
||||
puts -nonewline "autosqueeze=$autosqueeze "
|
||||
puts -nonewline "autodedup=$autodedup "
|
||||
puts -nonewline "autodecrypt=$autodecrypt "
|
||||
if $flatten { puts -nonewline "noflat=$noflat " }
|
||||
puts "
|
||||
src=/images/181_1_00_Help5_OPT_Plus.png>
|
||||
|
@ -45,12 +45,15 @@ puts {
|
||||
<li><a href=#download>Download</a></li>
|
||||
</ul>
|
||||
|
||||
<ul id=doptmenu class=contextMenu style="width: 160px">
|
||||
<ul id=doptmenu class=contextMenu style="width: 180px">
|
||||
<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 class=separator><a href=#resetnew>Reset new flag</a></li>
|
||||
<li class="separator compress"><a href=#squeeze>Auto-Squeeze</a></li>
|
||||
<li class=dedup><a href=#dedup>Auto-Dedup</a></li>
|
||||
<li class=decrypt><a href=#decrypt>Auto-Decrypt</a></li>
|
||||
}
|
||||
|
||||
if $flatten {
|
||||
|
@ -218,9 +218,11 @@ function preparemenu(el, menu)
|
||||
else
|
||||
$(menu).disableContextMenuItems('#crop');
|
||||
|
||||
/*
|
||||
if (el.attr('def') == 'HD')
|
||||
$(menu).disableContextMenuItems('#strip');
|
||||
else
|
||||
*/
|
||||
$(menu).enableContextMenuItems('#strip');
|
||||
|
||||
if (el.attr('rsize') > 4294967296)
|
||||
@ -269,12 +271,6 @@ function preparemenu(el, menu)
|
||||
$(menu).disableContextMenuItems('#lock');
|
||||
//$(menu).disableContextMenuItems('#enc');
|
||||
$(menu).disableContextMenuItems('#new');
|
||||
$(menu).disableContextMenuItems('#decrypt');
|
||||
$(menu).disableContextMenuItems('#audio');
|
||||
$(menu).disableContextMenuItems('#mpg');
|
||||
$(menu).disableContextMenuItems('#crop');
|
||||
$(menu).disableContextMenuItems('#strip');
|
||||
$(menu).disableContextMenuItems('#chunk');
|
||||
}
|
||||
|
||||
}
|
||||
@ -289,6 +285,33 @@ function preparedmenu(el, menu)
|
||||
$(menu).changeContextMenuItem('#flat',
|
||||
'Prevent Flatten');
|
||||
}
|
||||
if (el.attr('autosqueeze') != undefined)
|
||||
{
|
||||
if (el.attr('autosqueeze') > 0)
|
||||
$(menu).changeContextMenuItem('#squeeze',
|
||||
'Disable Auto-squeeze');
|
||||
else
|
||||
$(menu).changeContextMenuItem('#squeeze',
|
||||
'Enable Auto-squeeze');
|
||||
}
|
||||
if (el.attr('autodedup') != undefined)
|
||||
{
|
||||
if (el.attr('autodedup') > 0)
|
||||
$(menu).changeContextMenuItem('#dedup',
|
||||
'Disable Auto-dedup');
|
||||
else
|
||||
$(menu).changeContextMenuItem('#dedup',
|
||||
'Enable Auto-dedup');
|
||||
}
|
||||
if (el.attr('autodecrypt') != undefined)
|
||||
{
|
||||
if (el.attr('autodecrypt') > 0)
|
||||
$(menu).changeContextMenuItem('#decrypt',
|
||||
'Disable Auto-decrypt');
|
||||
else
|
||||
$(menu).changeContextMenuItem('#decrypt',
|
||||
'Enable Auto-decrypt');
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
@ -443,7 +466,26 @@ var dmenuclick = function(action, el, pos)
|
||||
break;
|
||||
|
||||
case 'flat':
|
||||
var url = '/cgi-bin/browse/flat.jim?dir=' + file;
|
||||
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
|
||||
'&flag=noflatten';
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
break;
|
||||
|
||||
case 'dedup':
|
||||
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
|
||||
'&flag=autodedup';
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
break;
|
||||
|
||||
case 'squeeze':
|
||||
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
|
||||
'&flag=autosqueeze';
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
break;
|
||||
|
||||
case 'decrypt':
|
||||
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
|
||||
'&flag=autodecrypt';
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
break;
|
||||
|
||||
|
22
var/mongoose/cgi-bin/browse/flagdir.jim
Executable file
22
var/mongoose/cgi-bin/browse/flagdir.jim
Executable file
@ -0,0 +1,22 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set dir [cgi_get dir]
|
||||
set flag [cgi_get flag]
|
||||
if {![file isdirectory $dir]} { exit }
|
||||
if {[file exists "$dir/.$flag"]} {
|
||||
file delete "$dir/.$flag"
|
||||
puts "Unflagged directory as $flag."
|
||||
} else {
|
||||
close [open "$dir/.$flag" w]
|
||||
puts "Flagged directory as $flag."
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set dir [cgi_get dir]
|
||||
if {![file isdirectory $dir]} { exit }
|
||||
set noflat 0
|
||||
if {[string match {\[*\]} [file tail $dir]]} {
|
||||
set ndir [string range [file tail $dir] 1 end-1]
|
||||
file rename $dir "[file dirname $dir]/$ndir"
|
||||
puts "Unflagged directory as noflatten."
|
||||
exit
|
||||
}
|
||||
if {[file exists "$dir/.noflatten"]} {
|
||||
file delete "$dir/.noflatten"
|
||||
puts "Unflagged directory as noflatten."
|
||||
} else {
|
||||
close [open "$dir/.noflatten" w]
|
||||
puts "Flagged directory as noflatten."
|
||||
}
|
||||
|
57
var/mongoose/html/css/jquery.alerts.css
Normal file
57
var/mongoose/html/css/jquery.alerts.css
Normal file
@ -0,0 +1,57 @@
|
||||
#popup_container {
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
min-width: 300px; /* Dialog will be no smaller than this */
|
||||
max-width: 600px; /* Dialog will wrap after this width */
|
||||
background: #FFF;
|
||||
border: solid 5px #999;
|
||||
color: #000;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#popup_title {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
line-height: 1.75em;
|
||||
color: #666;
|
||||
background: #CCC url(/img/jalert/title.gif) top repeat-x;
|
||||
border: solid 1px #FFF;
|
||||
border-bottom: solid 1px #999;
|
||||
cursor: default;
|
||||
padding: 0em;
|
||||
margin: 0em;
|
||||
}
|
||||
|
||||
#popup_content {
|
||||
background: 16px 16px no-repeat url(/img/jalert/info.gif);
|
||||
padding: 1em 1.75em;
|
||||
margin: 0em;
|
||||
}
|
||||
|
||||
#popup_content.alert {
|
||||
background-image: url(/img/jalert/info.gif);
|
||||
}
|
||||
|
||||
#popup_content.confirm {
|
||||
background-image: url(/img/jalert/important.gif);
|
||||
}
|
||||
|
||||
#popup_content.prompt {
|
||||
background-image: url(/img/jalert/help.gif);
|
||||
}
|
||||
|
||||
#popup_message {
|
||||
padding-left: 48px;
|
||||
}
|
||||
|
||||
#popup_panel {
|
||||
text-align: center;
|
||||
margin: 1em 0em 0em 1em;
|
||||
}
|
||||
|
||||
#popup_prompt {
|
||||
margin: .5em 0em;
|
||||
}
|
@ -65,5 +65,7 @@
|
||||
.contextMenu LI.cut A { background-image: url(/img/context/cut.png); }
|
||||
.contextMenu LI.quit A { background-image: url(/img/context/door.png); }
|
||||
.contextMenu LI.compress A { background-image: url(/img/context/compress.png); }
|
||||
.contextMenu LI.dedup A { background-image: url(/img/context/dedup.png); }
|
||||
.contextMenu LI.decrypt A { background-image: url(/img/context/decrypt.png); }
|
||||
|
||||
|
||||
|
1
var/mongoose/html/img/compress.png
Symbolic link
1
var/mongoose/html/img/compress.png
Symbolic link
@ -0,0 +1 @@
|
||||
context/compress.png
|
BIN
var/mongoose/html/img/context/decrypt.png
Normal file
BIN
var/mongoose/html/img/context/decrypt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 536 B |
BIN
var/mongoose/html/img/context/dedup.png
Normal file
BIN
var/mongoose/html/img/context/dedup.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 612 B |
1
var/mongoose/html/img/decrypt.png
Symbolic link
1
var/mongoose/html/img/decrypt.png
Symbolic link
@ -0,0 +1 @@
|
||||
context/decrypt.png
|
1
var/mongoose/html/img/dedup.png
Symbolic link
1
var/mongoose/html/img/dedup.png
Symbolic link
@ -0,0 +1 @@
|
||||
context/dedup.png
|
BIN
var/mongoose/html/img/jalert/help.gif
Normal file
BIN
var/mongoose/html/img/jalert/help.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
var/mongoose/html/img/jalert/important.gif
Normal file
BIN
var/mongoose/html/img/jalert/important.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
var/mongoose/html/img/jalert/info.gif
Normal file
BIN
var/mongoose/html/img/jalert/info.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
var/mongoose/html/img/jalert/title.gif
Normal file
BIN
var/mongoose/html/img/jalert/title.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 317 B |
235
var/mongoose/html/js/jquery.alerts.js
Normal file
235
var/mongoose/html/js/jquery.alerts.js
Normal file
@ -0,0 +1,235 @@
|
||||
// jQuery Alert Dialogs Plugin
|
||||
//
|
||||
// Version 1.1
|
||||
//
|
||||
// Cory S.N. LaViska
|
||||
// A Beautiful Site (http://abeautifulsite.net/)
|
||||
// 14 May 2009
|
||||
//
|
||||
// Visit http://abeautifulsite.net/notebook/87 for more information
|
||||
//
|
||||
// Usage:
|
||||
// jAlert( message, [title, callback] )
|
||||
// jConfirm( message, [title, callback] )
|
||||
// jPrompt( message, [value, title, callback] )
|
||||
//
|
||||
// History:
|
||||
//
|
||||
// 1.00 - Released (29 December 2008)
|
||||
//
|
||||
// 1.01 - Fixed bug where unbinding would destroy all resize events
|
||||
//
|
||||
// License:
|
||||
//
|
||||
// This plugin is dual-licensed under the GNU General Public License and the MIT License and
|
||||
// is copyright 2008 A Beautiful Site, LLC.
|
||||
//
|
||||
(function($) {
|
||||
|
||||
$.alerts = {
|
||||
|
||||
// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
|
||||
|
||||
verticalOffset: -75, // vertical offset of the dialog from center screen, in pixels
|
||||
horizontalOffset: 0, // horizontal offset of the dialog from center screen, in pixels/
|
||||
repositionOnResize: true, // re-centers the dialog on window resize
|
||||
overlayOpacity: .01, // transparency level of overlay
|
||||
overlayColor: '#FFF', // base color of overlay
|
||||
draggable: true, // make the dialogs draggable (requires UI Draggables plugin)
|
||||
okButton: ' OK ', // text for the OK button
|
||||
cancelButton: ' Cancel ', // text for the Cancel button
|
||||
dialogClass: null, // if specified, this class will be applied to all dialogs
|
||||
|
||||
// Public methods
|
||||
|
||||
alert: function(message, title, callback) {
|
||||
if( title == null ) title = 'Alert';
|
||||
$.alerts._show(title, message, null, 'alert', function(result) {
|
||||
if( callback ) callback(result);
|
||||
});
|
||||
},
|
||||
|
||||
confirm: function(message, title, callback) {
|
||||
if( title == null ) title = 'Confirm';
|
||||
$.alerts._show(title, message, null, 'confirm', function(result) {
|
||||
if( callback ) callback(result);
|
||||
});
|
||||
},
|
||||
|
||||
prompt: function(message, value, title, callback) {
|
||||
if( title == null ) title = 'Prompt';
|
||||
$.alerts._show(title, message, value, 'prompt', function(result) {
|
||||
if( callback ) callback(result);
|
||||
});
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
_show: function(title, msg, value, type, callback) {
|
||||
|
||||
$.alerts._hide();
|
||||
$.alerts._overlay('show');
|
||||
|
||||
$("BODY").append(
|
||||
'<div id="popup_container">' +
|
||||
'<h1 id="popup_title"></h1>' +
|
||||
'<div id="popup_content">' +
|
||||
'<div id="popup_message"></div>' +
|
||||
'</div>' +
|
||||
'</div>');
|
||||
|
||||
if( $.alerts.dialogClass ) $("#popup_container").addClass($.alerts.dialogClass);
|
||||
|
||||
// IE6 Fix
|
||||
var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';
|
||||
|
||||
$("#popup_container").css({
|
||||
position: pos,
|
||||
zIndex: 99999,
|
||||
padding: 0,
|
||||
margin: 0
|
||||
});
|
||||
|
||||
$("#popup_title").text(title);
|
||||
$("#popup_content").addClass(type);
|
||||
$("#popup_message").text(msg);
|
||||
$("#popup_message").html( $("#popup_message").text().replace(/\n/g, '<br />') );
|
||||
|
||||
$("#popup_container").css({
|
||||
minWidth: $("#popup_container").outerWidth(),
|
||||
maxWidth: $("#popup_container").outerWidth()
|
||||
});
|
||||
|
||||
$.alerts._reposition();
|
||||
$.alerts._maintainPosition(true);
|
||||
|
||||
switch( type ) {
|
||||
case 'alert':
|
||||
$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /></div>');
|
||||
$("#popup_ok").click( function() {
|
||||
$.alerts._hide();
|
||||
callback(true);
|
||||
});
|
||||
$("#popup_ok").focus().keypress( function(e) {
|
||||
if( e.keyCode == 13 || e.keyCode == 27 ) $("#popup_ok").trigger('click');
|
||||
});
|
||||
break;
|
||||
case 'confirm':
|
||||
$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
|
||||
$("#popup_ok").click( function() {
|
||||
$.alerts._hide();
|
||||
if( callback ) callback(true);
|
||||
});
|
||||
$("#popup_cancel").click( function() {
|
||||
$.alerts._hide();
|
||||
if( callback ) callback(false);
|
||||
});
|
||||
$("#popup_ok").focus();
|
||||
$("#popup_ok, #popup_cancel").keypress( function(e) {
|
||||
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
|
||||
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
|
||||
});
|
||||
break;
|
||||
case 'prompt':
|
||||
$("#popup_message").append('<br /><input type="text" size="30" id="popup_prompt" />').after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
|
||||
$("#popup_prompt").width( $("#popup_message").width() );
|
||||
$("#popup_ok").click( function() {
|
||||
var val = $("#popup_prompt").val();
|
||||
$.alerts._hide();
|
||||
if( callback ) callback( val );
|
||||
});
|
||||
$("#popup_cancel").click( function() {
|
||||
$.alerts._hide();
|
||||
if( callback ) callback( null );
|
||||
});
|
||||
$("#popup_prompt, #popup_ok, #popup_cancel").keypress( function(e) {
|
||||
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
|
||||
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
|
||||
});
|
||||
if( value ) $("#popup_prompt").val(value);
|
||||
$("#popup_prompt").focus().select();
|
||||
break;
|
||||
}
|
||||
|
||||
// Make draggable
|
||||
if( $.alerts.draggable ) {
|
||||
try {
|
||||
$("#popup_container").draggable({ handle: $("#popup_title") });
|
||||
$("#popup_title").css({ cursor: 'move' });
|
||||
} catch(e) { /* requires jQuery UI draggables */ }
|
||||
}
|
||||
},
|
||||
|
||||
_hide: function() {
|
||||
$("#popup_container").remove();
|
||||
$.alerts._overlay('hide');
|
||||
$.alerts._maintainPosition(false);
|
||||
},
|
||||
|
||||
_overlay: function(status) {
|
||||
switch( status ) {
|
||||
case 'show':
|
||||
$.alerts._overlay('hide');
|
||||
$("BODY").append('<div id="popup_overlay"></div>');
|
||||
$("#popup_overlay").css({
|
||||
position: 'absolute',
|
||||
zIndex: 99998,
|
||||
top: '0px',
|
||||
left: '0px',
|
||||
width: '100%',
|
||||
height: $(document).height(),
|
||||
background: $.alerts.overlayColor,
|
||||
opacity: $.alerts.overlayOpacity
|
||||
});
|
||||
break;
|
||||
case 'hide':
|
||||
$("#popup_overlay").remove();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_reposition: function() {
|
||||
var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
|
||||
var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
|
||||
if( top < 0 ) top = 0;
|
||||
if( left < 0 ) left = 0;
|
||||
|
||||
// IE6 fix
|
||||
if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
|
||||
|
||||
$("#popup_container").css({
|
||||
top: top + 'px',
|
||||
left: left + 'px'
|
||||
});
|
||||
$("#popup_overlay").height( $(document).height() );
|
||||
},
|
||||
|
||||
_maintainPosition: function(status) {
|
||||
if( $.alerts.repositionOnResize ) {
|
||||
switch(status) {
|
||||
case true:
|
||||
$(window).bind('resize', $.alerts._reposition);
|
||||
break;
|
||||
case false:
|
||||
$(window).unbind('resize', $.alerts._reposition);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Shortuct functions
|
||||
jAlert = function(message, title, callback) {
|
||||
$.alerts.alert(message, title, callback);
|
||||
}
|
||||
|
||||
jConfirm = function(message, title, callback) {
|
||||
$.alerts.confirm(message, title, callback);
|
||||
};
|
||||
|
||||
jPrompt = function(message, value, title, callback) {
|
||||
$.alerts.prompt(message, value, title, callback);
|
||||
};
|
||||
|
||||
})(jQuery);
|
Loading…
Reference in New Issue
Block a user