Add file download function
This commit is contained in:
parent
bffd4d7cad
commit
ab00afa513
@ -5,8 +5,18 @@ class HomeController < ApplicationController
|
|||||||
@current_dir = "/mnt"
|
@current_dir = "/mnt"
|
||||||
file_directory(@current_dir)
|
file_directory(@current_dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def file_download
|
||||||
|
@file_name = params[:file_name]
|
||||||
|
puts "file_name: " + @file_name
|
||||||
|
if File.exist?(@file_name)
|
||||||
|
#File.delete(@file_name)
|
||||||
|
puts "file exist!!"
|
||||||
|
send_file(@file_name)
|
||||||
|
puts "send success"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def make_directory
|
def make_directory
|
||||||
current_dir = params[:current_dir]
|
current_dir = params[:current_dir]
|
||||||
directory_name = params[:directory_name]
|
directory_name = params[:directory_name]
|
||||||
@ -14,8 +24,7 @@ class HomeController < ApplicationController
|
|||||||
`sudo mkdir #{current_dir}/#{directory_name}`
|
`sudo mkdir #{current_dir}/#{directory_name}`
|
||||||
redirect_to '/home/index'
|
redirect_to '/home/index'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def delete_file
|
def delete_file
|
||||||
file_name = params[:file_name]
|
file_name = params[:file_name]
|
||||||
puts "rm #{file_name} -rf"
|
puts "rm #{file_name} -rf"
|
||||||
|
@ -1,401 +1,440 @@
|
|||||||
<!-- right click menu -->
|
<!-- right click menu -->
|
||||||
<div class="contextmenu Del_dir">
|
<div class="contextmenu Del_dir">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="menuitem"><i class="fa fa-trash"></i>Delete</li>
|
<li class="menuitem"><i class="fa fa-trash"></i>Delete</li>
|
||||||
<input id="delete_name" type="hidden"></input>
|
<input id="delete_name" type="hidden"></input>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- create overlay page -->
|
<!-- create overlay page -->
|
||||||
<div id="popup_mkdir" class="overlay">
|
<div id="popup_mkdir" class="overlay">
|
||||||
<div class="popup">
|
<div class="popup">
|
||||||
<h2> Make Directory </h2>
|
<h2> Make Directory </h2>
|
||||||
<a class="close" href="#">×</a>
|
<a class="close" href="#">×</a>
|
||||||
|
|
||||||
<form id="form_make_directory" data-parsley-validate class="form-horizontal form-label-left" action="/home/mkdir" method="post">
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="current-dir">Current Directory <span class="required">*</span>
|
|
||||||
</label>
|
|
||||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
|
||||||
<input type="text" id="current-dir" required="required" class="form-control col-md-7 col-xs-12" name="current_dir" value="<%=@current_dir%>" readonly/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="directory-name">Directory Name<span class="required">*</span>
|
|
||||||
</label>
|
|
||||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
|
||||||
<input type="text" id="directory-name" required="required" class="form-control col-md-7 col-xs-12" name="directory_name" placeholder="Directory name"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="ln_solid"></div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
|
|
||||||
<button type="submit" class="btn btn-success">Submit</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<form id="form_make_directory" data-parsley-validate class="form-horizontal form-label-left" action="/home/mkdir" method="post">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="current-dir">Current Directory <span class="required">*</span>
|
||||||
|
</label>
|
||||||
|
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||||
|
<input type="text" id="current-dir" required="required" class="form-control col-md-7 col-xs-12" name="current_dir" value="<%=@current_dir%>" readonly/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="directory-name">Directory Name<span class="required">*</span>
|
||||||
|
</label>
|
||||||
|
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||||
|
<input type="text" id="directory-name" required="required" class="form-control col-md-7 col-xs-12" name="directory_name" placeholder="Directory name"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ln_solid"></div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
|
||||||
|
<button type="submit" class="btn btn-success">Submit</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- page content -->
|
<!-- page content -->
|
||||||
<div class="right_col" role="main">
|
<div class="right_col" role="main">
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
<div class="title_left">
|
<div class="title_left">
|
||||||
<h3>Dash Board</h3>
|
<h3>Dash Board</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="title_right">
|
<div class="title_right">
|
||||||
<div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
|
<div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" placeholder="Search for...">
|
<input type="text" class="form-control" placeholder="Search for...">
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button class="btn btn-default" type="button">Go!</button>
|
<button class="btn btn-default" type="button">Go!</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="clearfix"></div>
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="x_panel">
|
|
||||||
<div class="x_title">
|
|
||||||
<h2>Input knob</h2>
|
|
||||||
<ul class="nav navbar-right panel_toolbox">
|
|
||||||
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
|
|
||||||
<li class="dropdown">
|
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
|
|
||||||
<ul class="dropdown-menu" role="menu">
|
|
||||||
<li><a href="#">Settings 1</a></li>
|
|
||||||
<li><a href="#">Settings 2</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li><a class="close-link"><i class="fa fa-close"></i></a></li>
|
|
||||||
</ul>
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
</div>
|
|
||||||
<div class="x_content">
|
|
||||||
<div class="col-md-2">
|
|
||||||
<p>Display value</p>
|
|
||||||
<input class="knob" data-width="100" data-height="120" data-min="-100" data-displayPrevious=true data-fgColor="#26B99A" value="44">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<p>× 'cursor' mode</p>
|
|
||||||
<input class="knob" data-width="100" data-height="120" data-cursor=true data-fgColor="#34495E" value="29">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<p>Step 0.1</p>
|
|
||||||
<input class="knob" data-width="100" data-height="120" data-min="-10000" data-displayPrevious=true data-fgColor="#26B99A" data-max="10000" data-step=".1" value="0">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<p>Angle arc</p>
|
|
||||||
<input class="knob" data-width="100" data-height="120" data-angleOffset=-125 data-angleArc=250 data-fgColor="#34495E" data-rotation="anticlockwise" value="35">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<p>Alternate design</p>
|
|
||||||
<input class="knob" data-width="110" data-height="120" data-displayPrevious=true data-fgColor="#26B99A" data-skin="tron" data-thickness=".2" value="75">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<p>Angle offset</p>
|
|
||||||
<input class="knob" data-width="100" data-height="120" data-angleOffset=90 data-linecap=round data-fgColor="#26B99A" value="35">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
|
||||||
<div class="x_panel">
|
|
||||||
<div class="x_title">
|
|
||||||
<h2>File Manager</h2>
|
|
||||||
<ul class="nav navbar-right panel_toolbox">
|
|
||||||
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
|
|
||||||
</li>
|
|
||||||
<li class="dropdown">
|
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
|
|
||||||
<ul class="dropdown-menu" role="menu">
|
|
||||||
<li><a href="#">Settings 1</a>
|
|
||||||
</li>
|
|
||||||
<li><a href="#">Settings 2</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li><a class="close-link"><i class="fa fa-close"></i></a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="x_content">
|
|
||||||
|
|
||||||
<div class="col-md-12 col-sm-12 col-xs-12" id="table_div">
|
|
||||||
<p class="text-muted font-13 m-b-30"> <code> Current directory : <span id="select_dir"><%=@current_dir%></span></code></p>
|
|
||||||
<p style="text-align:right;" >
|
|
||||||
<a class="btn btn-default" href="#popup_mkdir"><i class="fa fa-plus"></i> Make Directory</a>
|
|
||||||
</p>
|
|
||||||
<table id="datatable" class="table table-striped table-bordered jambo_table">
|
|
||||||
<thead>
|
|
||||||
<tr class="headings">
|
|
||||||
<th>Name</th>
|
|
||||||
<th>auth</th>
|
|
||||||
<th>Size</th>
|
|
||||||
<th>Date</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody id="datatable_body">
|
<div class="row">
|
||||||
<tr>
|
<div class="col-md-12">
|
||||||
<td><i class="fa fa-reply"></i>
|
<div class="x_panel">
|
||||||
<a style='cursor: pointer' onclick="change_upper('<%=@current_dir%>')"> ..</a>
|
<div class="x_title">
|
||||||
</td>
|
<h2>Input knob</h2>
|
||||||
<td></td>
|
<ul class="nav navbar-right panel_toolbox">
|
||||||
<td></td>
|
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
|
||||||
<td></td>
|
<li class="dropdown">
|
||||||
</tr>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
|
||||||
<%@files.each do |t|%>
|
<ul class="dropdown-menu" role="menu">
|
||||||
<tr class="dir_delete">
|
<li><a href="#">Settings 1</a></li>
|
||||||
<% if t["auth"][0]=='d'%>
|
<li><a href="#">Settings 2</a></li>
|
||||||
<td style="color:#0d8ade;"><i class="fa fa-folder-open-o"></i>
|
</ul>
|
||||||
<a style="cursor: pointer" onclick="change_directory('<%=@current_dir + "/" + t["name"]%>')"> <%=t["name"]%></a>
|
</li>
|
||||||
</td>
|
<li><a class="close-link"><i class="fa fa-close"></i></a></li>
|
||||||
<% else %>
|
</ul>
|
||||||
<td><i class="fa fa-file-o"></i>
|
<div class="clearfix"></div>
|
||||||
<a style="cursor: pointer"><%=t["name"]%></a>
|
</div>
|
||||||
</td>
|
<div class="x_content">
|
||||||
<% end %>
|
<div class="col-md-2">
|
||||||
<td><%=t["auth"]%></td>
|
<p>Display value</p>
|
||||||
<td><%=t["size"]%></td>
|
<input class="knob" data-width="100" data-height="120" data-min="-100" data-displayPrevious=true data-fgColor="#26B99A" value="44">
|
||||||
<td><%=t["date"]%></td>
|
</div>
|
||||||
</tr>
|
<div class="col-md-2">
|
||||||
<%end%>
|
<p>× 'cursor' mode</p>
|
||||||
</tbody>
|
<input class="knob" data-width="100" data-height="120" data-cursor=true data-fgColor="#34495E" value="29">
|
||||||
</table>
|
</div>
|
||||||
</div>
|
<div class="col-md-2">
|
||||||
</div>
|
<p>Step 0.1</p>
|
||||||
</div>
|
<input class="knob" data-width="100" data-height="120" data-min="-10000" data-displayPrevious=true data-fgColor="#26B99A" data-max="10000" data-step=".1" value="0">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
</div>
|
<p>Angle arc</p>
|
||||||
</div>
|
<input class="knob" data-width="100" data-height="120" data-angleOffset=-125 data-angleArc=250 data-fgColor="#34495E" data-rotation="anticlockwise" value="35">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<p>Alternate design</p>
|
||||||
|
<input class="knob" data-width="110" data-height="120" data-displayPrevious=true data-fgColor="#26B99A" data-skin="tron" data-thickness=".2" value="75">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<p>Angle offset</p>
|
||||||
|
<input class="knob" data-width="100" data-height="120" data-angleOffset=90 data-linecap=round data-fgColor="#26B99A" value="35">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||||
|
<div class="x_panel">
|
||||||
|
<div class="x_title">
|
||||||
|
<h2>File Manager</h2>
|
||||||
|
<ul class="nav navbar-right panel_toolbox">
|
||||||
|
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><a href="#">Settings 1</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="#">Settings 2</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a class="close-link"><i class="fa fa-close"></i></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="x_content">
|
||||||
|
|
||||||
|
<div class="col-md-12 col-sm-12 col-xs-12" id="table_div">
|
||||||
|
<p class="text-muted font-13 m-b-30"> <code> Current directory : <span id="select_dir"><%=@current_dir%></span></code></p>
|
||||||
|
<p style="text-align:right;" >
|
||||||
|
<a class="btn btn-default" href="#popup_mkdir"><i class="fa fa-plus"></i> Make Directory</a>
|
||||||
|
</p>
|
||||||
|
<table id="datatable" class="table table-striped table-bordered jambo_table">
|
||||||
|
<thead>
|
||||||
|
<tr class="headings">
|
||||||
|
<th>Name</th>
|
||||||
|
<th>auth</th>
|
||||||
|
<th>Size</th>
|
||||||
|
<th>Date</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody id="datatable_body">
|
||||||
|
<tr>
|
||||||
|
<td><i class="fa fa-reply"></i>
|
||||||
|
<a style='cursor: pointer' onclick="change_upper('<%=@current_dir%>')"> ..</a>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<%@files.each do |t|%>
|
||||||
|
<tr class="dir_delete">
|
||||||
|
<% if t["auth"][0]=='d'%>
|
||||||
|
<td style="color:#0d8ade;"><i class="fa fa-folder-open-o"></i>
|
||||||
|
<a style="cursor: pointer" onclick="change_directory('<%=@current_dir + "/" + t["name"]%>')"> <%=t["name"]%></a>
|
||||||
|
</td>
|
||||||
|
<% else %>
|
||||||
|
<td>
|
||||||
|
<form class="form_file_download" data-parsley-validate>
|
||||||
|
<i class="fa fa-file-o"></i>
|
||||||
|
<input type="hidden", value="<%=@current_dir + '/' + t['name']%>">
|
||||||
|
<button type="submit" style="border: none; background: none;"><%=t["name"]%></button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
|
<td><%=t["auth"]%></td>
|
||||||
|
<td><%=t["size"]%></td>
|
||||||
|
<td><%=t["date"]%></td>
|
||||||
|
</tr>
|
||||||
|
<%end%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /page content -->
|
<!-- /page content -->
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#datatable').dataTable();
|
$('#datatable').dataTable();
|
||||||
right_click();
|
right_click();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function right_click(){
|
function right_click(){
|
||||||
/* right click */
|
/* right click */
|
||||||
$(".menuitem").mouseover(function(e){
|
$(".menuitem").mouseover(function(e){
|
||||||
var $el = $(this);
|
var $el = $(this);
|
||||||
if ( !$el.hasClass('hover'))
|
if ( !$el.hasClass('hover'))
|
||||||
$el.addClass('hover');
|
$el.addClass('hover');
|
||||||
}).mouseout(function(e){
|
}).mouseout(function(e){
|
||||||
var $el = $(this);
|
var $el = $(this);
|
||||||
if($el.hasClass('hover'))
|
if($el.hasClass('hover'))
|
||||||
$el.removeClass('hover');
|
$el.removeClass('hover');
|
||||||
});
|
});
|
||||||
|
|
||||||
//Contextmenu
|
//Contextmenu
|
||||||
$(".dir_delete").on('contextmenu', function(event) {
|
$(".dir_delete").on('contextmenu', function(event) {
|
||||||
ShowContextMenu("Del_dir");
|
ShowContextMenu("Del_dir");
|
||||||
var Row = this;
|
var Row = this;
|
||||||
var Cells = Row.getElementsByTagName("td");
|
var Cells = Row.getElementsByTagName("td");
|
||||||
var file_name = Cells[0].innerText;
|
var file_name = Cells[0].innerText;
|
||||||
file_name = file_name.replace(' ', '');
|
file_name = file_name.replace(' ', '');
|
||||||
$("#delete_name").val($("#select_dir").text() + "/" + file_name);
|
$("#delete_name").val($("#select_dir").text() + "/" + file_name);
|
||||||
CheckLocation();
|
CheckLocation();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(".Del_dir").click(function(e){
|
$(".Del_dir").click(function(e){
|
||||||
$(location).attr('href', "#loading");
|
$(location).attr('href', "#loading");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/home/delete",
|
url: "/home/delete",
|
||||||
data: { file_name: $("#delete_name").val() },
|
data: { file_name: $("#delete_name").val() },
|
||||||
success : function(result){
|
success : function(result){
|
||||||
change_directory($("#select_dir").text());
|
change_directory($("#select_dir").text());
|
||||||
$(location).attr('href', "#");
|
$(location).attr('href', "#");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$(".contextmenu").hide();
|
$(".contextmenu").hide();
|
||||||
$(document).unbind('mousedown');
|
$(document).unbind('mousedown');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<!-- file manager functions -->
|
<!-- file manager functions -->
|
||||||
<script>
|
<script>
|
||||||
function change_upper(directory){
|
function change_upper(directory){
|
||||||
if(directory == "/") return;
|
if(directory == "/") return;
|
||||||
var lastindex = directory.lastIndexOf("/");
|
var lastindex = directory.lastIndexOf("/");
|
||||||
if(lastindex == 0) lastindex++;
|
if(lastindex == 0) lastindex++;
|
||||||
change_directory(directory.substring(0, lastindex));
|
change_directory(directory.substring(0, lastindex));
|
||||||
}
|
}
|
||||||
|
|
||||||
function change_directory(directory){
|
function change_directory(directory){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/application/changeDir",
|
url: "/application/changeDir",
|
||||||
data: { path: directory },
|
data: { path: directory },
|
||||||
success : function(result){
|
success : function(result){
|
||||||
$("#current-dir").val(directory);
|
$("#current-dir").val(directory);
|
||||||
$("#table_div").empty();
|
$("#table_div").empty();
|
||||||
var new_table = "";
|
var new_table = "";
|
||||||
new_table += "<p class='text-muted font-13 m-b-30'><code>Current directory : <span id='select_dir'>" + directory+"</span></code></p>";
|
new_table += "<p class='text-muted font-13 m-b-30'><code>Current directory : <span id='select_dir'>" + directory+"</span></code></p>";
|
||||||
new_table += "<p style='text-align:right;'><a class='btn btn-default' href='#popup_mkdir'><i class='fa fa-plus'></i> Make Directory</a></p>";
|
new_table += "<p style='text-align:right;'><a class='btn btn-default' href='#popup_mkdir'><i class='fa fa-plus'></i> Make Directory</a></p>";
|
||||||
new_table += "<table id='datatable' class='table table-striped table-bordered jambo_table'>";
|
new_table += "<table id='datatable' class='table table-striped table-bordered jambo_table'>";
|
||||||
new_table += "<thead>";
|
new_table += "<thead>";
|
||||||
new_table += "<tr class='headings'>";
|
new_table += "<tr class='headings'>";
|
||||||
new_table += "<th>Name</th>";
|
new_table += "<th>Name</th>";
|
||||||
new_table += "<th>Auth</th>";
|
new_table += "<th>Auth</th>";
|
||||||
new_table += "<th>Size</th>";
|
new_table += "<th>Size</th>";
|
||||||
new_table += "<th>Date</th>";
|
new_table += "<th>Date</th>";
|
||||||
new_table += "</tr>";
|
new_table += "</tr>";
|
||||||
new_table += "</thead>";
|
new_table += "</thead>";
|
||||||
new_table += "<tbody id='datatable_body'>";
|
new_table += "<tbody id='datatable_body'>";
|
||||||
|
|
||||||
var new_tr = "";
|
var new_tr = "";
|
||||||
new_tr += "<tr role='row' class='odd'> <td><i class='fa fa-reply'></i>";
|
new_tr += "<tr role='row' class='odd'> <td><i class='fa fa-reply'></i>";
|
||||||
new_tr += "<a style='cursor: pointer' onclick='change_upper(" + '"' + directory + '"' +")'> ..</a>";
|
new_tr += "<a style='cursor: pointer' onclick='change_upper(" + '"' + directory + '"' +")'> ..</a>";
|
||||||
new_tr += "</td><td> </td><td> </td><td> </td></tr>";
|
new_tr += "</td><td> </td><td> </td><td> </td></tr>";
|
||||||
|
|
||||||
for( var i = 0; i < result.file.length; i++){
|
for( var i = 0; i < result.file.length; i++){
|
||||||
var row_class = i % 2 == 0 ? 'odd' : 'even';
|
var row_class = i % 2 == 0 ? 'odd' : 'even';
|
||||||
var cur = result.current != "/" ? result.current : '';
|
var cur = result.current != "/" ? result.current : '';
|
||||||
new_tr += "<tr role='row' class='dir_delete' class='" + row_class + "'>";
|
new_tr += "<tr role='row' class='dir_delete' class='" + row_class + "'>";
|
||||||
if(result.file[i].auth[0] == "d"){
|
if(result.file[i].auth[0] == "d"){
|
||||||
new_tr += "<td style='color:#0d8ade;' class='sorting_1'><i class='fa fa-folder-open-o'></i> ";
|
new_tr += "<td style='color:#0d8ade;' class='sorting_1'><i class='fa fa-folder-open-o'></i> ";
|
||||||
new_tr += "<a style='cursor: pointer' onclick='change_directory(" +'"' + cur + "/" + result.file[i].name +'"'+ ")'>" + result.file[i].name + "</a></td>";
|
new_tr += "<a style='cursor: pointer' onclick='change_directory(" +'"' + cur + "/" + result.file[i].name +'"'+ ")'>" + result.file[i].name + "</a></td>";
|
||||||
}else{
|
}else{
|
||||||
new_tr += "<td><i class='fa fa-file-o'></i><a style='cursor: pointer'> " + result.file[i].name + "</a></td>";
|
new_tr += "<td>";
|
||||||
}
|
new_tr += "<form class='form_file_download' data-parsley-validate>";
|
||||||
new_tr += "<td>"+result.file[i].auth+"</td>";
|
new_tr += "<i class='fa fa-file-o'></i>";
|
||||||
new_tr += "<td>"+result.file[i].size+"</td>";
|
new_tr += "<input type='hidden', value='" + cur + "/" + result.file[i].name + "'>";
|
||||||
new_tr += "<td>"+result.file[i].date+"</td>";
|
new_tr += "<button type='submit' style='border: none; background: none;'>" + result.file[i].name + "</button>";
|
||||||
new_tr += "</tr>";
|
new_tr += "</form>";
|
||||||
}
|
new_tr += "</td>";
|
||||||
new_table += new_tr;
|
}
|
||||||
new_table += "</tbody></table>"
|
new_tr += "<td>"+result.file[i].auth+"</td>";
|
||||||
$("#table_div").append(new_table);
|
new_tr += "<td>"+result.file[i].size+"</td>";
|
||||||
$('#datatable').dataTable();
|
new_tr += "<td>"+result.file[i].date+"</td>";
|
||||||
right_click();
|
new_tr += "</tr>";
|
||||||
}
|
}
|
||||||
})
|
new_table += new_tr;
|
||||||
}
|
new_table += "</tbody></table>"
|
||||||
|
$("#table_div").append(new_table);
|
||||||
|
$('#datatable').dataTable();
|
||||||
</script>
|
right_click();
|
||||||
|
|
||||||
|
$(".form_file_download").submit(function(){
|
||||||
|
file_name = $(this).find("input").val();
|
||||||
|
$.ajax({
|
||||||
|
type: 'post',
|
||||||
|
url: '/file_download',
|
||||||
|
data: {file_name: file_name},
|
||||||
|
success: function(result){
|
||||||
|
console.log("post success");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$("document").ready(function(){
|
||||||
|
$(".form_file_download").submit(function(){
|
||||||
|
file_name = $(this).find("input").val();
|
||||||
|
$.ajax({
|
||||||
|
type: 'post',
|
||||||
|
url: '/file_download',
|
||||||
|
data: {file_name: file_name},
|
||||||
|
success: function(result){
|
||||||
|
console.log("post success");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<!--Test Page specific JS -->
|
<!--Test Page specific JS -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
//alert ('Test Page specific JS')
|
|
||||||
$(function($) {
|
|
||||||
|
|
||||||
$(".knob").knob({
|
//alert ('Test Page specific JS')
|
||||||
change: function(value) {
|
$(function($) {
|
||||||
//console.log("change : " + value);
|
|
||||||
},
|
|
||||||
release: function(value) {
|
|
||||||
//console.log(this.$.attr('value'));
|
|
||||||
console.log("release : " + value);
|
|
||||||
},
|
|
||||||
cancel: function() {
|
|
||||||
console.log("cancel : ", this);
|
|
||||||
},
|
|
||||||
/*format : function (value) {
|
|
||||||
return value + '%';
|
|
||||||
},*/
|
|
||||||
draw: function() {
|
|
||||||
|
|
||||||
// "tron" case
|
$(".knob").knob({
|
||||||
if (this.$.data('skin') == 'tron') {
|
change: function(value) {
|
||||||
|
//console.log("change : " + value);
|
||||||
|
},
|
||||||
|
release: function(value) {
|
||||||
|
//console.log(this.$.attr('value'));
|
||||||
|
console.log("release : " + value);
|
||||||
|
},
|
||||||
|
cancel: function() {
|
||||||
|
console.log("cancel : ", this);
|
||||||
|
},
|
||||||
|
/*format : function (value) {
|
||||||
|
return value + '%';
|
||||||
|
},*/
|
||||||
|
draw: function() {
|
||||||
|
|
||||||
this.cursorExt = 0.3;
|
// "tron" case
|
||||||
|
if (this.$.data('skin') == 'tron') {
|
||||||
|
|
||||||
var a = this.arc(this.cv) // Arc
|
this.cursorExt = 0.3;
|
||||||
,
|
|
||||||
pa // Previous arc
|
|
||||||
, r = 1;
|
|
||||||
|
|
||||||
this.g.lineWidth = this.lineWidth;
|
var a = this.arc(this.cv) // Arc
|
||||||
|
,
|
||||||
|
pa // Previous arc
|
||||||
|
, r = 1;
|
||||||
|
|
||||||
if (this.o.displayPrevious) {
|
this.g.lineWidth = this.lineWidth;
|
||||||
pa = this.arc(this.v);
|
|
||||||
this.g.beginPath();
|
|
||||||
this.g.strokeStyle = this.pColor;
|
|
||||||
this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, pa.s, pa.e, pa.d);
|
|
||||||
this.g.stroke();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.g.beginPath();
|
if (this.o.displayPrevious) {
|
||||||
this.g.strokeStyle = r ? this.o.fgColor : this.fgColor;
|
pa = this.arc(this.v);
|
||||||
this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, a.s, a.e, a.d);
|
this.g.beginPath();
|
||||||
this.g.stroke();
|
this.g.strokeStyle = this.pColor;
|
||||||
|
this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, pa.s, pa.e, pa.d);
|
||||||
|
this.g.stroke();
|
||||||
|
}
|
||||||
|
|
||||||
this.g.lineWidth = 2;
|
this.g.beginPath();
|
||||||
this.g.beginPath();
|
this.g.strokeStyle = r ? this.o.fgColor : this.fgColor;
|
||||||
this.g.strokeStyle = this.o.fgColor;
|
this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, a.s, a.e, a.d);
|
||||||
this.g.arc(this.xy, this.xy, this.radius - this.lineWidth + 1 + this.lineWidth * 2 / 3, 0, 2 * Math.PI, false);
|
this.g.stroke();
|
||||||
this.g.stroke();
|
|
||||||
|
|
||||||
return false;
|
this.g.lineWidth = 2;
|
||||||
}
|
this.g.beginPath();
|
||||||
}
|
this.g.strokeStyle = this.o.fgColor;
|
||||||
});
|
this.g.arc(this.xy, this.xy, this.radius - this.lineWidth + 1 + this.lineWidth * 2 / 3, 0, 2 * Math.PI, false);
|
||||||
|
this.g.stroke();
|
||||||
|
|
||||||
// Example of infinite knob, iPod click wheel
|
return false;
|
||||||
var v, up = 0,
|
}
|
||||||
down = 0,
|
}
|
||||||
i = 0,
|
});
|
||||||
$idir = $("div.idir"),
|
|
||||||
$ival = $("div.ival"),
|
// Example of infinite knob, iPod click wheel
|
||||||
incr = function() {
|
var v, up = 0,
|
||||||
i++;
|
down = 0,
|
||||||
$idir.show().html("+").fadeOut();
|
i = 0,
|
||||||
$ival.html(i);
|
$idir = $("div.idir"),
|
||||||
},
|
$ival = $("div.ival"),
|
||||||
decr = function() {
|
incr = function() {
|
||||||
i--;
|
i++;
|
||||||
$idir.show().html("-").fadeOut();
|
$idir.show().html("+").fadeOut();
|
||||||
$ival.html(i);
|
$ival.html(i);
|
||||||
};
|
},
|
||||||
$("input.infinite").knob({
|
decr = function() {
|
||||||
min: 0,
|
i--;
|
||||||
max: 20,
|
$idir.show().html("-").fadeOut();
|
||||||
stopper: false,
|
$ival.html(i);
|
||||||
change: function() {
|
};
|
||||||
if (v > this.cv) {
|
$("input.infinite").knob({
|
||||||
if (up) {
|
min: 0,
|
||||||
decr();
|
max: 20,
|
||||||
up = 0;
|
stopper: false,
|
||||||
} else {
|
change: function() {
|
||||||
up = 1;
|
if (v > this.cv) {
|
||||||
down = 0;
|
if (up) {
|
||||||
}
|
decr();
|
||||||
} else {
|
up = 0;
|
||||||
if (v < this.cv) {
|
} else {
|
||||||
if (down) {
|
up = 1;
|
||||||
incr();
|
down = 0;
|
||||||
down = 0;
|
}
|
||||||
} else {
|
} else {
|
||||||
down = 1;
|
if (v < this.cv) {
|
||||||
up = 0;
|
if (down) {
|
||||||
}
|
incr();
|
||||||
}
|
down = 0;
|
||||||
}
|
} else {
|
||||||
v = this.cv;
|
down = 1;
|
||||||
}
|
up = 0;
|
||||||
});
|
}
|
||||||
});
|
}
|
||||||
</script>
|
}
|
||||||
|
v = this.cv;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@ -44,7 +44,7 @@ Rails.application.configure do
|
|||||||
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
||||||
|
|
||||||
# Specifies the header that your server uses for sending files.
|
# Specifies the header that your server uses for sending files.
|
||||||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||||
|
|
||||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
|
@ -14,7 +14,7 @@ Rails.application.routes.draw do
|
|||||||
get 'home/index' => 'home#index'
|
get 'home/index' => 'home#index'
|
||||||
post 'home/mkdir' => 'home#make_directory'
|
post 'home/mkdir' => 'home#make_directory'
|
||||||
post 'home/delete' => 'home#delete_file'
|
post 'home/delete' => 'home#delete_file'
|
||||||
|
post 'file_download' => 'home#file_download'
|
||||||
|
|
||||||
#Volume
|
#Volume
|
||||||
get 'volume/index' => 'volume#index'
|
get 'volume/index' => 'volume#index'
|
||||||
|
Loading…
Reference in New Issue
Block a user