Sindbad~EG File Manager
@extends('layout')
@section('title')
<title>{{ CustomClass::$Title }}</title>
@stop
@section('scriptTop')
{{ HTML::script('/js/ajaxloader.js') }}
{{ HTML::script('/js/jquery.validate.js') }}
@stop
@section('content')
<style type="text/css">
.panel-danger {
background: #c9044c !important;
color: #fff !important;
}
.panel-danger a:hover, .panel-danger a, .panel-danger h4
{
font-size: 17px;
line-height: 24px;
margin-bottom: 18px;
color:#fff;
}
</style>
@section('ContentTitle')
Upload your Free Paper Full Text
@stop
{{-- @if(!Auth::check()) --}}
Welcome <strong>{{ $user->prefix}} {{ $user->first_name}} {{ $user->sur_name}}</strong><br/><br/>
{{-- @endif --}}
<div class="panel panel-danger">
<div class="panel-body">
<h4>The guidelines to submit the full text is available on
<a href="http://www.ijo.in/contributors.asp" target="_blank">http://www.ijo.in/contributors.asp.</a>
Ensure that the file size is less than 5 MB. Files which are greater than 5 MB shall be automatically rejected.</h4>
</div>
</div>
{{ Form::open(array('url' => '/ep/postupload','enctype'=>'multipart/form-data','id'=>'upload_file')) }}
<div class="row">
<label>Select FP:</label>
<div class="col-md-12">
{{ Form::select('fpid', array('' => '--select--') + $result,$abs_id,array('class' => 'form-control','id'=>'fpid')) }}
</div>
</div>
<div class="row">
<label id="lblupload" class="uploadpdf">Upload File (Only .ppt,pptx files are supported and can be of 5 MB maximum)</label>
<div class="col-md-6">
<!-- <input type="file" class="uploadpdf" id="uploadpdf" name="uploadpdf" accept="doc,pdf,rtf,docx"/> -->
{{ Form::file('uploadpdf',array('id' => 'uploadpdf','class'=>'uploadpdf')) }}
</div>
</div>
<div style="color:red" id="otherError"></div>
<div class="row">
<div class="col-sm-8 col-md-4">
{{ Form::button('Upload',array('id' => 'upload','class'=>'btn btn primary','onclick'=>' onclientclick()')) }}
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="table-responsive">
<table id="tbl_search" class="table table-bordered">
<thead>
<tr>
<th>
File Uploaded
</th>
<th>
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<br/>
<!-- div class="row">
<div class="col-md-12" Style="color:#0646AB">
<strong> Alternately, you can send your full text as an attachment to support@aios-online.com quoting your <br />
FP number and Title of your free paper in the subject line. <br />
The receipt of your full text shall be acknowledged in three working days
</strong>
</div>
</div -->
{{ Form::close() }}
@stop
@section('scriptBottom')
<script type="text/javascript">
var ddlfpid = "#fpid";
var txtfile = "#uploadpdf";
var tbl_search = "#tbl_search";
var lblupload = "#lblupload";
var selection_type_id = 0;
$(document).ready(function () {
$('#upload_file').validate({
rules: {
fpid: {
required: true
},
uploadpdf: {
required: true,
// extension : "ppt|pptx"
}
},
messages: {
fpid:
{
required:"Please select E-Poster"
},
uploadpdf:
{
required:"Please choose the file",
}
}
});
$('.uploadpdf').hide();
$('#upload').hide();
$(tbl_search).hide();
loadddl();
setTimeout(function() {
$('#alert').fadeOut('fast');
}, 1000);
$("#fpid").change(function()
{
loadddl();
});
});
function onclientclick() {
var isvalid = true;
if($("#upload_file").valid())
{
var file = $('input[type=file]').val();
//alert(selection_type_id);
if(selection_type_id == 3)
if (!file.match(/\.(?:ppt|pptx)$/)) {
$('#otherError').text('Sorry! Can not accept files of this type.Only ppt and pptx files are allowed');
isvalid =false;
}
if(selection_type_id == 2)
if (!file.match(/\.(?:doc|docx)$/)) {
$('#otherError').text('Sorry! Can not accept files of this type.Only doc and docx files are allowed');
isvalid =false;
}
if(isvalid)
{
var fsize = $('input[type=file]')[0].files[0].size;
if (fsize > (5.20 * 1048576)) //do something if file size more than 1 mb (1048576)
{
$('#otherError').text('File size is too large. Maximum file size permitted is 5 MB.');
isvalid =false;
}
}
}
else
{
isvalid =false;
}
if(isvalid)
{
$('#upload').prop('disabled', true);
$('#upload').text("File Uploading Please wait..");
$('#upload_file').submit();
}
}
function loadddl()
{
$('.uploadpdf').hide();
$('#upload').hide();
$('#tbl_search').hide();
var fpid = $(ddlfpid).val()
if(fpid>0)
{
$('#tbl_search').show();
var result = getfpupload(fpid);
selection_type_id = result.selection_type_id;
//paper only
if(selection_type_id == 2)
{
$(lblupload).html("Upload File (Only .doc,docx files are supported and can be of 5 MB maximum)");
}
//poster only
if(selection_type_id == 3)
{
$(lblupload).html("Upload File (Only .ppt,pptx files are supported and can be of 5 MB maximum)");
}
}
else
{
$('#tbl_search').hide();
}
}
// (function($){
// $("#fpid").bind("change", null, function (e) {
// var search = $(ddlfpid).val();
// alert(search);
// // getSearchfpupload(search);
// });
// });
function getfpupload(fpid) {
var result = null;
$.ajax({
url: baseUrl +'/fp/getupload',
type: 'POST',
dataType: 'json',
async: false,
data: {'fpid': fpid},
})
.done(function(d) {
// alert(d);
result = d;
setFpupload(result.data);
})
.fail(function() {
//alert("Internal Server Error");
//return false;
});
return result;
}
function setFpupload(arr) {
$(tbl_search + 'tbody').html('');
var str = "";
console.info(arr);
if(!(arr == '')){
str +="<tr>";
str +="<td>" + (arr.file_name==null?'':arr.file_name) + "</td>";
str +="<td>" + "<input type= \"button\" value=\"Delete\" class=\"btn btn-primary\" onclick=\"onDelete("+arr.abs_id+")\">" + "</td>";
str +="</tr>";
}
else
{
$('.uploadpdf').show();
$('#upload').show();
$(tbl_search).hide();
// str +="<tr>";
// str +="<td colspan=\"4\" class=\"text-red\" >" + "record not found" + "</td>";
// str +="</tr>";
}
$(tbl_search + ' tbody').html(str);
}
function onDelete(absid)
{
$.ajax({
type: 'POST', // <-- get method of form
url: baseUrl + '/fp/deleteupload', // <-- get action of form
data: {'fpid':absid},
async: false,
dataType: 'json',
// <-- serialize all fields into a string that is ready to be posted to your PHP file
success: function(data){
$('.uploadpdf').show();
$('#upload').show();
$(tbl_search).hide();
return false;
}
});
}
</script>
@stop
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists