mirror of
https://github.com/itflow-org/itflow
synced 2026-12-02 00:59:03 +00:00
72 lines
3.4 KiB
PHP
72 lines
3.4 KiB
PHP
<?php
|
|
|
|
/*
|
|
* Import Markdown files - each .md file picked becomes a document written in Markdown, in the
|
|
* folder picked (import_markdown_documents, agent/post/document.php).
|
|
*/
|
|
|
|
require_once '../../../includes/modal_header.php';
|
|
|
|
enforceUserPermission('module_support', 2);
|
|
|
|
$client_id = intval($_GET['client_id'] ?? 0);
|
|
enforceClientAccess();
|
|
|
|
$folder_id = folderOwnedId($_GET['folder_id'] ?? 0, $client_id);
|
|
|
|
ob_start();
|
|
|
|
?>
|
|
|
|
<div class="modal-header bg-dark">
|
|
<h5 class="modal-title"><i class="fab fa-fw fa-markdown me-2"></i>Import Markdown Files</h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
|
<input type="hidden" name="client_id" value="<?= $client_id ?>">
|
|
<div class="modal-body">
|
|
<?php if (!documentMarkdownReady()) { ?>
|
|
<div class="alert alert-warning mb-0">Markdown documents arrive with the next database update - run it from Maintenance > Update first.</div>
|
|
<?php } else { ?>
|
|
<div class="mb-3">
|
|
<label class="form-label">Markdown files <strong class="text-danger">*</strong></label>
|
|
<div class="input-group">
|
|
<span class="input-group-text"><i class="fas fa-fw fa-file-import"></i></span>
|
|
<input type="file" class="form-control" name="files[]" multiple required accept=".md,.markdown,.mdown,.mkd,text/markdown">
|
|
</div>
|
|
<div class="form-text">Each becomes a document written in Markdown, named by the heading it starts with or its file name - up to 50 at a time. Pictures a file points to on your computer aren't brought in.</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">Folder</label>
|
|
<div class="input-group">
|
|
<span class="input-group-text"><i class="fas fa-fw fa-folder"></i></span>
|
|
<select class="form-select select2" name="folder">
|
|
<?= folderOptionsHtml($client_id, $folder_id) ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (!empty($config_client_portal_enable)) { ?>
|
|
<div class="form-check form-switch">
|
|
<input type="hidden" name="client_visible" value="0">
|
|
<input class="form-check-input" type="checkbox" role="switch" name="client_visible" value="1" id="importMarkdownVisible">
|
|
<label class="form-check-label" for="importMarkdownVisible">
|
|
<i class="fas fa-fw fa-eye text-body-secondary me-1"></i>Show them in the client portal <span class="text-body-secondary small">- to their technical contacts</span>
|
|
</label>
|
|
</div>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<?php if (documentMarkdownReady()) { ?>
|
|
<button type="submit" name="import_markdown_documents" class="btn btn-primary fw-bold"><i class="fas fa-file-import me-2"></i>Import</button>
|
|
<?php } ?>
|
|
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fas fa-times me-2"></i>Cancel</button>
|
|
</div>
|
|
</form>
|
|
|
|
<?php
|
|
require_once '../../../includes/modal_footer.php';
|