-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Spasht):Added new API request to send data back to clearlyDefined #2261
base: master
Are you sure you want to change the base?
feat(Spasht):Added new API request to send data back to clearlyDefined #2261
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do the required fix
@@ -141,6 +141,12 @@ public function Output() | |||
$typeName = trim(GetParm("typeName", PARM_STRING)); | |||
$providerName = trim(GetParm("providerName", PARM_STRING)); | |||
|
|||
// Reading contribution data | |||
$coordinatesInfo = trim(GetParm("jsonStringCoordinates", PARM_STRING)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The coordinates should be read from the database for the upload. A client can manipulate the request data and put invalid coordinates.
$contributionPacket["contributionInfo"] = $contributionInfo; | ||
$patches =array(); | ||
|
||
$patch = array(); | ||
$patch["coordinates"] = $coordinatesInfo; | ||
$revision = array(); | ||
$contributionFiles = array(); | ||
$file = array(); | ||
$file["path"] = ""; | ||
$file["license"] = ""; | ||
$file["attributions"] = ""; | ||
|
||
array_push($contributionFiles, $file); | ||
|
||
$revision[$contributionRevision]["files"] = $contributionFiles; | ||
$patch["revisions"] = $revision; | ||
|
||
array_push($patches, $patch); | ||
$contributionPacket["patches"] = $patches; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the indentation.
$file["license"] = ""; | ||
$file["attributions"] = ""; | ||
|
||
array_push($contributionFiles, $file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be simplified.
array_push($contributionFiles, $file); | |
$contributionFiles[] = $file; |
$revision[$contributionRevision]["files"] = $contributionFiles; | ||
$patch["revisions"] = $revision; | ||
|
||
array_push($patches, $patch); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
array_push($patches, $patch); | |
$patches[] = $patch; |
$patch["coordinates"] = $coordinatesInfo; | ||
$revision = array(); | ||
$contributionFiles = array(); | ||
$file = array(); | ||
$file["path"] = ""; | ||
$file["license"] = ""; | ||
$file["attributions"] = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a PHP class for the data structure in src/lib/php/Data/Spasht.
<tr> | ||
<td> | ||
<p style="text-align:left">Title</p> | ||
<input type="text" id="ContributionTitle" style="width:100%"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use required attribute to allow user to understand it is a required field.
$("#contributionDataValid").val("true"); | ||
$("#contributtionSubmitButton").submit(); | ||
} else { | ||
$("#contributionDataValid").val("false"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a feedback if the data is invalid. Otherwise, user might click on the button and wait for the page to load/do something.
Can we take this as medium project in gsoc 2023 |
Description
This PR introduces a new API request to send data back to clearlyDefined.
Changes
src/spasht/ui/ui-spasht.php
src/spasht/ui/template/agent_spasht_contribute.html.twig
src/spasht/ui/template/agent_spasht.js.twig
src/spasht/ui/template/agent_spasht_ui_tabs.html.twig
How to test