Creating or Changing the right sidebar navigation

Printer-friendly version

On each project page, for all projects, you'll see right sidebar navigation specific to that project.

But where is that navigation? How can you create this navigation for a new project? How do you modify it once it's been created.

The right sidebar navigation is actually a drupal block that appears for the specific content type. All twc users (a particular user role) are allowed to create and edit these blocks. But there's a trick. So please read this before you go off and created, edit or delete these blocks.

We've added a hook for using blocks where the right sidebar navigation can use our special sparql tag, which allows you to do a SPARQL query against the TW endpoint, translate the response using XSLT, and rendering that content in the page. Or, in this case, rendering the translation in the right sidebar.

Solution to a known problem

If you do not see the "Administer" menu, go to here http://tw.rpi.edu/web/admin/build/block, find the block you want to modify and modify it.

Modifying a block

You've added a new page to the project and you want to link to that page from the project navigation on the right. And all twc users should have access to create and modify blocks. If you don't see the Administer menu in the black bar at the top of the screen, please let us know. Here's the steps you'll need to take:

  1. Hover over Administer, the Site building, and click on Blocks in the black navigation at the top of the screen
  2. In the list of blocks, find the one for your project with the (w/ SPARQL) text at the end of the name. e.g. LOGD Navigation (w/ SPARQL)
  3. Click on the configure link at the right of that name
  4. Find the "Block body:" section of the form. This is where you will make your changes. And this is straight HTML. For example.
    • Meeting Notes current doesn't point anywhere. You need to add the link.
    • add <a href="web/project/LOGD/meetings"> before "Meeting Notes" and then </a> before the line break

    Or you want to add something new. Just add it to the appropriate section of the menu, or add a new section, and link to that new page

  5. When you're finished, click the "Save block" button at the bottom of the page. And you're done

Creating a block

You've added a new project, and now you want to create this right sidebar navigation. And all twc users should have access to create and modify blocks. If you don't see the Administer menu in the black bar at the top of the screen, please let us know. Here's the steps you'll need to take:

  1. Hover over Administer, the Site building, and click on Blocks in the black navigation at the top of the screen, or go here: http://tw.rpi.edu/web/admin/build/block
  2. At the top of the page content, click on "Add block"
  3. Fill out the form as follows
    1. Block description: e.g. LOGD Navigation
    2. Block title: e.g. LOGD Navigation
    3. Block body: see the example below for a template
    4. Input format: Filtered HTML
    5. User specific visibility settings: click "Users cannot control whether or not they see this block."
    6. Role specific visibility settings: Leave this section alone, no roles should be checked
    7. Page specific visibility settings: Leave this section alone, we'll change this in the automatically created block
    8. Click "Save block". This will create your new block and return you to the list of blocks

This is not the block we'll be using. A new block was automatically created when you created this block with the same name except (w/ SPARQL) added at the end. This block is the one we'll be using.

  1. Find the automatically created block with the same name you used but with (w/ SPARQL) at the end
  2. Click the configure link for this block
  3. Everything at the top should already be filled in
  4. Scroll down to the bottom for "Page specific visibility settings"
  5. Click on "Show if the following PHP code returns TRUE (PHP-mode, experts only).
  6. Add the php code below to the textarea underneath Pages:
  7. Look at this line in the PHP code: if( $term->name == "Change this to your Taxonomy Term" ) $match = TRUE ;
  8. Click "Save block"

Now you have the blocks configured correctly, let's put it in the right place.

  1. Find the block with the (w/ SPARQL) name
  2. Drag it under the "Right sidebar" section. Make sure it's in alphabetical order so it's easy for everyone to find
  3. Scroll down to the bottom of the screen and click "Save blocks"

And you're done. Now, when you go to your project page you should see the project navigation on the right. If you don't, come find us and we'll help you out.

Sample Menu

