Index: common/db/job.php
===================================================================
--- common/db/job.php	(revision 977)
+++ common/db/job.php	(working copy)
@@ -91,7 +91,10 @@
                    `task`.`open_source` AS `task_open_source`,
                    `task`.`open_tests` AS `task_open_tests`,
                    `round`.`id` AS `round_id`,
-                   `round`.`page_name` AS `round_page_name`, `round`.`title` AS `round_title`,
+                   `round`.`page_name` AS `round_page_name`,
+                   `round`.`title` AS `round_title`,
+                   `round`.`type` AS `round_type`,
+                   `round`.`state` AS `round_state`,
                    `round`.`public_eval` AS `round_public_eval`";
     if ($contents) {
         $field_list .= ", job.file_contents";
@@ -238,6 +241,8 @@
             `task`.`open_source` AS `task_open_source`,
             `round`.`page_name` AS `round_page_name`,
             `round`.`title` AS `round_title`,
+            `round`.`state` AS `round_state`,
+            `round`.`type` AS `round_type`,
             `round`.`public_eval` AS `round_public_eval`
         #    (CASE WHEN `status` = 'processing' THEN
         #        (SELECT `value` FROM `ia_parameter_value` WHERE
Index: common/security.php
===================================================================
--- common/security.php	(revision 977)
+++ common/security.php	(working copy)
@@ -138,7 +138,7 @@
         case 'task-tag':
         case 'round-tag':
         case 'textblock-tag':
-        case 'job-reeval':  
+        case 'job-reeval':
         case 'simple-critical':
             return 'simple-critical';
 
@@ -156,6 +156,7 @@
         case 'job-view':
         case 'job-eval':
         case 'job-view-source':
+        case 'job-view-source-size':
         case 'job-view-score':
             return $action;
 
@@ -478,7 +479,7 @@
         case 'macro-debug':
         case 'macro-remotebox':
         case 'macro-preoni':
-            // only administrators can execute these macros 
+            // only administrators can execute these macros
             return $usersec == 'admin';
 
         default:
@@ -504,10 +505,6 @@
 }
 
 
-// FIXME: implement job security.
-// * job-view-source (this should be job-view-source) 
-// * job-view
-//
 // There is no job-eval, jobs are evaluated on the spot, we check job-view instead.
 function security_job($user, $action, $job) {
     $usersec = getattr($user, 'security_level', 'anonymous');
@@ -516,6 +513,9 @@
     $is_task_owner = ($job['task_owner_id'] == $user['id'] && $usersec == 'helper');
     $can_view_job = ($job['task_hidden'] == false) || $is_task_owner || $is_admin;
     $can_view_source = ($job['task_open_source'] == true) || $is_task_owner || $is_owner || $is_admin;
+    $can_view_source_size = ($job['round_type'] == "archive") ||
+                            ($job['round_type'] != "archive" && $job['round_state'] == "complete") ||
+                            $can_view_source;
     $can_view_score = ($job['round_public_eval'] == true) || $is_task_owner || $is_admin;
 
     // Log query response.
@@ -535,9 +535,12 @@
         case 'job-view':
             return $can_view_job;
 
-        case 'job-view-source': 
+        case 'job-view-source':
             return $can_view_job && $can_view_source;
 
+        case 'job-view-source-size':
+            return $can_view_job && $can_view_source_size;
+
         case 'job-view-score':
             return $can_view_job && $can_view_score;
 
Index: www/views/monitor.php
===================================================================
--- www/views/monitor.php	(revision 977)
+++ www/views/monitor.php	(working copy)
@@ -11,7 +11,7 @@
 }
 
 if (!$display_only_table && identity_can('job-reeval') && $view['total_entries'] <= IA_REEVAL_MAXJOBS) {
-    echo '<form enctype="multipart/form-data" action="'.html_escape(url_reeval($view['filters'])).'" 
+    echo '<form enctype="multipart/form-data" action="'.html_escape(url_reeval($view['filters'])).'"
                method="post" class="reeval" id="job_reeval" onsubmit="return confirm(\'Se vor reevalua '.
                html_escape($view['total_entries']).' job-uri! Continuam?\')">';
     echo '<ul class="form hollyfix"><li id="field_submit">';
@@ -71,7 +71,7 @@
                 $msg = html_escape(sprintf("%s: %s puncte",
                     $row['eval_message'], $row['score']));
             } else {
-                $msg = html_escape( $row['eval_message'] );
+                $msg = html_escape($row['eval_message']);
             }
             $msg = "<span style=\"job-status-done\">$msg</span>";
             return format_link($url, $msg, false);
@@ -124,6 +124,9 @@
 
     // For the size column.
     function format_size($row) {
+        if (!identity_can('job-view-source-size', $row)) {
+            return "Ascuns";
+        }
         $size = sprintf("%.2f", $row['job_size']/1024)." kb";
         if (identity_can('job-view-source', $row)) {
             return format_link(url_job_view_source($row['id']), $size);
@@ -168,7 +171,7 @@
     $options = array(
         'css_class' => 'monitor',
         'show_count' => true,
-        'display_entries' => $view['display_entries'], 
+        'display_entries' => $view['display_entries'],
         'total_entries' => $view['total_entries'],
         'first_entry' => $view['first_entry'],
         'pager_style' => 'standard',
