mirror of
https://github.com/itflow-org/itflow
synced 2026-03-01 03:14:52 +00:00
Moved Document Templates to settings
This commit is contained in:
@@ -53,11 +53,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<h3 class="card-title mt-2">
|
<h3 class="card-title mt-2">
|
||||||
<i class="fa fa-fw fa-folder mr-2"></i>Documents
|
<i class="fa fa-fw fa-folder mr-2"></i>Documents
|
||||||
</h3>
|
</h3>
|
||||||
<button type="button" class="btn btn-dark dropdown-toggle ml-1" data-toggle="dropdown"></button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item text-dark" href="client_document_templates.php?client_id=<?php echo $client_id; ?>">Templates</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
|
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
|||||||
@@ -2,22 +2,25 @@
|
|||||||
<div class="modal-dialog modal-xl">
|
<div class="modal-dialog modal-xl">
|
||||||
<div class="modal-content bg-dark">
|
<div class="modal-content bg-dark">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>New Document Template</h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>Creating Document Template</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
|
||||||
<div class="modal-body bg-white">
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="text" class="form-control" name="name" placeholder="Template name" required autofocus>
|
<input type="text" class="form-control" name="name" placeholder="Template name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<textarea class="form-control tinymce" name="content"></textarea>
|
<textarea class="form-control tinymce" name="content"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Enter a short summary">
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer bg-white">
|
<div class="modal-footer bg-white">
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once("inc_all_client.php");
|
require_once("inc_all_settings.php");
|
||||||
|
|
||||||
//Initialize the HTML Purifier to prevent XSS
|
//Initialize the HTML Purifier to prevent XSS
|
||||||
require("plugins/htmlpurifier/HTMLPurifier.standalone.php");
|
require("plugins/htmlpurifier/HTMLPurifier.standalone.php");
|
||||||
@@ -17,8 +17,8 @@ $sql_document = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_te
|
|||||||
$row = mysqli_fetch_array($sql_document);
|
$row = mysqli_fetch_array($sql_document);
|
||||||
|
|
||||||
$document_name = nullable_htmlentities($row['document_name']);
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
|
$document_description = nullable_htmlentities($row['document_description']);
|
||||||
$document_content = $purifier->purify($row['document_content']);
|
$document_content = $purifier->purify($row['document_content']);
|
||||||
//$document_content = $row['document_content'];
|
|
||||||
$document_created_at = nullable_htmlentities($row['document_created_at']);
|
$document_created_at = nullable_htmlentities($row['document_created_at']);
|
||||||
$document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
$document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
||||||
|
|
||||||
@@ -26,24 +26,17 @@ $document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
|||||||
|
|
||||||
<ol class="breadcrumb d-print-none">
|
<ol class="breadcrumb d-print-none">
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="invoices.php">Home</a>
|
<a href="clients.php">Home</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="clients.php">Clients</a>
|
<a href="users.php">Settings</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="client_overview.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a>
|
<a href="settings_document_templates.php">Document Templates</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item active"><i class="fas fa-file mr-2"></i><?php echo $document_name; ?></li>
|
||||||
<a href="client_documents.php?client_id=<?php echo $client_id; ?>">Documents</a>
|
|
||||||
</li>
|
|
||||||
<li class="breadcrumb-item">
|
|
||||||
<a href="client_document_templates.php?client_id=<?php echo $client_id; ?>">Templates</a>
|
|
||||||
</li>
|
|
||||||
<li class="breadcrumb-item active"><i class="fas fa-file"></i> <?php echo $document_name; ?></li>
|
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
|
|
||||||
@@ -53,9 +46,6 @@ $document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
|||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editDocumentTemplateModal<?php echo $document_id; ?>">
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editDocumentTemplateModal<?php echo $document_id; ?>">
|
||||||
<i class="fas fa-edit mr-2"></i>Edit
|
<i class="fas fa-edit mr-2"></i>Edit
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#editDocumentModal">
|
|
||||||
<i class="fas fa-copy mr-2"></i>Copy
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -65,6 +55,6 @@ $document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once("client_document_template_edit_modal.php");
|
require_once("document_template_edit_modal.php");
|
||||||
|
|
||||||
require_once("footer.php");
|
require_once("footer.php");
|
||||||
@@ -19,6 +19,10 @@
|
|||||||
<textarea class="form-control tinymce" name="content"><?php echo $document_content; ?></textarea>
|
<textarea class="form-control tinymce" name="content"><?php echo $document_content; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control" name="description" value="<?php echo $document_description; ?>" placeholder="Short summary">
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer bg-white">
|
<div class="modal-footer bg-white">
|
||||||
<button type="submit" name="edit_document_template" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
<button type="submit" name="edit_document_template" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
@@ -382,7 +382,7 @@ if (isset($_POST['edit_document_template'])) {
|
|||||||
// Content Raw is used for FULL INDEX searching. Adding a space before HTML tags to allow spaces between newlines, bulletpoints, etc. for searching.
|
// Content Raw is used for FULL INDEX searching. Adding a space before HTML tags to allow spaces between newlines, bulletpoints, etc. for searching.
|
||||||
|
|
||||||
// Document edit query
|
// Document edit query
|
||||||
mysqli_query($mysqli,"UPDATE documents SET document_name = '$name', document_description = '$description', document_content = '$content', document_content_raw = '$content_raw' WHERE document_id = $document_id");
|
mysqli_query($mysqli,"UPDATE documents SET document_name = '$name', document_description = '$description', document_content = '$content', document_content_raw = '$content_raw', document_updated_by = $session_user_id WHERE document_id = $document_id");
|
||||||
|
|
||||||
//Logging
|
//Logging
|
||||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Document Template', log_action = 'Modify', log_description = '$session_name modified document template $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, log_entity_id = $document_id");
|
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Document Template', log_action = 'Modify', log_description = '$session_name modified document template $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, log_entity_id = $document_id");
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
$sort = "document_name";
|
$sort = "document_name";
|
||||||
$order = "ASC";
|
$order = "ASC";
|
||||||
|
|
||||||
require_once("inc_all_client.php");
|
require_once("inc_all_settings.php");
|
||||||
|
|
||||||
// Search query SQL snippet
|
// Search query SQL snippet
|
||||||
if (!empty($q)) {
|
if (!empty($q)) {
|
||||||
@@ -31,10 +31,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file mr-2"></i>Document Templates</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file mr-2"></i>Document Templates</h3>
|
||||||
<button type="button" class="btn btn-dark dropdown-toggle ml-1" data-toggle="dropdown"></button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item text-dark" href="client_documents.php?client_id=<?php echo $client_id; ?>">Documents</a>
|
|
||||||
</div>
|
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDocumentTemplateModal">
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDocumentTemplateModal">
|
||||||
<i class="fas fa-plus mr-2"></i>New Template
|
<i class="fas fa-plus mr-2"></i>New Template
|
||||||
@@ -44,7 +40,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<form autocomplete="off">
|
<form autocomplete="off">
|
||||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="search" class="form-control " name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search templates">
|
<input type="search" class="form-control " name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search templates">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
@@ -78,6 +73,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$document_id = intval($row['document_id']);
|
$document_id = intval($row['document_id']);
|
||||||
$document_name = nullable_htmlentities($row['document_name']);
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
|
$document_description = nullable_htmlentities($row['document_description']);
|
||||||
$document_content = nullable_htmlentities($row['document_content']);
|
$document_content = nullable_htmlentities($row['document_content']);
|
||||||
$document_created_at = nullable_htmlentities($row['document_created_at']);
|
$document_created_at = nullable_htmlentities($row['document_created_at']);
|
||||||
$document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
$document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
||||||
@@ -87,7 +83,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="client_document_template_details.php?client_id=<?php echo $client_id; ?>&document_id=<?php echo $document_id; ?>"><i class="fas fa-fw fa-file-alt"></i> <?php echo $document_name; ?></a>
|
<a href="document_template_details.php?document_id=<?php echo $document_id; ?>"><i class="fas fa-fw fa-file-alt"></i> <?php echo $document_name; ?></a>
|
||||||
|
<small class="text-secondary mt-1"><?php echo $document_description; ?></small>
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo $document_created_at; ?></td>
|
<td><?php echo $document_created_at; ?></td>
|
||||||
<td><?php echo $document_updated_at; ?></td>
|
<td><?php echo $document_updated_at; ?></td>
|
||||||
@@ -113,7 +110,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include("client_document_template_edit_modal.php");
|
include("document_template_edit_modal.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -127,6 +124,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?php include("client_document_template_add_modal.php"); ?>
|
<?php include("document_template_add_modal.php"); ?>
|
||||||
|
|
||||||
<?php include("footer.php"); ?>
|
<?php include("footer.php"); ?>
|
||||||
@@ -128,6 +128,13 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="settings_document_templates.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "settings_document_templates.php") { echo "active"; } ?>">
|
||||||
|
<i class="nav-icon fas fa-file"></i>
|
||||||
|
<p>Document Templates</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li class="nav-header mt-3">SETTINGS</li>
|
<li class="nav-header mt-3">SETTINGS</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
|||||||
Reference in New Issue
Block a user