Commit 250d3bcc authored by GROSS-AMBLARD David's avatar GROSS-AMBLARD David
Browse files

Embark page first draft (unfinished)

parent d0be9472
......@@ -33,6 +33,7 @@ class ChatController {
$taskid = NULL;
if (isset($_POST['task_id'])) {
$taskid = $_POST['task_id'];
debug("taskid $taskid");
}
$topicId = intval($this->model->getTopicIdFrom($taskid));
if ($topicId == 0) {
......
......@@ -14,7 +14,7 @@ class ChatModel {
* @param int $taskId The ID of the task of the topic. If NULL, the topic is at the project-level.
*/
function getTopicIdFrom($taskId = NULL) {
try {
debug("here");
$query = "SELECT id_topic FROM chat_topic WHERE id_task = :task";
if (is_null($taskId)) {
$query = "SELECT id_topic FROM chat_topic WHERE id_task IS NULL";
......@@ -26,9 +26,6 @@ class ChatModel {
$stmt->execute();
$result = $stmt->fetchColumn();
return $result;
} catch (Exception $e) {
die('Error : '.$e->getMessage());
}
}
/**
......
......@@ -91,15 +91,11 @@
function HWdbconnect()
{
// database connection
try {
$conn = new PDO("mysql:host=".SERVERNAME.";dbname=".DATABASE."; charset=utf8", USERNAME, PASSWORD);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
debug("Connected successfully");
return $conn;
} catch (PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}
}
/*
......@@ -110,6 +106,7 @@
$stmt = $conn->query("select distinct project from ArtifactClass");
while($project=@$stmt->fetch()['project'])
array_push($projects,$project);
array_push($projects,'MyOwnProject');
return $projects;
}
?>
......@@ -441,3 +441,12 @@ function DEPRECATEDchooseArtifactH($conn, $id, $artifact)
debug("update date");
showAllTasks($conn);
}
/**
* Add a new artifact class to the MyOwnProject projectegory is 'task')
* @param string $content
*/
function addArtifact($conn,$json){
global $VIEW;
$VIEW['MAIN'].="Did it<pre>$json</pre>";
}
......@@ -23,6 +23,12 @@
<li><a href="https://www.linkedin.com/in/adrien-wacquet-321729185?lipi=urn%3Ali%3Apage%3Ad_flagship3_profile_view_base_contact_details%3B3MisevnYRhyUXreTwAzlzA%3D%3D"> Adrien Wacquet (Irisa, ISTIC, Rennes 1): task user interface, chat, feedbacks, forum, Ajax</a></li>
</ul>
<h2>Dev Movie (from start to 05-2021)</h2>
<center>
<iframe width="560" height="315" src="https://www.youtube.com/embed/O-SCYRvR1R0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</center>
<h2>Powered by</h2>
<ul class='creditlist'>
<li>First-order logic
......
......@@ -161,6 +161,12 @@ switch ($mode) {
startArtifact($conn, $_GET['artifactid'],$_SESSION['id']);
showTasks($conn);
break;
case "embark":
embark($conn);
break;
case "addArtifact":
addArtifact($conn,$_POST['artifact']);
break;
default:
showHome();
break;
......
......@@ -71,19 +71,6 @@ CREATE TABLE IF NOT EXISTS Answer (
-- KEY iduser (iduser)
-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `feedback`
--
DROP TABLE IF EXISTS `feedback`;
CREATE TABLE `feedback` (
`idfeedback` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`iduser` int(11) NOT NULL,
`page` varchar(128) NOT NULL,
`text` text NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
......
......@@ -98,9 +98,14 @@ function fillChatPosts(type) {
$.ajax({
type: "POST",
url: ajaxUrl + "getPostsFromTopic",
data: { topic_id: $('#chat' + type + 'Id').val() },
data: {topic_id: $('#chat' + type + 'Id').val()},
success: function(data) {
jsonData = JSON.parse(data);
jsonData=[];
try {
jsonData = JSON.parse(data);
}
catch (e){
}
var i = 1;
jsonData.forEach(element => {
if (i > $('#chat' + type + 'PostsNumber').val()) {
......
background: no-repeat bottom right/20% url('projects/Headwork/bulb_textUnder_bubbles.png');
<h1>Welcome to your own project</h1>
<p>
In HEADWORK, anyone can propose a new project and benefit from the crowd. To create a new activity, go the
the <a href="index.php?mode=embark">Embark</a> page.
</p>
{
"doc":"Demo of a Wirk service call",
"author":"David Gross-Amblard, Léo Jacoboni",
"1": {
"2": {
"guard": "select true from dual",
"actions": [
"select @TEMPLATE:='Give the URL of a picture, I will guess its content!'",
"select @TITLE:='Image Oracle'",
"select @CHECKER:='REGEXP ''^(https?://|www[.period.])[A-Za-z0-9-]+[.period.][a-zA-Z]{2,4}'''",
"select @CHECKERMSG:='Please enter a valid URL (http://, https://, ...)'",
"select @TYPE:=NULL",
"select @ARTIFACTID:=CURRENT_ARTIFACT",
"insert into Task(id,title,description,body,checker,checkermsg,type,artifact) values (1,'demo',@TITLE,@TEMPLATE,@CHECKER,@CHECKERMSG,@TYPE,@ARTIFACTID)",
"insert into Profile values (1,CURRENT_ARTIFACT,1)"
]
}
},
"2": {
"3": {
"guard": "select true from Answered where id=1 and artifact=CURRENT_ARTIFACT",
"actions": [
"call wirk image annotator as task 3 for 'select value from Answer where idtask=1 and artifact=CURRENT_ARTIFACT'",
"delete from Task where artifact=CURRENT_ARTIFACT",
"prepare task 2 as message",
"use 'Waiting for the oracle' as title",
"use 'Waiting for the oracle' as description",
"select @TEMPLATE:='Wait for around 3mn, press the Submit button to refresh'",
"forget profile for current artifact",
"offer task to anyone",
"install task"
]
}
},
"3": {
"4": {
"guard": "task 3 is answered",
"actions": [
"delete from Task where artifact=CURRENT_ARTIFACT",
"prepare task 4 as message",
"use 'I got it!' as title",
"use 'I got it!' as description",
"select @RESULT:=value from Answer where idtask=3 and user=SESSION_USER and artifact=CURRENT_ARTIFACT",
"select @TEMPLATE:=concat('I think this is ...',@RESULT,'!') from dual",
"forget profile for current artifact",
"offer task to anyone",
"install task"
]
},
"3":{
"guard": "task 2 is answered",
"actions":[
"check wirk answer",
"delete from Answer where idtask=2 and artifact=CURRENT_ARTIFACT",
"delete from Answered where id=2 and artifact=CURRENT_ARTIFACT"
]
}
},
"4": {
"5":{
"guard":"task 4 is answered",
"actions":[
"delete from Task where artifact=CURRENT_ARTIFACT"
]
}
},
"5":{}
}
......@@ -1256,3 +1256,14 @@ function searchForum($getArray)
$VIEW['MAIN'] .= $topics;
}
}
/**
* Show the Embark page
* @param A valid PDO connection
*/
function embark($conn){
global $VIEW;
$VIEW['MAIN']=file_get_contents("templates/template-embark.tmpl");
// TODO: insert new artifact class from code. Check json encoding first
}
......@@ -79,7 +79,8 @@
</div>
</li>
<li class="nav-item"><a class="nav-link white" href="index.php?mode=showTasks">Contribute!</a></li>
<li class="nav-item"><a class="nav-link" href="index.php?mode=skills">Skills</a></li>
<li class="nav-item"><a class="nav-link" href="index.php?mode=skills">Progess</a></li>
<li class="nav-item"><a class="nav-link" href="index.php?mode=embark">Embark others</a></li>
<!-- <li class="nav-item"><a class="nav-link"
href="index.php?mode=profile">My profile</a></li> -->
<li class="nav-item"><a class="nav-link"
......
<h1>Embark others!</h1>
<p>
Do not hesitate to ask you own questions! Many contributors may give you intersesting insights!
</p>
<p>
Fill in your query. The ongoing task will appear in the project "My own project"
</p>
<p>
UNDER DEVELOPMENT: COMING SOON!
</p>
<pre>
Ask to anyone "If I should see only one, which cyberpunk movie should I see?"
</pre>
<form action="index.php?mode=addArtifact" method="POST">
<input type="hidden" id="artifact" name="artifact" value='
{
"doc":"My own activity",
"author":"You",
"1": {
"2": {
"guard": "none",
"actions": [
"prepare task 1 as basic",
"use &apos;Simple question, simple checking&apos; as title",
"use &apos;Simple question, simple checking&apos; as description",
"forget profile for current artifact",
"offer task to anyone",
"install task"
]
}
},
"2": {}
}
'>
<input type="submit" value="submit">
</form>
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