mirror of https://github.com/itflow-org/itflow
Removed the last bits of Document Tagging
This commit is contained in:
parent
1b866b75cd
commit
0fb4ff17a3
|
|
@ -1,71 +0,0 @@
|
|||
<div class="modal" id="manageTagsModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-md">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-tags"></i> Manage Tags</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body bg-white">
|
||||
<legend>Add Tag</legend>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="tag_name" placeholder="Tag Name" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<button type="submit" name="add_document_tag" class="btn btn-primary"><i class="fa fa-check"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
// Only show the edit/update tags if we have tags to work with
|
||||
if($document_tags){ ?>
|
||||
<hr>
|
||||
<legend>Delete Tag</legend>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<select class="form-control select2" name="tag_id" required>
|
||||
<?php
|
||||
foreach($document_tags as $document_tag) {
|
||||
echo "<option value='$document_tag[tag_id]'>"; echo htmlentities($document_tag['tag_name']); echo "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button type="submit" name="delete_document_tag" class="btn btn-danger"><i class="fa fa-trash"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<legend>Rename Tag</legend>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="form-group">
|
||||
<select class="form-control select2" name="tag_id" required>
|
||||
<?php
|
||||
foreach($document_tags as $document_tag) {
|
||||
echo "<option value='$document_tag[tag_id]'>"; echo htmlentities($document_tag['tag_name']); echo "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="tag_new_name" placeholder="Rename selected tag to" required>
|
||||
</div>
|
||||
<button type="submit" name="rename_document_tag" class="btn btn-primary"><i class="fa fa-exchange-alt"></i> Rename</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -165,6 +165,13 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
|
|||
if(CURRENT_DATABASE_VERSION == '0.0.5'){
|
||||
// Insert queries here required to update to DB version 0.0.6
|
||||
|
||||
mysqli_query($mysqli, "DROP TABLE `documents_tagged`;");
|
||||
mysqli_query($mysqli, "DROP TABLE `document_tags`;");
|
||||
}
|
||||
|
||||
if(CURRENT_DATABASE_VERSION == '0.0.6'){
|
||||
// Insert queries here required to update to DB version 0.0.7
|
||||
|
||||
// ALTER queries.....
|
||||
|
||||
// Then, update the database to the next sequential version
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
* It is used in conjunction with database_updates.php
|
||||
*/
|
||||
|
||||
DEFINE("LATEST_DATABASE_VERSION", "0.0.5");
|
||||
DEFINE("LATEST_DATABASE_VERSION", "0.0.6");
|
||||
82
post.php
82
post.php
|
|
@ -6908,7 +6908,6 @@ if(isset($_POST['add_document'])){
|
|||
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||
$tags_ids = $_POST['tags_ids'];
|
||||
$content = trim(mysqli_real_escape_string($mysqli,$purifier->purify(html_entity_decode($_POST['content']))));
|
||||
$content_raw = trim(mysqli_real_escape_string($mysqli, strip_tags($_POST['name'] . " " . str_replace("<", " <", $_POST['content']))));
|
||||
// Content Raw is used for FULL INDEX searching. Adding a space before HTML tags to allow spaces between newlines, bulletpoints, etc. for searching.
|
||||
|
|
@ -6922,14 +6921,6 @@ if(isset($_POST['add_document'])){
|
|||
// Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Document', log_action = 'Create', log_description = 'Created $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = '$client_id', company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
|
||||
// Add tags
|
||||
foreach($tags_ids as $tag_id) {
|
||||
$tag_id = intval($tag_id);
|
||||
if ($tag_id > 0) {
|
||||
mysqli_query($mysqli, "INSERT INTO documents_tagged SET document_id = '$document_id', tag_id = '$tag_id'");
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['alert_message'] = "Document added";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
|
@ -6953,7 +6944,6 @@ if(isset($_POST['edit_document'])){
|
|||
|
||||
$document_id = intval($_POST['document_id']);
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||
$tags_ids = $_POST['tags_ids'];
|
||||
$content = trim(mysqli_real_escape_string($mysqli,$purifier->purify(html_entity_decode($_POST['content']))));
|
||||
$content_raw = trim(mysqli_real_escape_string($mysqli, strip_tags($_POST['name'] . " " . str_replace("<", " <", $_POST['content']))));
|
||||
// Content Raw is used for FULL INDEX searching. Adding a space before HTML tags to allow spaces between newlines, bulletpoints, etc. for searching.
|
||||
|
|
@ -6966,16 +6956,6 @@ if(isset($_POST['edit_document'])){
|
|||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Document', log_action = 'Modify', log_description = '$name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, company_id = $session_company_id");
|
||||
|
||||
// Remove any old tags
|
||||
mysqli_query($mysqli, "DELETE FROM documents_tagged WHERE document_id = $document_id");
|
||||
|
||||
// Add tags
|
||||
foreach($tags_ids as $tag_id) {
|
||||
$tag_id = intval($tag_id);
|
||||
if ($tag_id > 0) {
|
||||
mysqli_query($mysqli, "INSERT INTO documents_tagged SET document_id = '$document_id', tag_id = '$tag_id'");
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['alert_message'] = "Document updated";
|
||||
|
||||
|
|
@ -6996,9 +6976,6 @@ if(isset($_GET['delete_document'])){
|
|||
|
||||
mysqli_query($mysqli,"DELETE FROM documents WHERE document_id = $document_id AND company_id = $session_company_id");
|
||||
|
||||
// Delete the tag associations to documents
|
||||
mysqli_query($mysqli, "DELETE FROM documents_tagged WHERE document_id = '$document_id'");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Document', log_action = 'Delete', log_description = '$document_id', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, company_id = $session_company_id");
|
||||
|
||||
|
|
@ -7087,65 +7064,6 @@ if(isset($_GET['delete_folder'])){
|
|||
|
||||
}
|
||||
|
||||
if (isset($_POST['add_document_tag'])) {
|
||||
|
||||
if($session_user_role == 1){
|
||||
$_SESSION['alert_type'] = "danger";
|
||||
$_SESSION['alert_message'] = WORDING_ROLECHECK_FAILED;
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
exit();
|
||||
}
|
||||
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$tag_name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['tag_name'])));
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO document_tags SET client_id = '$client_id', tag_name = '$tag_name'");
|
||||
|
||||
$_SESSION['alert_message'] = "Document tag added";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_POST['delete_document_tag'])) {
|
||||
|
||||
if($session_user_role != 3){
|
||||
$_SESSION['alert_type'] = "danger";
|
||||
$_SESSION['alert_message'] = WORDING_ROLECHECK_FAILED;
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
exit();
|
||||
}
|
||||
|
||||
$tag_id = intval($_POST['tag_id']);
|
||||
|
||||
// Delete the tag ID
|
||||
mysqli_query($mysqli, "DELETE FROM document_tags WHERE tag_id = '$tag_id'");
|
||||
|
||||
// Delete the associations to documents
|
||||
mysqli_query($mysqli, "DELETE FROM documents_tagged WHERE tag_id = '$tag_id'");
|
||||
|
||||
$_SESSION['alert_message'] = "Document tag deleted";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_POST['rename_document_tag'])) {
|
||||
|
||||
if($session_user_role == 1){
|
||||
$_SESSION['alert_type'] = "danger";
|
||||
$_SESSION['alert_message'] = WORDING_ROLECHECK_FAILED;
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
exit();
|
||||
}
|
||||
|
||||
$tag_id = intval($_POST['tag_id']);
|
||||
$tag_new_name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['tag_new_name'])));
|
||||
|
||||
// Rename tag in db
|
||||
mysqli_query($mysqli, "UPDATE document_tags SET tag_name = '$tag_new_name' WHERE tag_id = '$tag_id'");
|
||||
|
||||
$_SESSION['alert_message'] = "Document tag updated";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if(isset($_GET['deactivate_shared_item'])){
|
||||
if($session_user_role != 3){
|
||||
$_SESSION['alert_type'] = "danger";
|
||||
|
|
|
|||
Loading…
Reference in New Issue