118 lines
3.7 KiB
Smarty
118 lines
3.7 KiB
Smarty
{**
|
|
* NOTICE OF LICENSE
|
|
* With the purchase or the installation of the software in your application
|
|
* you accept the license agreement.
|
|
*
|
|
* You can not resell and redistribute this file.
|
|
*
|
|
* @author Dalibor Stojcevski <dal_sto@yahoo.com>
|
|
* @copyright 2019 Dalibor Stojcevski
|
|
* @license Dalibor Stojcevski
|
|
*}
|
|
|
|
<form id="attachment_form" class="defaultForm form-horizontal AdminAttachments" action="{$form_link}" method="post" enctype="multipart/form-data" novalidate="">
|
|
<input type="hidden" name="submitAddSource" value="1">
|
|
|
|
<div class="panel" id="fieldset_0">
|
|
|
|
<div class="panel-heading">
|
|
<i class="icon-paper-clip"></i> Add new source
|
|
</div>
|
|
<div class="form-wrapper">
|
|
<div class="form-group">
|
|
<label class="control-label col-lg-3">Enter link</label>
|
|
<div class="col-lg-4">
|
|
<div class="form-group">
|
|
<input type="text" id="name_2" name="import_api_link" class="" value="" >
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<p>Or upload file</p>
|
|
<div class="form-group">
|
|
<label class="control-label col-lg-3">File</label>
|
|
<div class="col-lg-6">
|
|
<div class="form-group">
|
|
<div class="col-sm-6">
|
|
<input id="file" type="file" name="doc" class="hide">
|
|
<div class="dummyfile input-group">
|
|
<span class="input-group-addon"><i class="icon-file"></i></span>
|
|
<input id="file-name" type="text" name="doc" readonly="">
|
|
<span class="input-group-btn">
|
|
<button id="file-selectbutton" type="button" name="submitAddSource" class="btn btn-default">
|
|
<i class="icon-folder-open"></i> Add file </button>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div><!-- /.form-wrapper -->
|
|
<div class="panel-footer">
|
|
<button type="submit" value="1" id="attachment_form_submit_btn" name="submitAddSource" class="btn btn-default pull-right">
|
|
<i class="process-icon-save"></i> Save
|
|
</button>
|
|
<a class="btn btn-default" id="attachment_form_cancel_btn" onclick="javascript:window.history.back();">
|
|
<i class="process-icon-cancel"></i> Cancel
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function(){
|
|
$('#file-selectbutton').click(function(e) {
|
|
$('#file').trigger('click');
|
|
});
|
|
|
|
$('#file-name').click(function(e) {
|
|
$('#file').trigger('click');
|
|
});
|
|
|
|
$('#file-name').on('dragenter', function(e) {
|
|
e.stopPropagation();
|
|
e.preventDefault();
|
|
});
|
|
|
|
$('#file-name').on('dragover', function(e) {
|
|
e.stopPropagation();
|
|
e.preventDefault();
|
|
});
|
|
|
|
$('#file-name').on('drop', function(e) {
|
|
e.preventDefault();
|
|
var files = e.originalEvent.dataTransfer.files;
|
|
$('#file')[0].files = files;
|
|
$(this).val(files[0].name);
|
|
});
|
|
|
|
$('#file').change(function(e) {
|
|
if ($(this)[0].files !== undefined)
|
|
{
|
|
var files = $(this)[0].files;
|
|
var name = '';
|
|
|
|
$.each(files, function(index, value) {
|
|
name += value.name+', ';
|
|
});
|
|
|
|
$('#file-name').val(name.slice(0, -2));
|
|
}
|
|
else // Internet Explorer 9 Compatibility
|
|
{
|
|
var name = $(this).val().split(/[\\/]/);
|
|
$('#file-name').val(name[name.length-1]);
|
|
}
|
|
});
|
|
|
|
if (typeof file_max_files !== 'undefined')
|
|
{
|
|
$('#file').closest('form').on('submit', function(e) {
|
|
if ($('#file')[0].files.length > file_max_files) {
|
|
e.preventDefault();
|
|
alert('You can upload a maximum of files');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
</script> |