Skip to content

Commit

Permalink
comment out learning outcomes and fixed upload image flaw
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincharles committed Mar 31, 2023
1 parent 334d4d5 commit 1d81fc9
Show file tree
Hide file tree
Showing 6 changed files with 212 additions and 189 deletions.
316 changes: 158 additions & 158 deletions doenet_docker/volumes/db_init/db_template.sql

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions public/api/createPortfolioActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
$pageDoenetId .
'"],"assignedCid":null,"draftCid":null,"itemWeights": [1],"files":[]}';
$imagePath = '/activity_default.jpg';
$learningOutcomes = '';
// $learningOutcomes = '';
$isPublic = '0';

$sql = "SELECT sortOrder
Expand All @@ -98,11 +98,19 @@
$sql = "
INSERT INTO course_content
(type,courseId,doenetId,parentDoenetId,label,creationDate,isPublic,
sortOrder,jsonDefinition,imagePath,learningOutcomes)
sortOrder,jsonDefinition,imagePath)
VALUES
('activity','$portfolioCourseId','$doenetId','$portfolioCourseId','$label',CONVERT_TZ(NOW(), @@session.time_zone, '+00:00'),'$isPublic',
'$sortOrder','$jsonDefinition','$imagePath','$learningOutcomes')
'$sortOrder','$jsonDefinition','$imagePath')
";
// $sql = "
// INSERT INTO course_content
// (type,courseId,doenetId,parentDoenetId,label,creationDate,isPublic,
// sortOrder,jsonDefinition,imagePath,learningOutcomes)
// VALUES
// ('activity','$portfolioCourseId','$doenetId','$portfolioCourseId','$label',CONVERT_TZ(NOW(), @@session.time_zone, '+00:00'),'$isPublic',
// '$sortOrder','$jsonDefinition','$imagePath','$learningOutcomes')
// ";

$conn->query($sql);

Expand Down
14 changes: 11 additions & 3 deletions public/api/getPortfolioActivityData.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
'doenetId' => $doenetId,
'imagePath' => '/activity_default.jpg',
'label' => '',
'learningOutcomes' => '',
// 'learningOutcomes' => '',
'public' => false, //default to private
'isNew' => true,
'pageDoenetId' => $pageDoenetId,
Expand Down Expand Up @@ -78,10 +78,18 @@
}
//Assume we are updating the activity and need the current settings
if ($success) {
// $sql = "
// SELECT imagePath,
// label,
// learningOutcomes,
// isPublic
// FROM course_content
// WHERE doenetId='$doenetId'
// AND courseId = (SELECT courseId FROM course WHERE portfolioCourseForUserId = '$userId')
// ";
$sql = "
SELECT imagePath,
label,
learningOutcomes,
isPublic
FROM course_content
WHERE doenetId='$doenetId'
Expand All @@ -95,7 +103,7 @@
'doenetId' => $doenetId,
'imagePath' => $row['imagePath'],
'label' => $row['label'],
'learningOutcomes' => $row['learningOutcomes'],
// 'learningOutcomes' => $row['learningOutcomes'],
'public' => $row['isPublic'],
'isNew' => false,
'pageDoenetId' => $pageDoenetId,
Expand Down
20 changes: 14 additions & 6 deletions public/api/updatePortfolioActivitySettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
$label = mysqli_real_escape_string($conn, $_POST['label']);
$imagePath = mysqli_real_escape_string($conn, $_POST['imagePath']);
$public = mysqli_real_escape_string($conn, $_POST['public']);
$learningOutcomes = mysqli_real_escape_string(
$conn,
$_POST['learningOutcomes']
);
// $learningOutcomes = mysqli_real_escape_string(
// $conn,
// $_POST['learningOutcomes']
// );

$isPublic = '0';
if ($public) {
Expand Down Expand Up @@ -88,12 +88,20 @@
}

if ($success) {
// $sql = "
// UPDATE course_content
// SET label = '$label',
// imagePath = '$imagePath',
// isPublic = '$isPublic',
// learningOutcomes = '$learningOutcomes'
// WHERE doenetId = '$doenetId'
// AND courseId = '$portfolioCourseId'
// ";
$sql = "
UPDATE course_content
SET label = '$label',
imagePath = '$imagePath',
isPublic = '$isPublic',
learningOutcomes = '$learningOutcomes'
isPublic = '$isPublic'
WHERE doenetId = '$doenetId'
AND courseId = '$portfolioCourseId'
";
Expand Down
32 changes: 16 additions & 16 deletions public/api/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@

//Test if user has permission to upload files

$canUpload = false;
$sql = "
SELECT canUpload
FROM user
WHERE userId = '$userId'
";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
if ($row['canUpload'] == '1') {
$canUpload = true;
}

if (!$canUpload) {
$success = false;
$msg = "You don't have permission to upload files.";
}
// $canUpload = false;
// $sql = "
// SELECT canUpload
// FROM user
// WHERE userId = '$userId'
// ";
// $result = $conn->query($sql);
// $row = $result->fetch_assoc();
// if ($row['canUpload'] == '1') {
// $canUpload = true;
// }

// if (!$canUpload) {
// $success = false;
// $msg = "You don't have permission to upload files.";
// }

//Test if user has space to upload files
if ($success) {
Expand Down
5 changes: 2 additions & 3 deletions src/Tools/_framework/Paths/PortfolioActivitySettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export async function action({ request, params }) {
return redirect(`/portfolio/${portfolioCourseId}`)
}



// if (response.ok) {
// // let { doenetId } = await response.json();
Expand Down Expand Up @@ -271,10 +270,10 @@ export function PortfolioActivitySettings(){
<Td>Activity Label</Td>
<Td><input name="label" style={{width:"390px"}} type="text" placeholder='Activity 1' defaultValue={data.label}/></Td>
</tr>
<tr>
{/* <tr>
<Td>Learning Outcomes</Td>
<Td><textarea name="learningOutcomes" style={{width:"390px",resize: "vertical"}} placeholder='Description of Learning Outcomes' defaultValue={data.learningOutcomes}/></Td>
</tr>
</tr> */}
<tr>
<Td>Public <input name="public" type="checkbox" defaultChecked={data.public == '1'} /></Td>
<Td></Td>
Expand Down

0 comments on commit 1d81fc9

Please sign in to comment.