% if ($is_faculty_edit){ %# The form that starts here ends in the edit.mhtml component.
% }
 grade : % if ($is_faculty_edit){ % } % else { <& grade.mhtml, work => $work &> % }

<% $assignment %> <% $student %>'s work

<%$due%>
<%$submitted%>

%# <% $msg %> %# ====================================================================== <%args> $action => '' $submit_edit => '' $edit_grade => '' <%init> my $work = $page->work or return; my $is_faculty = $page->role->ge_faculty; my $is_faculty_edit = ($is_faculty and $action eq 'edit'); my $assignment = $work->assignment->name; # my $student = $work->person->name; # BUG - sometimes is blank my $student = $work->person->get('name'); my $assign_uri = $page->course->directory_uri . '/special/assignment?id=' . $work->assignment->id; my $due_date = $work->assignment->due; my $due = $due_date ? 'due: ' . sqldate2shortdate($due_date) : ''; my $submitted_date = $work->submitted; my $submitted = $due_date && $submitted_date ? 'in: ' . sqldate2shortdate($submitted_date) : ''; my $datetime = epoch2sqldatetime(time()); if ($page->role_rank == Role->student->rank){ $work->studentLastSeen($datetime); } elsif ($page->role_rank == Role->faculty->rank){ $work->facultyLastSeen($datetime); } ## -- debugging -- # my $msg = qq{ #
  #  -- debug work.mhtml --
  #  submit_edit = '$submit_edit'
  #  is_faculty  = '$is_faculty'
  #  edit_grade  = '$edit_grade'
  # 
# }; if ($submit_edit and $edit_grade and $is_faculty){ $work->grade($edit_grade); ## students can see this on grades page; don't need to go to work page. # $work->facultyLastModified($datetime); } <%doc> $Id: work.mhtml 22680 2008-08-26 20:38:45Z mahoney $ Display a page title and user grade for student submitted work pages. With the default wikiacademia.css style sheet, this is placed at the top of the page with the grade on the far right. -------------------------------------------------------- | Assignment Name Jane Doe's work grade: B | | | | | This page also works in conjuction with the edit.mhtml component to allow faculty to set the grade through the fairly kludgey mechanism of having the form named "edit" begin in either in this component or edit.mhtml. Since edit reloads the page when data is submitted, this work component must be evaluated first if its to catch the "submit" click.