Assignment 5

Due Mon., November 22, 2010

Summary

In this assignment, you will add event-based JavaScript code to our project management interface in order to make the Action panel functional. In other words, the action panel should respond to clicks on the star icon for flagging/unflagging an item, the cross icon for deleting, the pencil icon for editing, etc.

What To Do

Step 1: Create a folder on your own computer.
Step 2: Copy down all of the files needed for assignment 5.

These files are located at the following filepath on login.cs.unc.edu:
/afs/cs.unc.edu/proj/courses/comp416-f10/public_html/assignments/a5/a5-files/

Step 3: Understand the structure of the action item divs.

The project code generates a <div> for each unmarked action item with the following form:

<div id="action_N" class="list_item odd">
  <div class="item_label">
    <a href="view_action-v40.php?id=N">Action description</a>
  </div>
  <div class="item_actions">
    <a href="mark_action-v40.php?id=N"><img class="mark icon" src="checkbox.png" alt="Mark" /></a>
    <a href="flag_action-v40.php?id=N"><img class="flag icon" src="star-dim.png" alt="Unflagged" /></a>
    <a href="edit_action-v40.php?id=N"><img class="edit icon" src="pencil.png" alt="Edit" /></a>
    <a href="delete_action-v40.php?id=N"><img class="delete icon" src="cross.png" alt="Delete" /></a>
 </div>
</div>

This is essentially the same as what your code for Assignment 4 was to produce. One important difference is that the div has its id attribute set to a string that starts with "action_" and then has the numerical id associated with the action object from the project_info data structure appended. In the template above, this numerical id value is represented by N.

Other parts of the template above that will depend on the specific action item include:

odd
This class name will be either "odd" or "even" depending on its position in the panel.
Action description
This will be the action's text.
start-dim.png
The file name for the flag icon image will be "star-dim.png" for unflagged items and "star-bright.png" for flagged items.
Unflagged
The alt text for the flag icon image will be "Unflagged" for unflagged items and "Flagged" for flagged items.
Step 4: Associate event handlers for the flag, edit, and delete icons

Add code to the end of the init() function to register event handlers for the flag, edit, and delete icons for each of the action items. These handlers should be observing mouse clicks on these items. The project includes code that does something similar for the Notes panel and you can use that code as a template for your own.

Step 5: Implement the click event handler for the flag icon

The event handler that handles clicks for the flag icon should do the following:

The project includes code in the function handleNoteFlag for handling flag icon clicks for the items in the Notes panel that you can use as a template for your code.

Step 6: Implement the click event handler for the delete icon

The event handler for clicks on the delete icon should do the following:

The project includes code in the function handleNoteDelete for handling delete icon clicks for the items in the Notes panel that you can use as a template for your code.

Step 7: Implement the click event handler for the mark as done checkbox

The event handler that handles clicks for the completion mark checkbox icon should do the following:

Step 8: Set up and implement a click handler for the plus sign in the Actions panel header for creating a new action item.

The event handler should do the following:

The project includes code in the functions showNewNoteForm, handleNewNoteCreate, and handleNewNoteCancel for adding this functionality for notes. You can use as a template for your code.

Step 9: Create an "a5" directory in your class webspace and upload all of the files to this directory.

Extra Credit

Implement the following functionality for extra credit: