WebFund 2015W: Assignment 6

From Soma-notes

In this assignment you will be modifying the persistent notes demo from Tutorial 6. There are 10 points in 5 tasks. This assignment is due by 10 AM on Monday, March 9, 2015 Wednesday, March 11, 2015.

Please submit your answers as a zip file called "<username>-comp2406-assign6.zip", where username is your MyCarletonOne username. This zip file should uncompress to a directory called "<username>-comp2406-assign6" and inside this directory should be two things: a directory "persistent-notes" that contains the application and a text file "comments.txt".

"comments.txt" should:

  • list any references you used to complete the assignment (documentation web sites, for example),
  • list your collaborators, and
  • optionally, should discuss any issues or concerns you had when completing this assignment.

Remember that while you are allowed to collaborate with others, plagiarism is not allowed. In other words you should not be copying any code or data directly from anywhere, and any assistance or inspiration should be credited. Any significant code similarity (beyond the code already given to you) will be considered plagiarism and will be reported to the Dean.

Tasks

  1. [1] Make it so the contents of notes escape embedded HTML tags (just as is done in the note title).
  2. [1] Add a Cancel button to the Note editor page. It should be a button (like the other buttons in the application) that takes the user back to the notes listing page. The cancel button should have an id="cancel" assigned.
  3. [2] Implement a note delete button on the edit note page. This delete button should redirect to a page /delete/<note ID> that asks the user to confirm whether to delete the note. This page should have a form that does a POST to /delete with a hidden id field for the note ID that actually does the deletion. The result of this POST should be a page that says whether the deletion succeeded or not then gives a link to go back to /notes. The delete button should have an id="delete" assigned. On the confirmation page, the form should have a name="form_confirm".
  4. [2] Allow links to be embedded in notes using the syntax of "[<link> <label>]" where link is a URL for an <a> tag and the label (the rest of the text in the square brackets) is the label for the URL. If there is no label then the link itself should be the <a> tag's label.
  5. [4] Add a Change Username button to /notes that allows you to change the username for a user.
    • This button should have an id=changeusername assigned. It should cause a GET of a page called /changeusername.
    • GET /changeusername should ask the user for the new username. The text field for the changed username should have a name="username" as part of a form that has a POST action of /changeusername.
    • POST /changeusername should report whether the username change succeeded or failed and should then have a link that goes back to /notes.
    • The new username can be any username that is not currently being used by any stored notes. Note that you'll need to change the username in the session and update the owner field in stored notes as appropriate.

Solutions

Solutions to this assignment are now available.