[opw-web] Improve program listing screen - fix title, show active status



commit bbdddc5c16008adfe2b4204836d96678eaabe474
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sun Sep 21 23:37:19 2014 -0400

    Improve program listing screen - fix title, show active status
    
    Show the appropriate header for the screen depending on the action,
    show (inactive) for inactive programs.

 lang/en-gb.php                          |    4 +++-
 modules/mod_view_programs.php           |   22 ++++++++++++++++++++--
 skins/easterngreen/html/tpl_header.html |    2 +-
 3 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/lang/en-gb.php b/lang/en-gb.php
index 1ff912b..c16ff44 100644
--- a/lang/en-gb.php
+++ b/lang/en-gb.php
@@ -32,7 +32,7 @@ $lang_data = array(
     'manage_organizations'  => 'Manage organizations',
     'manage_bans'           => 'Manage user bans',
     'navigation'            => 'Navigation',
-    'view_all_programs'     => 'View all programs',
+    'view_all_progms'       => 'View all programs',
     'view_active_progms'    => 'View active programs',
     'view_archives'         => 'View archived projects',
     'view_rejected'         => 'View rejected projects',
@@ -100,6 +100,8 @@ $lang_data = array(
 
     /* Module: view_programs */
     'select_program'        => 'Select a program to continue',
+    'view_inactive_progms'  => 'View inactive programs',
+    'inactive'              => 'inactive',
 
     /* Module: manage_programs */
     'add_program'           => 'Add new program',
diff --git a/modules/mod_view_programs.php b/modules/mod_view_programs.php
index 3e04d27..3ed127f 100644
--- a/modules/mod_view_programs.php
+++ b/modules/mod_view_programs.php
@@ -83,10 +83,14 @@ else
         $url  = !empty($return_url) ? "?q=view_projects&amp;prg={$row['id']}&amp;a={$return_url}"
                                     : "?q=program_home&amp;prg={$row['id']}";
 
+        $title = $row['title'];
+        if ($row['is_active'] == 0)
+            $title .= ' (' . $lang->get('inactive') . ')';
+
         // Assign data for program
         $skin->assign(array(
             'program_url'         => $url,
-            'program_title'       => htmlspecialchars($row['title']),
+            'program_title'       => htmlspecialchars($title),
             'program_description' => nl2br(htmlspecialchars($row['description'])),
         ));
 
@@ -94,7 +98,21 @@ else
     }
 
     // Determine the page title
-    $programs_title = !empty($return_url) ? $lang->get('select_program') : $lang->get('view_active_progms');
+    if (!empty($return_url))
+        $programs_title =  $lang->get('select_program');
+    else {
+        switch ($action) {
+        case 'active':
+            $programs_title = $lang->get('view_active_progms');
+            break;
+        case 'inactive':
+            $programs_title = $lang->get('view_inactive_progms');
+            break;
+        case 'all':
+            $programs_title = $lang->get('view_all_progms');
+            break;
+        }
+    }
 
     // Get the pagination
     $pagination = $skin->pagination($program_count['count'], $page);
diff --git a/skins/easterngreen/html/tpl_header.html b/skins/easterngreen/html/tpl_header.html
index 791a34e..673065b 100644
--- a/skins/easterngreen/html/tpl_header.html
+++ b/skins/easterngreen/html/tpl_header.html
@@ -107,7 +107,7 @@ ocalization variable
 
                                 <li class="[[mentor_visibility]]">
                                     <a href="?q=view_programs&amp;a=all">
-                                        {{view_all_programs}}
+                                        {{view_all_progms}}
                                     </a>
                                 </li>
 


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