[opw-web] Turn adminstration menu into general 'actions' menu



commit 458b25750cae54df7eb4b4819fcc1d34baf98158
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sun Mar 9 23:46:45 2014 -0400

    Turn adminstration menu into general 'actions' menu
    
    Navigation for mentors and students was unclear - give everybody
    a menu called "Actions".

 classes/class_skin.php                  |   12 ++++
 lang/en-gb.php                          |    3 +
 skins/easterngreen/css/bootstrap.css    |    1 +
 skins/easterngreen/html/tpl_header.html |   88 +++++++++++++------------------
 4 files changed, 52 insertions(+), 52 deletions(-)
---
diff --git a/classes/class_skin.php b/classes/class_skin.php
index 73a76be..823f8c4 100644
--- a/classes/class_skin.php
+++ b/classes/class_skin.php
@@ -154,16 +154,28 @@ class skin
     {
         global $core, $user;
 
+        $program_id = $core->variable('prg', 0);
+        if ($program_id > 0)
+            $user->get_role($program_id, $role, $organization_id);
+        else
+            $role = 'g';
+
         $default_data = array(
             'page_title'        => $this->skin_title,
             'skin_path'         => $this->skin_path,
             'skin_name'         => $this->skin_name_fancy,
             'guest_visibility'  => $this->visibility($user->is_logged_in, true),
             'user_visibility'   => $this->visibility($user->is_logged_in),
+            'mentor_visibility' => $this->visibility($role == 'm' || $user->is_admin),
+            'student_visibility' => $this->visibility($role == 's'),
+            'moderator_visibility'  => $this->visibility($user->is_admin),
             'admin_visibility'  => $this->visibility($user->is_admin),
             'nav_home'          => $core->path(),
         );
 
+        if ($program_id > 0)
+            $this->skin_vars['program_id'] = $program_id;
+
         if (is_array($this->skin_vars))
         {
             $this->skin_vars = array_merge($this->skin_vars, $default_data);
diff --git a/lang/en-gb.php b/lang/en-gb.php
index 1f0628b..90f7748 100644
--- a/lang/en-gb.php
+++ b/lang/en-gb.php
@@ -22,6 +22,7 @@ $lang_data = array(
     'log_in'                => 'Log in',
     'log_out'               => 'Log out',
     'administration'        => 'Administration',
+    'actions'               => 'Actions',
     'manage_programs'       => 'Manage programs',
     'manage_organizations'  => 'Manage organizations',
     'manage_bans'           => 'Manage user bans',
@@ -117,6 +118,8 @@ $lang_data = array(
     'program_started'       => 'This program isn\'t accepting new participants',
     'apply_student'         => 'Apply as student',
     'apply_mentor'          => 'Apply to mentor',
+    'home'                  => 'Home',
+    'my_profile'            => 'My profile',
     'view_submissions'      => 'View my submissions',
     'submit_proposal'       => 'Submit project proposal',
     'create_project'        => 'Create new project',
diff --git a/skins/easterngreen/css/bootstrap.css b/skins/easterngreen/css/bootstrap.css
index 5b7fe7e..bcae1d3 100644
--- a/skins/easterngreen/css/bootstrap.css
+++ b/skins/easterngreen/css/bootstrap.css
@@ -2936,6 +2936,7 @@ table th[class*="span"],
 
 .dropdown-menu .divider {
   *width: 100%;
+  min-width: 50px;
   height: 1px;
   margin: 9px 1px;
   *margin: -5px 0 5px;
diff --git a/skins/easterngreen/html/tpl_header.html b/skins/easterngreen/html/tpl_header.html
index 54d6887..e7d2367 100644
--- a/skins/easterngreen/html/tpl_header.html
+++ b/skins/easterngreen/html/tpl_header.html
@@ -63,99 +63,83 @@ ocalization variable
                             </a>
                         </li>
 
-                        <li class="dropdown [[admin_visibility]]">
+                        <li class="dropdown">
                             <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                 <i class="icon-wrench"></i>
-                                {{administration}}
+                                {{actions}}
                                 <b class="caret"></b>
                             </a>
 
                             <ul class="dropdown-menu">
                                 <li>
-                                    <a href="?q=manage_programs">
-                                        {{manage_programs}}
+                                    <a href="?q=prorgam_home&amp;prg=[[program_id]]">
+                                        {{home}}
                                     </a>
                                 </li>
 
                                 <li>
-                                    <a href="?q=manage_organizations&amp;prg=[[program_id]]">
-                                        {{manage_organizations}}
+                                    <a href="?q=user_profile&amp;prg=[[program_id]]">
+                                        {{my_profile}}
                                     </a>
                                 </li>
 
-                                <li>
-                                    <a href="?q=view_programs&amp;r=proposed">
-                                        {{approve_proposal}}
+                                <li class="[[student_visibility]]">
+                                    <a href="?q=view_projects&amp;a=editor&amp;prg=[[program_id]]">
+                                        {{submit_proposal}}
                                     </a>
                                 </li>
 
-                                <li>
-                                    <a href="?q=approve_mentors">
-                                        {{approve_mentors}}
+                                <li class="[[student_visibility]]">
+                                    <a href="?q=view_projects&amp;a=user&amp;prg=[[program_id]]">
+                                        {{view_submissions}}
                                     </a>
                                 </li>
 
-                                <li>
-                                    <a href="?q=notifications">
-                                        {{notification_mails}}
-                                    </a>
-                                </li>
+                                <li class="divider [[mentor_visibility]]"></li>
 
-                                <li>
-                                    <a href="?q=edit_templates">
-                                        {{edit_templates}}
+                                <li class="[[mentor_visibility]]">
+                                    <a href="?q=rank_projects&amp;prg=[[program_id]]">
+                                        {{rank_projects}}
                                     </a>
                                 </li>
 
-                                <li>
-                                    <a href="?q=user_ban">
-                                        {{manage_bans}}
-                                    </a>
-                                </li>
-
-                                <li class="divider"></li>
+                                <li class="divider [[admin_visibility]]"></li>
 
-                                <li>
-                                    <a href="?q=view_programs&amp;r=rejected">
-                                        {{view_rejected}}
+                                <li class="[[admin_visibility]]">
+                                    <a href="?q=manage_programs">
+                                        {{manage_programs}}
                                     </a>
                                 </li>
 
-                                <li>
-                                    <a href="?q=view_programs&amp;a=inactive&amp;r=accepted">
-                                        {{view_archives}}
+                                <li class="[[admin_visibility]]">
+                                    <a href="?q=manage_organizations&amp;prg=[[program_id]]">
+                                        {{manage_organizations}}
                                     </a>
                                 </li>
-
-                                <li class="divider hide [[modadm_visibility]]"></li>
-
-                                <!-- module: program_home -->
-                                <li class="hide [[prog_adm_visibility]]">
-                                    <a href="?q=view_projects&amp;a=editor&amp;prg=[[program_id]]">
-                                        {{create_project}}
+                                <li class="[[admin_visibility]]">
+                                    <a href="?q=edit_templates">
+                                        {{edit_templates}}
                                     </a>
                                 </li>
 
-                                <!-- module: program_home -->
-                                <li class="hide [[prog_adm_visibility]]">
-                                    <a href="?q=view_participants&amp;prg=[[program_id]]">
-                                        {{view_participants}}
+                                <li class="[[admin_visibility]]">
+                                    <a href="?q=notifications">
+                                        {{notification_mails}}
                                     </a>
                                 </li>
 
-                                <!-- module: view_project -->
-                                <li class="hide [[approve_visibility]]">
-                                    <a 
href="?q=view_projects&amp;a=approve&amp;prg=[[program_id]]&amp;p=[[project_id]]&amp;r=[[return_url]]">
-                                        {{approve_project}}
+                                <li class="[[admin_visibility]]">
+                                    <a href="?q=approve_mentors">
+                                        {{approve_mentors}}
                                     </a>
                                 </li>
 
-                                <!-- module: view_project -->
-                                <li class="hide [[reject_visibility]]">
-                                    <a 
href="?q=view_projects&amp;a=reject&amp;prg=[[program_id]]&amp;p=[[project_id]]&amp;r=[[return_url]]">
-                                        {{reject_project}}
+                                <li class="[[admin_visibility]]">
+                                    <a href="?q=user_ban">
+                                        {{manage_bans}}
                                     </a>
                                 </li>
+
                             </ul>
                         </li>
 


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