[opw-web] Add handling of contract documents



commit d6856326a820d35a7cca52a4f1843a017cecafa1
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sun Apr 20 12:12:03 2014 -0400

    Add handling of contract documents
    
    Add a special type of attachment with project_id=0, is_contract=1,
    that is a contract document that the user can upload. We also add
    explicit program_id and username fields to the attachment table to
    handle this.
    
    List contract documents on the page of mentors and students for
    accepted projects, and allow them to upload documents.
    
    Add a contract_approved field to the roles table; show the approved
    status in view_participants, and add a link with the contract
    documents where the admin can approve or unapprove the contract.

 lang/en-gb.php                                     |   17 ++-
 modules/mod_attachment.php                         |  136 ++++++++++++++++----
 modules/mod_user_profile.php                       |   86 ++++++++++++-
 modules/mod_view_participants.php                  |   19 +++-
 modules/mod_view_projects.php                      |    9 +-
 schema.sql                                         |   15 ++-
 skins/easterngreen/html/tpl_contract_upload.html   |   37 ++++++
 skins/easterngreen/html/tpl_user_profile.html      |   29 +++--
 .../html/tpl_user_profile_contract.html            |   14 ++
 .../tpl_user_profile_contract_admin_footer.html    |   10 ++
 .../html/tpl_user_profile_contract_footer.html     |    5 +
 .../html/tpl_user_profile_contract_header.html     |    5 +
 skins/easterngreen/html/tpl_view_participants.html |    4 +
 .../html/tpl_view_participants_item.html           |    4 +
 14 files changed, 339 insertions(+), 51 deletions(-)
---
diff --git a/lang/en-gb.php b/lang/en-gb.php
index 277a56a..b532121 100644
--- a/lang/en-gb.php
+++ b/lang/en-gb.php
@@ -256,8 +256,14 @@ $lang_data = array(
     'site_admin'            => 'Site admin',
     'log_in_identity'       => 'Log-in Identity',
     'profile_url'           => 'Profile page',
+    'contract_documents'    => 'Contract Documents',
+    'contract_approved'     => 'Contract approved',
+    'upload_contract'       => 'Upload a contract document',
+    'approve_contract'      => 'Approve contract',
+    'unapprove_contract'    => 'Unapprove contract',
     'visible_to_mentors'    => '(visible to mentors)',
     'visible_to_public'     => '(visible to public)',
+    'visible_to_admins'     => '(visible to administrators)',
     'edit_user_profile'     => 'Edit user profile',
 
     /* Module: user_bans */
@@ -333,9 +339,12 @@ $lang_data = array(
     'attachment_description'    => "Description",
     'upload_description_needed' => 'Please supply a description for the attachment',
     'upload_no_file'            => 'Please select a file to upload',
-    'upload_failed'             => 'Attachment upload failed',
-    'upload_too_large'          => 'Attachment too large (maximum size is 1MB)',
-    'upload_unknown_type'       => 'Attachment type is unsupported (supported: PDF, ODT, TXT)',
-    'confirm_delete_attachment' => 'Are you sure that you want to delete the attachment?'
+    'upload_failed'             => 'File upload failed',
+    'upload_too_large'          => 'File too large (maximum size is 1MB)',
+    'upload_unknown_type'       => 'File type is unsupported (supported: PDF, ODT, TXT)',
+    'confirm_delete_attachment' => 'Are you sure that you want to delete the attachment?',
+    'upload_contract_document'  => 'Upload contract document',
+    'document'                  => 'Document',
+    'contract_sign_message'     => 'Make sure that you have initialed each page and signed and dated the 
last page'
 );
 
diff --git a/modules/mod_attachment.php b/modules/mod_attachment.php
index 7d1783c..3a77b97 100644
--- a/modules/mod_attachment.php
+++ b/modules/mod_attachment.php
@@ -10,40 +10,69 @@ if (!defined('IN_PANDORA')) exit;
 $action = $core->variable('a', 'view');
 $program_id = 0 + $core->variable('prg', 0);
 $project_id = 0 + $core->variable('p', '');
+$is_contract = (0 + $core->variable('contract', '')) != 0;
 $attachment_id = 0 + $core->variable('i', '');
+$username_encoded = $core->variable('u', '');
 $return_url = $core->variable('r', '');
 $description = $core->variable('description', '', false, true);
 
+$username = urldecode($username_encoded);
+
 $attachment_add = isset($_POST['attachment_add']);
 $confirm = isset($_POST['yes']);
 
-// Keeps things simple to require the program and project ID
+// Keeps things simple to require the program ID
 $user->restrict($program_id > 0);
-$user->restrict($project_id > 0);
 
 if (empty($return_url))
-    $return_url ="?q=view_projects&prg={$program_id}&p={$project_id}";
-
-function validate_ids($program_id, $project_id, $attachment_id, $require_owner)
 {
-    global $db, $user;
+    if ($is_contract)
+        $return_url ="?q=user_profile&prg={$program_id}";
+    else
+        $return_url ="?q=view_projects&prg={$program_id}&p={$project_id}";
+}
 
-    $sql = "SELECT COUNT(*) as count " .
-           "FROM {$db->prefix}participants prt ";
+if ($project_id > 0)
+    $project_data = $cache->get_project_data($project_id);
+else
+    $project_data = null;
 
-    if ($attachment_id > 0)
-        $sql .= "LEFT JOIN {$db->prefix}attachments a " .
-                "ON a.project_id = prt.project_id ";
+$user->get_role($program_id, $role, $mentor_organization_id);
+$program_data = $cache->get_program_data($program_id);
+$project_permissions = get_project_permissions($program_data, $role, $project_data);
 
-    $sql .= "WHERE prt.project_id = :project_id AND " .
-                  "prt.program_id = :program_id ";
+$user->restrict($program_data != null);
 
-    if ($attachment_id > 0)
-        $sql .= "AND a.id = :attachment_id ";
+function validate_ids($program_id, $project_id, $attachment_id, $require_owner)
+{
+    global $db, $user;
 
-    if ($require_owner)
-        $sql .= "AND prt.username = :username " .
-                "AND prt.role = 's' ";
+    if ($project_id > 0) {
+        $sql = "SELECT COUNT(*) as count " .
+               "FROM {$db->prefix}participants prt ";
+
+        if ($attachment_id > 0)
+            $sql .= "LEFT JOIN {$db->prefix}attachments a " .
+                    "ON a.project_id = prt.project_id ";
+
+        $sql .= "WHERE prt.project_id = :project_id AND " .
+                      "prt.program_id = :program_id ";
+
+        if ($attachment_id > 0)
+            $sql .= "AND a.id = :attachment_id ";
+
+        if ($require_owner)
+            $sql .= "AND prt.username = :username " .
+                    "AND prt.role = 's' ";
+    } else if ($attachment_id > 0) {
+        $sql = "SELECT COUNT(*) as count " .
+               "FROM {$db->prefix}attachments a " .
+               "WHERE a.program_id = :program_id ";
+        if ($require_owner)
+            $sql .= "AND a.uploader = :username ";
+    } else {
+        return true; /* We've already validated $program_id */
+    }
 
     $row = $db->query($sql,
                       array('program_id' => $program_id,
@@ -56,7 +85,16 @@ function validate_ids($program_id, $project_id, $attachment_id, $require_owner)
 }
 
 if ($action == 'add') {
-    $user->restrict($project_id > 0);
+    if ($is_contract)
+    {
+        $user->restrict($project_id == 0);
+    }
+    else
+    {
+        $user->restrict($project_id > 0);
+        $user->restrict($project_permissions->can_edit);
+    }
+
     $user->restrict(validate_ids($program_id, $project_id, 0, !$user->is_admin));
 
     $error_message = '';
@@ -109,15 +147,18 @@ if ($action == 'add') {
             $fp = fopen($_FILES['file']['tmp_name'], 'rb');
 
             $sql = "INSERT INTO {$db->prefix}attachments " .
-                   "(project_id, name, description, content_type, size, data) " .
-                   " VALUES (:project_id, :name, :description, :content_type, :size, :data)";
+                   "(project_id, program_id, name, uploader, description, content_type, size, data, 
is_contract) " .
+                   " VALUES (:project_id, :program_id, :name, :uploader, :description, :content_type, :size, 
:data, :is_contract)";
 
             $db->query($sql, array('project_id' => $project_id,
+                                   'program_id' => $program_id,
+                                   'uploader' => $user->username,
                                    'name' => $name,
                                    'description' => $description,
                                    'content_type' => $content_type,
                                    'size' => $size,
-                                   'l:data' => $fp));
+                                   'l:data' => $fp,
+                                   'is_contract' => $is_contract ? 1 : 0));
 
             $core->redirect($return_url);
         }
