mirror of
https://github.com/itflow-org/itflow
synced 2026-12-02 00:59:03 +00:00
Documents in Markdown: a document can be written in Markdown with Write and Preview or in the rich text editor and switched either way, pictures pasted or dropped into the Markdown are kept as files, New Document starts in the way last used, Import Markdown Files beside Upload makes a document from each .md file, a Markdown button beside PDF downloads a document as a .md file, and Markdown pasted into a document's rich text editor goes in as formatting; versions, restore, copy and the API carry the Markdown, and the API's document create and update no longer escape values twice; database 4.2.3 adds documents.document_markdown and document_versions.document_version_markdown, and league/commonmark 2.10 and league/html-to-markdown 5.2 are added to libs/vendor through composer; 26.12.3 changelog entries
This commit is contained in:
71
agent/modals/document/document_import_markdown.php
Normal file
71
agent/modals/document/document_import_markdown.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?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';
|
||||
Reference in New Issue
Block a user