Commit 8e4e2233 authored by jlopez's avatar jlopez
Browse files

Merge branch 'develop' into 'master'

Add tags

Closes #14

See merge request !5
parents f123b4be 6825a600
Pipeline #204 passed with stage
in 43 seconds
Dockerfile.stable
\ No newline at end of file
Dockerfile.develop
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: jimmy
* Date: 01/02/19
* Time: 13:55
*/
class Tool
{
}
\ No newline at end of file
......@@ -38,6 +38,7 @@ $visibility = "public";
$description = NULL;
$author = 0;
$labels = array();
$tags = "";
if(isset($_POST['containerid'])) {
$id = $_POST['containerid'];
......@@ -75,7 +76,13 @@ if(isset($_POST['labels'])) {
$labels = $_POST['labels'];
}
$container = new Container($id, $name, $value, $type, $visibility, $description, $author, $today);
if(isset($_POST['tags'])) {
$tags = $_POST['tags'];
$tags = preg_replace("/[\n\r]/","",$tags);
$tags = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $tags);
}
$container = new Container($id, $name, $value, $type, $visibility, $description, $author, $today, $tags);
if($action == "create") {
$container->escape($db);
......
......@@ -9,70 +9,9 @@ $db = new DBquery();
$containers = $db->getContainers();
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" crossorigin="anonymous">
<!-- local fallbacks -->
<!--link rel="stylesheet" href="./inc/css/bootstrap.min.css">
<link rel="stylesheet" href="./inc/css/jquery.dataTables.min.css"-->
<link rel="stylesheet" href="./inc/css/style.css">
<script src="./inc/js/jscolor.js"></script>
<title>wicopa</title>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark navbar-custom p-1">
<a class="navbar-brand" href="#">WICOPA</a>
<div class="collapse navbar-collapse justify-content-between" id="navbar">
<div class="navbar-nav">
<?php
echo ' <a class="nav-item nav-link" href="./index.php"> Home </a>';
echo ' <a class="nav-item nav-link active" href="./container.php"> Containers </a>';
if(isset($_SESSION['username']) && !empty($_SESSION['username']))
{
if(isset($_SESSION['manage']) && !empty($_SESSION['manage']))
{
echo ' <a class="nav-item nav-link" href="./manage.php"> Manage </a>';
}
}
?>
</div>
<div class="navbar-nav">
<?php
if(isset($_SESSION['username']) && !empty($_SESSION['username']))
{
echo '<a class="nav-item btn btn-primary " href="./action/action_logout.php"> Logout ('.$_SESSION['username'].') </a>';
}
else
{
echo '<a class="nav-item btn btn-primary" href="./login.php"> Login </a>';
}
?>
</div>
</nav>
require_once "./inc/php/buildHeader.php";
?>
<div class="container-fluid">
......@@ -89,6 +28,7 @@ $containers = $db->getContainers();
<th>Name</th>
<th>Author</th>
<th>Labels</th>
<th>Tags</th>
<th>Date</th>
<th>Description</th>
<th>Action</th>
......@@ -154,6 +94,24 @@ $containers = $db->getContainers();
echo '</td>';
$tags = explode( ' ', $container->tags );
$index = 0;
echo '<td>';
foreach ($tags as $tag) {
echo '<span class="badge" style="background:#'."30336b".'; color:#FFFFFF">'.$tag.'</span>';
/*if($index == 3) {
echo '<br/>';
$index = 0;
} else {
$index++;
} */
}
echo '</td>';
echo '<td>' . $container->date . '</td>';
echo '<td>' . $container->description . '</td>';
......
......@@ -175,7 +175,7 @@ class DBquery
$result = mysqli_query($this->dbh, $sql);
$results = array();
while($row = mysqli_fetch_assoc($result)){
$cnt = new Container($row['ID'], $row['name'], $row['value'], $row['type'], $row['visibility'], $row['description'], $row['author'], $row['date']);
$cnt = new Container($row['ID'], $row['name'], $row['value'], $row['type'], $row['visibility'], $row['description'], $row['author'], $row['date'], $row['tags']);
array_push($results, $cnt);
}
return $results;
......
<?php
echo '
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" crossorigin="anonymous">
<!-- local fallbacks -->
<!--link rel="stylesheet" href="./inc/css/bootstrap.min.css">
<link rel="stylesheet" href="./inc/css/jquery.dataTables.min.css"-->
<link rel="stylesheet" href="./inc/css/style.css">
<script src="./inc/js/jscolor.js"></script>
<title>wicopa</title>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark navbar-custom p-1">
<a class="navbar-brand" href="#">WICOPA</a>
<div class="collapse navbar-collapse justify-content-between" id="navbar">
<div class="navbar-nav">
';
echo ' <a class="nav-item nav-link" href="./index.php"> Home </a>';
echo ' <a class="nav-item nav-link" href="./container.php"> Containers </a>';
if(isset($_SESSION['username']) && !empty($_SESSION['username']))
{
if(isset($_SESSION['manage']) && !empty($_SESSION['manage']))
{
echo ' <a class="nav-item nav-link" href="./manage.php"> Manage </a>';
// echo ' <a class="nav-item nav-link" href="./config.php"> Configs </a>';
}
}
echo '
</div>
<div class="navbar-nav">
';
if(isset($_SESSION['username']) && !empty($_SESSION['username']))
{
echo '<a class="nav-item btn btn-primary " href="./action/action_logout.php"> Logout ('.$_SESSION['username'].') </a>';
}
else
{
echo '<a class="nav-item btn btn-primary" href="./login.php"> Login </a>';
}
echo '</div>
</nav>
';
......@@ -43,70 +43,9 @@ foreach ($db->getAllActiveSectionParent() as $s){
}
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" crossorigin="anonymous">
<!-- local fallbacks -->
<!--link rel="stylesheet" href="./inc/css/bootstrap.min.css">
<link rel="stylesheet" href="./inc/css/jquery.dataTables.min.css" crossorigin="anonymous"-->
<link rel="stylesheet" href="./inc/css/style.css">
<title>wicopa</title>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark navbar-custom p-1">
<a class="navbar-brand" href="#">WICOPA</a>
<div class="collapse navbar-collapse justify-content-between" id="navbar">
<div class="navbar-nav">
<?php
echo ' <a class="nav-item nav-link active" href="./index.php"> Home </a>';
echo ' <a class="nav-item nav-link" href="./container.php"> Containers </a>';
if(isset($_SESSION['username']) && !empty($_SESSION['username']))
{
if(isset($_SESSION['manage']) && !empty($_SESSION['manage']))
{
echo ' <a class="nav-item nav-link" href="./manage.php"> Manage </a>';
}
}
?>
</div>
<div class="navbar-nav">
<?php
if(isset($_SESSION['username']) && !empty($_SESSION['username']))
{
echo '<a class="nav-item btn btn-primary " href="./action/action_logout.php"> Logout ('.$_SESSION['username'].') </a>';
}
else
{
echo '<a class="nav-item btn btn-primary" href="./login.php"> Login </a>';
}
?>
</div>
</nav>
require_once "./inc/php/buildHeader.php";
?>
<div class="container-fluid">
......@@ -428,6 +367,10 @@ foreach ($db->getAllActiveSectionParent() as $s){
</select>
</div>
<div class="form-group">
<label for="tagsContainer">Tags :</label>
<textarea class="form-control" rows="5" id="tagsContainer" maxlength="500" name ="tags"></textarea>
</div>
</div>
......
......@@ -6,10 +6,12 @@
* Time: 10:10
*/
//include('../include/buildHeader.php');
require_once "./inc/php/buildHeader.php";
?>
<<<<<<< HEAD
=======
<!doctype html>
<html lang="en">
<head>
......@@ -62,6 +64,7 @@
</nav>
>>>>>>> f123b4be009adfbfca34a7889a496e1d4a6ec6ff
<div class="container-fluid">
......
......@@ -47,69 +47,9 @@ foreach ($grades as $grade) {
}
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" crossorigin="anonymous">
<!-- local fallbacks -->
<!--link rel="stylesheet" href="./inc/css/bootstrap.min.css">
<link rel="stylesheet" href="./inc/css/jquery.dataTables.min.css"-->
<link rel="stylesheet" href="./inc/css/style.css">
<script src="./inc/js/jscolor.js"></script>
<title>wicopa</title>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark navbar-custom p-1">
<a class="navbar-brand" href="#">WICOPA</a>
<div class="collapse navbar-collapse justify-content-between" id="navbar">
<div class="navbar-nav">
<?php
echo ' <a class="nav-item nav-link" href="./index.php"> Home </a>';
echo ' <a class="nav-item nav-link" href="./container.php"> Containers </a>';
if(isset($_SESSION['username']) && !empty($_SESSION['username']))
{
if(isset($_SESSION['manage']) && !empty($_SESSION['manage']))
{
echo ' <a class="nav-item nav-link active" href="./manage.php"> Manage </a>';
}
}
?>
</div>
<div class="navbar-nav">
<?php
if(isset($_SESSION['username']) && !empty($_SESSION['username']))
{
echo '<a class="nav-item btn btn-primary " href="./action/action_logout.php"> Logout ('.$_SESSION['username'].') </a>';
}
else
{
echo '<a class="nav-item btn btn-primary" href="./login.php"> Login </a>';
}
?>
</div>
</nav>
require_once "./inc/php/buildHeader.php";
?>
<div class="container-fluid">
......@@ -737,10 +677,13 @@ foreach ($grades as $grade) {
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<<<<<<< HEAD
=======
<!-- local fallbaks -->
<!--script src="inc/js/jquery-latest.min.js" type="text/javascript"></script>
<script src="inc/js/bootstrap.min.js" type="text/javascript"></script-->
>>>>>>> f123b4be009adfbfca34a7889a496e1d4a6ec6ff
</body>
</html>
\ No newline at end of file
......@@ -18,6 +18,7 @@ class Container
var $description = "";
var $author = 0;
var $date = NULL;
var $tags = "";
/**
* Container constructor.
......@@ -25,7 +26,7 @@ class Container
* @param string $name
* @param int $type
*/
public function __construct($ID, $name, $value, $type, $visibility, $description, $author, $date)
public function __construct($ID, $name, $value, $type, $visibility, $description, $author, $date, $tags)
{
$this->ID = $ID;
$this->name = $name;
......@@ -35,29 +36,32 @@ class Container
$this->description = $description;
$this->author = $author;
$this->date = $date;
$this->tags = $tags;
}
public function escape(DBquery $db) {
$this->name = utf8_decode($db->escape($this->name));
$this->value = utf8_decode($db->escape($this->value));
$this->description = utf8_decode($db->escape($this->description));
$this->tags = utf8_decode($db->escape($this->tags));
}
public function escape2(DBquery $db) {
$this->name = utf8_encode($db->escape($this->name));
$this->value = utf8_encode($db->escape($this->value));
$this->description = utf8_encode($db->escape($this->description));
$this->tags = utf8_encode($db->escape($this->tags));
}
public function getInsert() {
return "INSERT INTO Container (name, value, type, visibility, description, author, date)
VALUES ('$this->name', '$this->value', '$this->type', '$this->visibility', '$this->description', '$this->author', '$this->date');";
return "INSERT INTO Container (name, value, type, visibility, description, author, date, tags)
VALUES ('$this->name', '$this->value', '$this->type', '$this->visibility', '$this->description', '$this->author', '$this->date', '$this->tags');";
}
public function getUpdate() {
return "UPDATE Container
SET name='$this->name', value='$this->value', type='$this->type',
visiblity='$this->visibility', description='$this->description', author='$this->author', date='$this->date'
visiblity='$this->visibility', description='$this->description', author='$this->author', date='$this->date', tags='$this->tags'
WHERE ID = '$this->ID';";
}
......
......@@ -51,4 +51,4 @@ class Label
return "DELETE FROM Label WHERE ID = '$this->ID';";
}
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment