[opw-web] Don't show "Will accept for GSoC" unless program deadline is in the spring



commit 7bfa74c53846648d4e7c0b662918290cbd342ba6
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Fri Oct 17 11:33:21 2014 -0400

    Don't show "Will accept for GSoC" unless program deadline is in the spring
    
    The "Will accept for GSoC" opinion on an application isn't relevant for
    the fall round, so look at the program deadline, and if its' January-June,
    skip the "Will acccept for GSoC" option.

 modules/mod_manage_projects.php |    4 +++-
 utils.php                       |    9 ++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/modules/mod_manage_projects.php b/modules/mod_manage_projects.php
index 834a193..8f4588e 100644
--- a/modules/mod_manage_projects.php
+++ b/modules/mod_manage_projects.php
@@ -39,6 +39,8 @@ $row = $db->query($sql,
 
 $user->restrict($row['count'] > 0);
 
+$program_data = $cache->get_program_data($program_id);
+
 // Get the role of the user
 $user->get_role($program_id, $role, $user_organization_id);
 
@@ -204,7 +206,7 @@ foreach ($list_data as &$row)
         'ranking_name'          => 'ranking' . $project_id,
         'badges'                => build_project_badges($role, $row, $submit_count, $accept_count),
         'disabled'              => $can_edit ? '' : ' disabled',
-        'opinion_select'        => build_opinion_select($row['org_opinion'], 'opinion' . $project_id, 
!$can_edit),
+        'opinion_select'        => build_opinion_select($program_data, $row['org_opinion'], 'opinion' . 
$project_id, !$can_edit),
         'project_url'           => "?q=view_projects&amp;prg={$program_id}&amp;p={$project_id}",
         'approve_url'           => "?q=view_projects&amp;a=approve&amp;prg={$program_id}" .
                                    "&amp;p={$project_id}&amp;r={$return_url}",
diff --git a/utils.php b/utils.php
index 1a059c5..a94814f 100644
--- a/utils.php
+++ b/utils.php
@@ -43,14 +43,21 @@ $VALID_OPINIONS = array('n', 'y', 'c', 'x', 'g', 'w', 'f');
 # Opinions that indicate an interest in accepting a project
 $ACCEPT_OPINIONS = array('g', 'w', 'f');
 
-function build_opinion_select($current, $name, $disabled=false) {
+function build_opinion_select($program_data, $current, $name, $disabled=false) {
     global $VALID_OPINIONS, $lang;
 
     $d = $disabled ? ' disabled' : '';
 
     $result = "<select name='{$name}'$d>";
 
+    $concurrent_with_gsoc = gmdate("m", $program_data['dl_student']) <= 6;
+
     foreach ($VALID_OPINIONS as $opinion) {
+        # If the program doesn't select in the spring, accepting for GSoC
+        # isn't an option
+        if (!$concurrent_with_gsoc && $opinion != $current && $opinion == 'g')
+            continue;
+
         $selected = $opinion == $current ? ' selected' : '';
         $name = $lang->get("opinion_" . $opinion);
         $result .= "<option value='{$opinion}'{$selected}>{$name}</option>";


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