first commit

This commit is contained in:
2022-12-23 16:27:07 +01:00
commit 7b144bd346
383 changed files with 23723 additions and 0 deletions

View File

@ -0,0 +1,125 @@
{% extends 'form_div_layout.html.twig' %}
{# Voir https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig #}
{# On commence par simplement ajouter le form-group au row de nos formulaires #}
{% block form_row -%}
{% set class='' %}
{% if attr.class is defined %}
{% set class = attr.class %}
{% endif %}
{% set attr = attr|merge({'help': (attr.help|default(true)) }) %}
<div class="form-group {{class}} {{ errors|length > 0 ? 'has-error' : '' }} mb-3">
{{ form_label(form) }}
{{ form_widget(form) }}
{{ form_errors(form) }}
</div>
{%- endblock form_row %}
{# Puis on modifie très simplement nos input et textarea les plus importants pour y ajouter le class imposée par Bootstrap 3 #}
{% block textarea_widget %}
{% set attr = attr|merge({'class': attr.class|default('') ~ ' form-control'}) %}
{{ parent() }}
{% endblock textarea_widget %}
{% block form_widget_simple %}
{% set attr = attr|merge({'class': attr.class|default('') ~ ' form-control'}) %}
{{ parent() }}
{% endblock form_widget_simple %}
{% block form_label %}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' control-label')|trim}) %}
{% if 'checkbox' not in block_prefixes %}
{% if label is not same as(false) -%}
{% if not compound %}
{% set label_attr = label_attr|merge({'for': id}) %}
{%- endif %}
{% if required %}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %}
{%- endif %}
{% if label is empty %}
{% set label = name|humanize %}
{%- endif -%}
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
{{ label|trans({}, translation_domain)|raw }}
<span class="mandatory">{% if required %}*{% endif %}</span>
</label>
{%- endif %}
{% endif %}
{%- endblock form_label %}
{# et enfin les erreurs #}
{% block form_errors %}
{% if errors|length > 0 %}
{% if attr.help is defined and attr.help %}
<p class="help-block text-danger">
{% for error in errors %}
{{ error.message }}<br />
{% endfor %}
</p>
{% else %}
<div class="alert alert-danger alert-dismissible">
{% for error in errors %}
{{ error.message|raw }}<br />
{% endfor %}
</div>
{% endif %}
{% endif %}
{% endblock form_errors %}
{# Personnalisation des boutons #}
{% block button_widget -%}
{% if label is empty -%}
{% set label = name|humanize %}
{%- endif -%}
{% set attr = attr|merge({'class': (attr.class|default('') ~ '')|trim}) %}
<button type="{{ type|default('button') }}" {{ block('button_attributes') }}>{{
label|trans({}, translation_domain) }}
{% if type is defined and type == 'submit' -%}
{% endif %}
</button>
{%- endblock button_widget %}
{# Personnalisation des select #}
{% block choice_widget_collapsed %}
{% set attr = attr|merge({'class': (attr.class|default('') ~ ' form-control')|trim}) %}
{{ parent() }}
{%- endblock choice_widget_collapsed %}
{% block choice_widget %}
{% if expanded %}
<ul {{ block('widget_container_attributes') }} style="list-style: none; padding-left: 0">
{% for child in form %}
<li>
{{ form_widget(child) }}
{{ form_label(child) }}
</li>
{% endfor %}
</ul>
{% else %}
{{ parent() }}
{% endif %}
{% endblock choice_widget %}
{% block checkbox_widget %}
<label for="{{ id }}">
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
{{ label|trans({}, translation_domain) }}</label>
{% endblock checkbox_widget %}
{% block radio_widget %}
<label for="{{ id }}">
<input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
{{ label|trans({}, translation_domain) }}
</label>&nbsp;&nbsp;
{% endblock radio_widget %}
{% block file_widget %}
{% set type = type|default('file') %}
<input type="{{ type }}" {{ block('widget_attributes') }} />
{% endblock file_widget %}

View File

@ -0,0 +1,96 @@
{% extends "base.html.twig" %}
{% block body %}
<div class="float-end">
<button id="addfolder" onClick="showFolder()" type="button" class="btn btn_link" data-toggle="modal" data-target="#folder">
<i class="fa fa-folder-plus fa-2x fa-fw"></i>
</button>
<a class="btn btn_link btn-modal" data-modalid="mymodallarge" data-modalurl="{{ path('app_home_upload',{folder:infolder}) }}">
<i class="fa fa-upload fa-2x fa-fw"></i>
</a>
</div>
<div style="font-size:180%">
{% for folder in tree %}
{% if not loop.first %}&nbsp;/&nbsp;{%endif%}
<a href='{{path("app_home",{folder:folder.folder})}}'>{{folder.name}}</a>
{% endfor %}
</div>
<ul class="list-group mt-3">
{% for folder in folders %}
<li class="list-group-item">
<a href='{{path("app_home",{folder:(infolder~"/"~folder)})}}'>
<i class="fa-solid fa-folder fa-fw fa-2x"></i>
<span style="font-size:180%">{{folder}}</span>
</a>
<span class="btn_link btn-action float-end">
<a onClick="showFile('{{folder}}')"><i class="fa-solid fa-pencil fa-fw"></i></a>
<a href='{{path("app_home_delete",{folder:infolder,file:(infolder~"/"~folder)})}}'><i class="fa-solid fa-trash fa-fw"></i></a>
</span>
</li>
{%endfor%}
{% for file in files %}
<li class="list-group-item">
<a href='{{path("app_home_download",{file:(infolder~"/"~file)})}}' target="_blank">
<i class="fa-solid fa-file fa-fw fa-2x"></i>
<span style="font-size:180%">{{file}}</span>
</a>
<span class="btn_link btn-action float-end">
<a onClick="showFile('{{file}}')"><i class="fa-solid fa-pencil fa-fw"></i></a>
<a href='{{path("app_home_delete",{folder:infolder,file:(infolder~"/"~file)})}}'><i class="fa-solid fa-trash fa-fw"></i></a>
</span>
</li>
{%endfor%}
</ul>
<div id="folder" class="modal" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Création Répertoire</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
{{ form_start(formfolder) }}
{{ form_end(formfolder) }}
</div>
</div>
</div>
</div>
<div id="file" class="modal" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Modification</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
{{ form_start(formfile) }}
{{ form_end(formfile) }}
</div>
</div>
</div>
</div>
{% endblock %}
{% block localscript %}
<script>
function showFolder() {
$('#folder').modal('show');
$('#folder_name').focus();
}
function showFile(file) {
$('#file').modal('show');
$('#file_oldname').val(file);
$('#file_name').val(file);
$('#file_name').focus();
}
</script>
{% endblock %}

View File

@ -0,0 +1,57 @@
{% extends "base.html.twig" %}
{% block encoretags %}
{{ encore_entry_link_tags('dropzone') }}
{% endblock %}
{% block body %}
<a class="btn btn-secondary" onClick="closeModal();">Annuler</a>
<form
action="{{ oneup_uploader_endpoint('sftp') }}"
class="dropzone"
id="mydropzone"
data-maxFiles="0"
style="margin-top:10px">
</form>
{% endblock %}
{% block localscript %}
{{ encore_entry_script_tags('dropzone') }}
<script>
function dropzoneinit( elmt ) {
var totalFiles = 0;
var completeFiles = 0;
elmt.on("sending", function(file, xhr, formData) {
formData.append("folder", "{{ folder }}");
});
elmt.on("addedfile", function (file) {
totalFiles += 1;
});
elmt.on("removed file", function (file) {
totalFiles -= 1;
});
elmt.on("complete", function (file) {
completeFiles += 1;
if (completeFiles === totalFiles) {
console.log("completed");
closeModal();
}
});
}
function dropzonesuccess( file, response ) {
closeModal();
}
function closeModal() {
parent.location.reload();
}
</script>
{% endblock %}

119
templates/base.html.twig Normal file
View File

@ -0,0 +1,119 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html"; charset="utf-8" />
<title>SFTP Browser</title>
<link rel="shortcut icon" href="/medias/logo/logo.png" />
{{ encore_entry_link_tags('app') }}
{{ encore_entry_script_tags('app') }}
{% block encoretags %}{% endblock encoretags %}
<style>
:root{
--colorbgbodylight: #ffffff;
--colorbgbodydark: #009de0;
--colorfttitlelight: #009de0;
--colorfttitledark: #ffffff;
--colorftbodylight: #343a40;
--colorftbodydark: #ffffff;
--fontbody: "Roboto-Regular";
--fonttitle: "Theboldfont";
--fontsizeh1: 40px;
--fontsizeh2: 32px;
--fontsizeh3: 28px;
--fontsizeh4: 24px;
--lineheighth1:30px;
--colorbgbodylight-darker: #f5f5f5;
--colorbgbodydark-darker: #006bae;
--colorfttitlelight-darker: #006bae;
--colorbgbodydark-rgb: 0,157,224;
}
</style>
{% block localstyle %}{% endblock %}
</head>
<body>
{% if (useheader is defined and useheader) or (usemenu is defined and usemenu) %}
<div class="header sticky-top">
<nav id="menu" class="navbar navbar-expand p-0" style="display:flex">
<a class="nav-link navbar-logo" href="{{ path('app_home')}}" style="display:none">
<img src="/medias/logo/logo.png">
</a>
<a class="nav-link ps-0" href="{{ path('app_home')}}">
SFTP Browser
</a>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
</ul>
</div>
<ul id="menuuser" class="nav navbar-right pe-3">
{% block menuuser %}
{% endblock %}
</ul>
<ul id="menulink" class="nav navbar-right pe-3" style="display:none;">
</ul>
</nav>
</div>
{% endif %}
<main>
{% if usesidebar is defined and usesidebar %}
{% block sidebar %}
{% endblock %}
{%endif%}
<div id="page" class="p-4">
{%if maxsize is defined %}<div style="max-width:{{maxsize}}px;margin:0 auto;">{%endif%}
{% block body %}{% endblock %}
{%if maxsize is defined %}</div>{%endif%}
</div>
</main>
<div id="mymodal" class="modal" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div id="mymodalheader" class="modal-header">
<h4 class="modal-title"></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<iframe frameborder=0 width="100%" height="600px"></iframe>
</div>
</div>
</div>
</div>
<div id="mymodallarge" class="modal" tabindex="-1">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"></h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<iframe frameborder=0 width="100%" height="700px"></iframe>
</div>
</div>
</div>
</div>
{% block localscript %}{% endblock %}
</body>
</html>