@@ -132,13 +173,38 @@ if ($action == 'add') {
     ));
 
     // Output the module
-    $module_title = $lang->get('add_attachment');
-    $module_data = $skin->output('tpl_attachment_add');
+    if ($is_contract)
+    {
+        $module_title = $lang->get('upload_contract_document');
+        $module_data = $skin->output('tpl_contract_upload');
+    }
+    else
+    {
+        $module_title = $lang->get('add_attachment');
+        $module_data = $skin->output('tpl_attachment_add');
+    }
 
 } else if ($action == 'delete') {
     $user->restrict($attachment_id > 0);
     $user->restrict(validate_ids($program_id, $project_id, $attachment_id, !$user->is_admin));
 
+    if ($project_id > 0)
+    {
+        $user->restrict($project_permissions->can_edit);
+    }
+    else
+    {
+        $sql = "SELECT contract_approved " .
+               "FROM {$db->prefix}roles r ".
+               "WHERE r.program_id = $program_id " .
+               "AND r.username = :username ";
+        $row = $db->query($sql,
+                          array('program_id' => $program_id,
+                                'username' => $user->username),
+                          true);
+        $user->restrict($row['contract_approved'] == 0);
+    }
+
     // Deletion was confirmed
     if ($confirm)
     {
@@ -165,10 +231,6 @@ if ($action == 'add') {
 } else if ($action == 'view') {
     $user->restrict($attachment_id > 0);
 
-    $role = null;
-    $organization_id = null;
-    $user->get_role($program_id, $role, $organization_id);
-
     // Mentors and admins can see all attachments, otherwise require the project owner
     $user->restrict(validate_ids($program_id, $project_id, $attachment_id,
                                  !($user->is_admin || $role == 'm')));
@@ -199,6 +261,24 @@ if ($action == 'add') {
 
     exit;
 
+} else if ($action == 'approve_contract' || $action == 'unapprove_contract') {
+    $user->restrict($username != '');
+    $user->restrict($user->is_admin);
+
+    $user->check_csrf();
+
+    $approved = ($action == 'approve_contract') ? 1 : 0;
+
+    $sql = "UPDATE {$db->prefix}roles " .
+           "SET contract_approved = :approved " .
+           "WHERE username = :username " .
+           "AND program_id = :program_id";
+    $db->query($sql, array('approved' => $approved,
+                           'username' => $username,
+                           'program_id' => $program_id));
+
+    $core->redirect($return_url);
+
 } else {
     // Unknown action
     $core->redirect($core->path());
diff --git a/modules/mod_user_profile.php b/modules/mod_user_profile.php
index 1d5985f..6ae3b9f 100644
--- a/modules/mod_user_profile.php
+++ b/modules/mod_user_profile.php
@@ -31,7 +31,8 @@ $username_data = $user->lookup_user($username);
 
 $skin->assign(array(
    'visible_to_public' => $is_self ? $lang->get('visible_to_public') : '',
-   'visible_to_mentors' => $is_self ? $lang->get('visible_to_mentors') : ''
+   'visible_to_mentors' => $is_self ? $lang->get('visible_to_mentors') : '',
+   'visible_to_admins' => $is_self ? $lang->get('visible_to_admins') : ''
 ));
 
 if ($action == 'view') {
@@ -122,6 +123,87 @@ if ($action == 'view') {
             $projects_list .= $skin->output('tpl_user_profile_project');
         }
 
+        $contracts_list = "";
+        $contracts_visibility = false;
+
+        if ($is_self || $user->is_admin) {
+            $sql = "SELECT prg.*, r.role, r.contract_approved FROM {$db->prefix}roles r " .
+                   "LEFT JOIN {$db->prefix}programs prg " .
+                   "ON prg.id = r.program_id " .
+                   "WHERE r.username = ? " .
+                   "AND prg.dl_mentor < UNIX_TIMESTAMP() " .
+                   "AND EXISTS (SELECT * from {$db->prefix}participants prt " .
+                               "LEFT JOIN {$db->prefix}projects prj " .
+                               "ON prt.project_id = prj.id " .
+                               "WHERE prt.username = r.username AND prj.is_accepted = 1) " .
+                   "ORDER BY prg.id DESC";
+            $program_data = $db->query($sql, $username);
+
+            $contracts_by_program = array();
+            foreach ($program_data as $row)
+            {
+                $contracts_by_program[$row['id']] = array();
+            }
+
+            $sql = "SELECT id, program_id, name, description FROM {$db->prefix}attachments " .
+                   "WHERE uploader = ? AND is_contract = 1 ";
+            $contract_data = $db->query($sql, $username);
+
+            foreach ($contract_data as $row)
+            {
+                array_push($contracts_by_program[$row['program_id']], $row);
+            }
+
+            foreach ($program_data as $program)
+            {
+                $contract_return = urlencode($core->request_uri());
+
+                $contracts_visibility = true;
+                $skin->assign(array(
+                                  'program_title' => $program['title'],
+                                  'role' => $lang->get('role_' . $program['role']),
+                                  'approved_visibility' => $skin->visibility($program['contract_approved'])
+                             ));
+
+                $contracts_list .= $skin->output('tpl_user_profile_contract_header');
+
+                foreach ($contracts_by_program[$program['id']] as $contract) {
+                    $view_url = "?q=attachment&prg={$program['id']}&i={$contract['id']}";
+                    $delete_url = 
"?q=attachment&a=delete&prg={$program['id']}&i={$contract['id']}&r={$contract_return}";
+                    $skin->assign(array(
+                                      'attachment_id' => htmlspecialchars($contract['id']),
+                                      'name' => htmlspecialchars($contract['name']),
+                                      'view_url' => htmlspecialchars($view_url),
+                                      'delete_url' => htmlspecialchars($delete_url),
+                                      'description' => htmlspecialchars($contract['description']),
+                                      'delete_visibility' => $skin->visibility($program['contract_approved'] 
== 0 || $user->is_admin)
+                                 ));
+                    $contracts_list .= $skin->output('tpl_user_profile_contract');
+                }
+
+                if ($is_self) {
+                    $add_url = "?q=attachment&a=add&prg={$program['id']}&contract=1&r={$contract_return}";
+                    $skin->assign(array(
+                                      'add_url' => htmlspecialchars($add_url)
+                                  ));
+                    $contracts_list .= $skin->output('tpl_user_profile_contract_footer');
+                }
+
+                if ($user->is_admin) {
+                    $approve_url = 
"?q=attachment&a=approve_contract&prg={$program['id']}&u={$username}&r={$contract_return}";
+                    $unapprove_url = 
"?q=attachment&a=unapprove_contract&prg={$program['id']}&u={$username}&r={$contract_return}";
+                    $skin->assign(array(
+                                      'program_id' => $program['id'],
+                                      'approve_url' => htmlspecialchars($approve_url),
+                                      'unapprove_url' => htmlspecialchars($unapprove_url),
+                                      'approve_visibility' => 
$skin->visibility($program['contract_approved'] == 0),
+                                      'unapprove_visibility' => 
$skin->visibility($program['contract_approved'] == 1)
+                                  ));
+                    $contracts_list .= $skin->output('tpl_user_profile_contract_admin_footer');
+                }
+            }
+        }
+
         $is_admin   = false;
         $avatar_url = "?q=user_avatar&amp;u={$username_encoded}";
         $edit_url = "?q=user_profile&amp;a=editor&amp;u={$username_encoded}";
@@ -143,11 +225,13 @@ if ($action == 'view') {
             'edit_url'              => $edit_url,
             'identities_list'       => $identities_list,
             'projects_list'         => $projects_list,
+            'contracts_list'        => $contracts_list,
             'profile_visibility'    => $skin->visibility(true),
             'notice_visibility'     => $skin->visibility(false),
             'edit_visibility'       => $skin->visibility($can_edit),
             'details_visibility'    => $skin->visibility($can_view_details),
             'projects_visibility'   => $skin->visibility($projects_visibility),
+            'contracts_visibility'  => $skin->visibility($contracts_visibility),
             'contact_visibility'    => $skin->visibility(!$is_self && $can_view_details),
             'badge_visibility'      => $skin->visibility($is_admin),
             'return_visibility'     => $skin->visibility(empty($return_url), true),
diff --git a/modules/mod_view_participants.php b/modules/mod_view_participants.php
index 5e6068b..2a740bb 100644
--- a/modules/mod_view_participants.php
+++ b/modules/mod_view_participants.php
@@ -11,8 +11,8 @@ $program_id = $core->variable('prg', '');
 
 // Get the program's participant list
 
-$sql = "SELECT r.username, r.role AS role, " .
-       "pr.id AS project_id, pr.title AS project_title, " .
+$sql = "SELECT r.username, r.role AS role, r.contract_approved, " .
+       "pr.id AS project_id, pr.title AS project_title, pr.is_accepted, " .
        "pf.fullname " .
        "FROM {$db->prefix}roles r " .
        "LEFT JOIN {$db->prefix}profiles pf " .
@@ -40,8 +40,11 @@ foreach ($list_data as $row)
             $row['project_id'] != null)
         {
             $idx = count($list) - 1;
+            $title = ($row['is_accepted'] == 1 ? '* ' : '') . $row['project_title'];
+            if ($row['is_accepted'] == 1)
+                $list[$idx]['any_accepted'] = true;
             $list[$idx]['projects'] .= '<br /><a href="?q=view_projects&prg=' . $program_id .
-                                       '&p=' . $row['project_id'] . '">' . 
htmlspecialchars($row['project_title']) .
+                                       '&p=' . $row['project_id'] . '">' . htmlspecialchars($title) .
                                        '</a>';
             continue;
         }
@@ -63,6 +66,8 @@ foreach ($list_data as $row)
         'profile'   => $user->profile($row['username'], true, $row['fullname']),
         'role'      => $lang->get('role_' . $row['role']),
         'projects'  => $project,
+        'any_accepted' => $row['is_accepted'] == 1,
+        'contract_approved'  => $row['contract_approved']
     );
 
     $prev_row = $row;
@@ -73,10 +78,18 @@ $participant_list = '';
 
 foreach ($list as $item)
 {
+    if ($item['contract_approved'] == 1)
+        $contract_approved = $lang->get('yes');
+    else if ($item['any_accepted'] == 1)
+        $contract_approved = $lang->get('no');
+    else
+        $contract_approved = '';
+
     // Assign data for each mentor
     $skin->assign(array(
         'participant'    => $item['profile'],
         'role'           => $item['role'],
+        'contract_approved' => $contract_approved,
         'projects'       => $item['projects'],
     ));
 
diff --git a/modules/mod_view_projects.php b/modules/mod_view_projects.php
index b832b5d..4bec14a 100644
--- a/modules/mod_view_projects.php
+++ b/modules/mod_view_projects.php
@@ -546,11 +546,14 @@ else if ($action == 'view')
     //  2. Project doesn't already have a mentor
     //  3. Project hasn't passed mentor deadline
     //
+    // We used to have
+    // $core->timestamp < $program_data['dl_mentor']
+    // but we want to allow late mentorship
+    //
     // KSoC had:
     // XXXX 4. Projest has passed student deadline
     // $core->timestamp > $program_data['dl_student'] &&
-    $can_mentor = ($role == 'm' && !$has_mentor &&
-                   $core->timestamp < $program_data['dl_mentor']);
+    $can_mentor = ($role == 'm' && !$has_mentor);
 
     // User applied as mentor
     if ($mentor_apply && $can_mentor)
@@ -590,7 +593,7 @@ else if ($action == 'view')
     $can_delete_attachments = $project_permissions->can_edit;
 
     if ($can_view_attachments) {
-        $sql = "SELECT * FROM {$db->prefix}attachments " .
+        $sql = "SELECT id, name, description FROM {$db->prefix}attachments " .
                "WHERE project_id = ?";
         $attachment_data = $db->query($sql, $project_id);
     } else {
diff --git a/schema.sql b/schema.sql
index 2663dc4..30ebffb 100644
--- a/schema.sql
+++ b/schema.sql
@@ -63,12 +63,14 @@ CREATE TABLE `opw_participants` (
   FOREIGN KEY (`program_id`) REFERENCES `opw_programs`(`id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
+/* alter table opw_roles add `contract_approved` tinyint(1) NOT NULL DEFAULT 0 ; */
 CREATE TABLE `opw_roles` (
   `id` mediumint(10) NOT NULL AUTO_INCREMENT,
   `username` varchar(255) NOT NULL DEFAULT '',
   `program_id` mediumint(6) unsigned NOT NULL,
   `organization_id` mediumint(6) unsigned,
   `role` char(1) NOT NULL DEFAULT 's',
+  `contract_approved` tinyint(1) NOT NULL DEFAULT 0,
   PRIMARY KEY (`id`),
   FOREIGN KEY (`program_id`) REFERENCES `opw_programs`(`id`),
   FOREIGN KEY (`organization_id`) REFERENCES `opw_organizations`(`id`)
@@ -117,13 +119,24 @@ CREATE TABLE `opw_profiles` (
   PRIMARY KEY (`username`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
+/*
+alter table opw_attachments add `is_contract` tinyint(1) NOT NULL DEFAULT 0;
+alter table opw_attachments add `program_id` mediumint(6) unsigned NOT NULL;
+alter table opw_attachments add `uploader` varchar(255) NOT NULL;
+update opw_attachments set uploader = (select username from opw_participants p where p.project_id = 
opw_attachments.project_id and p.role = 's');
+update opw_attachments set program_id = (select p.program_id from opw_projects p where p.id = 
opw_attachments.project_id);
+*/
+
 CREATE TABLE `opw_attachments` (
   `id` mediumint(10) unsigned NOT NULL AUTO_INCREMENT,
-  `project_id` mediumint(10) NOT NULL,
+  `program_id` mediumint(6) unsigned NOT NULL,
+  `project_id` mediumint(10) unsigned not NULL,
+  `uploader` varchar(255) NOT NULL,
   `name` varchar(255) NOT NULL,
   `description` varchar(255) NOT NULL,
   `content_type` varchar(255) NOT NULL,
   `size` mediumint(10) unsigned NOT NULL,
   `data` MEDIUMBLOB NOT NULL,
+  `is_contract` tinyint(1) NOT NULL DEFAULT 0,
   PRIMARY KEY (`id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
diff --git a/skins/easterngreen/html/tpl_contract_upload.html 
b/skins/easterngreen/html/tpl_contract_upload.html
new file mode 100644
index 0000000..6df7dbd
--- /dev/null
+++ b/skins/easterngreen/html/tpl_contract_upload.html
@@ -0,0 +1,37 @@
+<h1>{{upload_contract_document}}</h1>
+<hr class="hr-head" />
+
+<div class="alert alert">
+  {{contract_sign_message}}
+</div>
+
+<div class="alert alert-error [[error_visibility]]">
+    <a class="close" data-dismiss="alert">×</a>
+    [[error_message]]
+</div>
+
+<div class="control-group">
+    <label class="control-label">{{document}}</label>
+    <div class="controls">
+        <input type="file" name="file" />
+    </div>
+</div>
+
+<div class="control-group">
+    <label class="control-label">{{attachment_description}}</label>
+    <div class="controls">
+        <input type="text" name="description" maxlength="255" class="input-xxlarge" value="[[description]]" 
/>
+    </div>
+</div>
+
+<div class="form-actions">
+    <button type="submit" name="attachment_add" class="btn btn-primary">
+        <i class="icon-ok-sign icon-white"></i>
+        {{save}}
+    </button>
+
+    <a href="[[cancel_url]]" class="btn">
+        <i class="icon-remove icon-black"></i>
+        {{cancel}}
+    </a>
+</div>
diff --git a/skins/easterngreen/html/tpl_user_profile.html b/skins/easterngreen/html/tpl_user_profile.html
index ec0a68e..16b2430 100644
--- a/skins/easterngreen/html/tpl_user_profile.html
+++ b/skins/easterngreen/html/tpl_user_profile.html
@@ -58,6 +58,18 @@
         </tr>
     </table>
 
+    <div class="form-actions">
+        <a href="[[edit_url]]" class="btn btn-primary [[edit_visibility]]">
+            <i class="icon-pencil icon-white"></i>
+            {{edit}}
+        </a>
+
+        <a href="mailto:[[user_email]]"; class="btn btn-primary [[contact_visibility]]">
+            <i class="icon-envelope icon-white"></i>
+            {{contact_user}}
+        </a>
+    </div>
+
     <h4 class="[[details_visibility]]">{{log_in_identity}} <span 
class="visibility-note">[[visible_to_mentors]]</span></h4>
     <table class="[[details_visibility]]">
       <tbody>
@@ -72,15 +84,10 @@
       </tbody>
     </table>
 
-    <div class="form-actions">
-        <a href="[[edit_url]]" class="btn btn-primary [[edit_visibility]]">
-            <i class="icon-pencil icon-white"></i>
-            {{edit}}
-        </a>
-
-        <a href="mailto:[[user_email]]"; class="btn btn-primary [[contact_visibility]]">
-            <i class="icon-envelope icon-white"></i>
-            {{contact_user}}
-        </a>
-    </div>
+    <h4 class="[[contracts_visibility]]">{{contract_documents}} <span 
class="visibility-note">[[visible_to_admins]]</span></h4>
+    <table class="table table-striped [[contracts_visibility]]">
+      <tbody>
+        [[contracts_list]]
+      </tbody>
+    </table>
 </div>
diff --git a/skins/easterngreen/html/tpl_user_profile_contract.html 
b/skins/easterngreen/html/tpl_user_profile_contract.html
new file mode 100644
index 0000000..4b220be
--- /dev/null
+++ b/skins/easterngreen/html/tpl_user_profile_contract.html
@@ -0,0 +1,14 @@
+<tr>
+    <td>
+        <a href="[[view_url]]">[[name]]</a>
+    </td>
+    <td>
+        [[description]]
+    </td>
+    <td class="[[delete_visibility]]">
+        <a href="[[delete_url]]" title="{{delete_attachment}}">
+            <i class="icon-remove"></i>
+        </a>
+    </td>
+</tr>
+
diff --git a/skins/easterngreen/html/tpl_user_profile_contract_admin_footer.html 
b/skins/easterngreen/html/tpl_user_profile_contract_admin_footer.html
new file mode 100644
index 0000000..409476c
--- /dev/null
+++ b/skins/easterngreen/html/tpl_user_profile_contract_admin_footer.html
@@ -0,0 +1,10 @@
+<tr>
+    <th colspan="3">
+        <a href="#" onclick="submitForm(event, '[[approve_url]]')" class="[[approve_visibility]]">
+            {{approve_contract}}
+        </a>
+        <a href="#" onclick="submitForm(event, '[[unapprove_url]]')" class="[[unapprove_visibility]]">
+            {{unapprove_contract}}
+        </a>
+    </th>
+</tr>
diff --git a/skins/easterngreen/html/tpl_user_profile_contract_footer.html 
b/skins/easterngreen/html/tpl_user_profile_contract_footer.html
new file mode 100644
index 0000000..b491578
--- /dev/null
+++ b/skins/easterngreen/html/tpl_user_profile_contract_footer.html
@@ -0,0 +1,5 @@
+<tr>
+    <th colspan="3">
+        <a href="[[add_url]]">{{upload_contract}}</a>
+    </th>
+</tr>
diff --git a/skins/easterngreen/html/tpl_user_profile_contract_header.html 
b/skins/easterngreen/html/tpl_user_profile_contract_header.html
new file mode 100644
index 0000000..35a7074
--- /dev/null
+++ b/skins/easterngreen/html/tpl_user_profile_contract_header.html
@@ -0,0 +1,5 @@
+<tr>
+    <th colspan="3">
+        [[program_title]] ([[role]]<span class="[[approved_visibility]]">, {{contract_approved}}</span>)
+    </th>
+</tr>
diff --git a/skins/easterngreen/html/tpl_view_participants.html 
b/skins/easterngreen/html/tpl_view_participants.html
index b0a270b..dcdd1b9 100644
--- a/skins/easterngreen/html/tpl_view_participants.html
+++ b/skins/easterngreen/html/tpl_view_participants.html
@@ -18,6 +18,10 @@
                 </th>
 
                 <th>
+                    {{contract_approved}}
+                </th>
+
+                <th>
                     {{projects}}
                 </th>
             </tr>
diff --git a/skins/easterngreen/html/tpl_view_participants_item.html 
b/skins/easterngreen/html/tpl_view_participants_item.html
index bd0430a..a22f704 100644
--- a/skins/easterngreen/html/tpl_view_participants_item.html
+++ b/skins/easterngreen/html/tpl_view_participants_item.html
@@ -8,6 +8,10 @@
     </td>
 
     <td>
+        [[contract_approved]]
+    </td>
+
+    <td>
         [[projects]]
     </td>
 </tr>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]