You'll need to modify this, of course.

  • The name of the project
  • The logo of the project
  • The "Create page" link at the bottom, where it says "CONTENTTYPE", change this to the name of the content type, e.g. logdpage, not LOGD Page
  • PROJECT should be changed to the URL settings you used when you created the main project page, such as LOGD
  • PROJECTNAME should be the name of the project as you want it at the top of the navigation. People will click on this link to get back to the main page
  • PROJECTINSTANCE is the instance name in the RDF Triple Store. Note that we're using the new <sparql> tag here to grab the image for the project.

<table>
  <tr><th class="title"><a href="/web/project/DCO-DS">DCO-DS</a></th></tr>
  <tr><td align=center>
    <a href="/web/project/DCO-DS"><sparql query="project.rq" i="dco-ds" xslt="generate/project-header.xsl" /></a>
  </td></tr>
  <tr><th class="section">Project Information</th></tr>
  <tr><td>
    <a href="/web/project/DCO-DS/Announcements">Announcements</a><br />
    <a href="/web/project/DCO-DS/Calendar">Calendar</a><br />
    <a href="/web/project/DCO-DS/Meetings">Meeting Notes</a><br />
    <a href="/web/project/DCO-DS/WorkingGroups">Working Groups</a><br />
    <a href="/web/project/DCO-DS/WorkingGroups/BoundaryActivities">Boundary Activities</a><br />
    <a href="/web/project/DCO-DS/ProjectPartners">Project Partners</a><br />
    <a href="/web/project/DCO-DS/Glossary">Glossary</a>
  </td></tr>
  <tr><th class="section">Research</th></tr>
  <tr><td class="section">
    <!--Key Concepts<br />-->
    <a href="/web/project/DCO-DS/Publications">Publications</a><br />
    <a href="/web/project/DCO-DS/Presentations">Presentations</a><br />
    <a href="/web/project/DCO-DS/Reports">Reports</a>
  </td></tr>
  <tr><th class="section">Design</th></tr>
  <tr><td>
    <a href="/web/project/DCO-DS/Narrative">Narrative</a><br />
    <a href="/web/project/DCO-DS/UseCases">Use Cases/Requirements</a><br />
    <a href="/web/project/DCO-DS/Architecture">Architecture</a><br />
    <a href="/web/project/DCO-DS/Technology">Technology Infrastructure</a><br />
  </td></tr>
  <!--
  <tr><th class="section">Development</th></tr>
  <tr><td>
    Developer Guide<br />
  </td></tr>
  <tr><th class="section">Software & Services</th></tr>
  <tr><td>
    Documentation<br />
  </td></tr>
  -->
  <tr><th class="section">Internal</td></tr>
  <tr><td>
    <a href="/web/project/DCO-DS/Internal">Internal Info</a><br />
  </td></tr>
  <tr><th class="section">Manage</td></tr>
  <tr><td>
    <a href="/web/node/add/project">Create Page</a>
    <a href="/web/admin/build/block/configure/twsparql/42">Edit Nav</a>
  </td></tr>
</table>

Sample PHP code

You'll need to modify this, of course.

  • In place of Data.rpi.edu use the taxonomy term for your project page, or whatever page taxonomy you are using.

<?php
$match = FALSE ;
$url = drupal_get_path_alias(request_uri());
 
if (arg(0) == 'node' && is_numeric(arg(1)) && !arg(2)) {
  $node = node_load(arg(1));
  if( $node )
  {
    foreach ($node->taxonomy as $vid => $term) {
      $vn = taxonomy_vocabulary_load($term->vid);
      if( $term->name == "DTDI" || $term->name == "DTDI Internal" ) $match = TRUE ;
    }
  }
}
 
  // block is invisible on URLs entered here
  if (strpos($url, "edit")) {
    $match = FALSE;
  }
 
  // copy paste these for additional URLs
   if (strpos($url, "admin")) {
    $match = FALSE;
  }
 
  return $match;
?>