add editor
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@753 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
955217bdd2
commit
aadac18796
@ -217,6 +217,7 @@ puts {
|
|||||||
<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 />
|
<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>
|
<script type=text/javascript src=/cgi-bin/browse/browse.js></script>
|
||||||
<link type=text/css rel=stylesheet href=/cgi-bin/browse/style.css />
|
<link type=text/css rel=stylesheet href=/cgi-bin/browse/style.css />
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,3 @@
|
|||||||
(function($)
|
|
||||||
{
|
|
||||||
$.fn.enable = function()
|
|
||||||
{
|
|
||||||
return this.each(function() {
|
|
||||||
$(this)
|
|
||||||
.removeClass('ui-state-disabled')
|
|
||||||
.removeProp('disabled');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$.fn.disable = function()
|
|
||||||
{
|
|
||||||
return this.each(function() {
|
|
||||||
$(this)
|
|
||||||
.addClass('ui-state-disabled')
|
|
||||||
.prop('disabled', true);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
})(jQuery);
|
|
||||||
|
|
||||||
var dir;
|
var dir;
|
||||||
|
|
||||||
|
43
var/mongoose/cgi-bin/edit/edit.jim
Executable file
43
var/mongoose/cgi-bin/edit/edit.jim
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/mod/bin/jimsh
|
||||||
|
|
||||||
|
package require cgi
|
||||||
|
source /mod/var/mongoose/lib/setup
|
||||||
|
|
||||||
|
puts "Content-Type: text/html"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
header
|
||||||
|
|
||||||
|
cgi_input
|
||||||
|
#cgi_dump
|
||||||
|
set file [cgi_get file "/tmp/hosts"]
|
||||||
|
|
||||||
|
puts "
|
||||||
|
<script type=text/javascript src=/js/enadis.js></script>
|
||||||
|
<script type=text/javascript src=/js/tabsupport.js></script>
|
||||||
|
<script type=text/javascript src=script.js></script>
|
||||||
|
<link rel=stylesheet href=style.css type=text/css />
|
||||||
|
|
||||||
|
<fieldset class=cleft>
|
||||||
|
<legend>File Editor</legend>
|
||||||
|
<div class=blood style=\"padding-bottom: 0.7em\">
|
||||||
|
Editing: <span id=filename>$file</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<textarea cols=80 rows=15 id=editor class=loading>
|
||||||
|
|
||||||
|
Loading file...
|
||||||
|
|
||||||
|
</textarea>
|
||||||
|
<br>
|
||||||
|
<button class=afterload id=revert>Revert</button>
|
||||||
|
<button class=afterload id=save>Save</button>
|
||||||
|
<div id=result class=\"blood hidden\"></div>
|
||||||
|
</fieldset>
|
||||||
|
<div class=cleft>
|
||||||
|
<button id=back>Back to diagnostics</button>
|
||||||
|
</div>
|
||||||
|
"
|
||||||
|
|
||||||
|
footer
|
||||||
|
|
24
var/mongoose/cgi-bin/edit/get.jim
Executable file
24
var/mongoose/cgi-bin/edit/get.jim
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/mod/bin/jimsh
|
||||||
|
|
||||||
|
package require cgi
|
||||||
|
source /mod/var/mongoose/lib/setup
|
||||||
|
require chunked
|
||||||
|
|
||||||
|
cgi_input
|
||||||
|
#cgi_dump
|
||||||
|
|
||||||
|
set file [cgi_get file "/tmp/hosts"]
|
||||||
|
if {$file eq "-"} { exit }
|
||||||
|
|
||||||
|
start_chunked
|
||||||
|
|
||||||
|
if {![file exists $file]} {
|
||||||
|
chunk ">>> File $file does not exist.\r\n"
|
||||||
|
} else {
|
||||||
|
set fp [open $file r]
|
||||||
|
chunk [read $fp]
|
||||||
|
close $fp
|
||||||
|
}
|
||||||
|
|
||||||
|
end_chunked
|
||||||
|
|
23
var/mongoose/cgi-bin/edit/put.jim
Executable file
23
var/mongoose/cgi-bin/edit/put.jim
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/mod/bin/jimsh
|
||||||
|
|
||||||
|
package require cgi
|
||||||
|
source /mod/var/mongoose/lib/setup
|
||||||
|
|
||||||
|
puts "Content-Type: text/html"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
cgi_input
|
||||||
|
#cgi_dump
|
||||||
|
|
||||||
|
set file [cgi_get file "/tmp/testfile"]
|
||||||
|
if {$file eq "-"} { exit }
|
||||||
|
set data [cgi_get data]
|
||||||
|
|
||||||
|
if {[catch {set fp [open $file w]} msg]} {
|
||||||
|
puts "Error, $msg"
|
||||||
|
} else {
|
||||||
|
$fp puts -nonewline $data
|
||||||
|
close $fp
|
||||||
|
puts "File saved."
|
||||||
|
}
|
||||||
|
|
51
var/mongoose/cgi-bin/edit/script.js
Normal file
51
var/mongoose/cgi-bin/edit/script.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
|
||||||
|
$(function() {
|
||||||
|
|
||||||
|
var file = $('#filename').text();
|
||||||
|
|
||||||
|
function loadfile()
|
||||||
|
{
|
||||||
|
$('button.afterload').disable();
|
||||||
|
$('#editor')
|
||||||
|
.addClass('loading')
|
||||||
|
.val('Loading file...');
|
||||||
|
$.get('get.jim?file=' + encodeURIComponent(file), function(data) {
|
||||||
|
$('#editor')
|
||||||
|
.removeClass('loading')
|
||||||
|
.val(data);
|
||||||
|
$('button.afterload').enable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#save')
|
||||||
|
.button()
|
||||||
|
.click(function() {
|
||||||
|
$.post('put.jim', {
|
||||||
|
'file': file,
|
||||||
|
'data': $('#editor').val()
|
||||||
|
}, function(data) {
|
||||||
|
$('#result')
|
||||||
|
.html(data)
|
||||||
|
.slideDown('slow')
|
||||||
|
.delay(5000)
|
||||||
|
.slideUp('slow');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#revert')
|
||||||
|
.button()
|
||||||
|
.click(function() {
|
||||||
|
loadfile();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#back')
|
||||||
|
.button()
|
||||||
|
.click(function() {
|
||||||
|
window.location = '/diag.shtml';
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#editor').tabsupport();
|
||||||
|
loadfile();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
18
var/mongoose/cgi-bin/edit/style.css
Normal file
18
var/mongoose/cgi-bin/edit/style.css
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
textarea
|
||||||
|
{
|
||||||
|
background: white;
|
||||||
|
font-color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
#filename
|
||||||
|
{
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading
|
||||||
|
{
|
||||||
|
font-style: italic;
|
||||||
|
color: #aaa;
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
|||||||
<!--#include virtual="/lib/header.shtml" -->
|
<!--#include virtual="/lib/header.shtml" -->
|
||||||
|
|
||||||
<fieldset style="display: inline; float: left; clear: left">
|
<script type=text/javascript src=/js/enadis.js></script>
|
||||||
|
|
||||||
|
<fieldset class=cleft>
|
||||||
<legend>Diagnostics</legend>
|
<legend>Diagnostics</legend>
|
||||||
Diagnostic:
|
Diagnostic:
|
||||||
<input name=seq id=seq autocorrect=off autocapitalize=off
|
<input name=seq id=seq autocorrect=off autocapitalize=off
|
||||||
@ -9,7 +11,16 @@ Diagnostic:
|
|||||||
<button id=rundiag>Run Diagnostic</button>
|
<button id=rundiag>Run Diagnostic</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset style="display: inline; float: left; clear: left">
|
<fieldset class=cleft>
|
||||||
|
<legend>File Editor</legend>
|
||||||
|
File:
|
||||||
|
<input name=editfile id=editfile autocorrect=off autocapitalize=off
|
||||||
|
value='' size=30 maxlength=50
|
||||||
|
class="text ui-widget-content ui-corner-all">
|
||||||
|
<button id=runedit>Edit File</button>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class=cleft>
|
||||||
<legend>Log Files</legend>
|
<legend>Log Files</legend>
|
||||||
<!--#exec cmd="/mod/var/mongoose/include/logfiles.jim" -->
|
<!--#exec cmd="/mod/var/mongoose/include/logfiles.jim" -->
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@ -27,6 +38,14 @@ $('#rundiag').button().click(function() {
|
|||||||
$('#results').wrapInner('<pre>');
|
$('#results').wrapInner('<pre>');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#runedit').button().click(function() {
|
||||||
|
if ($('#editfile').val().length)
|
||||||
|
window.location = '/cgi-bin/edit/edit.jim?file=' +
|
||||||
|
encodeURIComponent($('#editfile').val());
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$('a.log').click(function() {
|
$('a.log').click(function() {
|
||||||
$('#results')
|
$('#results')
|
||||||
.slideDown()
|
.slideDown()
|
||||||
|
20
var/mongoose/html/js/enadis.js
Executable file
20
var/mongoose/html/js/enadis.js
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
(function($)
|
||||||
|
{
|
||||||
|
$.fn.enable = function()
|
||||||
|
{
|
||||||
|
return this.each(function() {
|
||||||
|
$(this)
|
||||||
|
.removeClass('ui-state-disabled')
|
||||||
|
.removeProp('disabled');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$.fn.disable = function()
|
||||||
|
{
|
||||||
|
return this.each(function() {
|
||||||
|
$(this)
|
||||||
|
.addClass('ui-state-disabled')
|
||||||
|
.prop('disabled', true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
})(jQuery);
|
23
var/mongoose/html/js/tabsupport.js
Normal file
23
var/mongoose/html/js/tabsupport.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
(function($)
|
||||||
|
{
|
||||||
|
$.fn.tabsupport = function()
|
||||||
|
{
|
||||||
|
return this.each(function() {
|
||||||
|
$(this).keydown(function(e) {
|
||||||
|
if (e.keyCode == 9)
|
||||||
|
{
|
||||||
|
var el = $(this).get(0);
|
||||||
|
var start = el.selectionStart;
|
||||||
|
var end = el.selectionEnd;
|
||||||
|
$(this).val(
|
||||||
|
$(this).val().substring(0, start) +
|
||||||
|
"\t" +
|
||||||
|
$(this).val().substring(end)
|
||||||
|
);
|
||||||
|
el.selectionStart = el.selectionEnd = start + 1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})(jQuery);
|
Loading…
x
Reference in New Issue
Block a user