University of Oregon

Updated views to speed up admin pages

Commented out recordCount function in feedback and site_migration_list views.

/* ### 11-5-12 This function is running slow and causing page load slowdowns. Commenting out for now. Vid
function recordCount($viewName,$displayName){
    $view = views_get_view($viewName);
    return count($view->result);
//get the record count:
//ex: $totalCount=recordCount('feedback','attachment_1');


Updated the 'featured nodes' view for each book

I created a new block display in our frontpage_book_section view to display a more customized output.
Previously we had boxes with each ‘promoted’ node showing the title, teaser and ‘Read more’ link.

That worked fine in most cases but when we had a node with no teaser or body content those boxes were empty.
So I created a new block display that replicates the previous node output and also supports this ‘no teaser’ case.
When the view encounters a node without teaser content it displays all the ‘child links’ for that node instead. Which works great. The primary scenario where we have no teaser are ‘link pages’.
There are still cases where some users want to deliberately keep their featured boxes blank, even when there’s no content and in that case they can add an empty teaser to the body and the child links wont show up.

Here’s an example of the new featured boxes:
The current featured blocks don't have any blank cells

The bottom right box used to contain only the node title and left an empty impression on the user and now it’s displaying the child links.

Technical stuff:
That was done with Customfield: PHP code. I added some php to test for an empty teaser and call another view displaying the child links if need be.
Here’s the code:

node_revisions_teaser == ""){
  print views_embed_view('frontpage_book_section', 'attachment_1', $data->nid);

It works great.

Added new styles to node titles and background image

I updated the styles on the hr site today. Removing the box around the page title and lightening the background image.

Screen shot before new styles
Screen shot after new styles

Drupal 6 – Theming search results to remove the cruft…

The default search page output contains an ‘info’ line below each result. This line contains the Author name – content type – last updated date – # comments – # attachments.

I wanted to hide most of these.
I have several contributors to the hr web site who maintain data for other folks so the default output on the search results page wasn’t ideal for us.
So displaying the name of the user who maintains the content but not the knowledgeable contact isn’t helpful. In addition, our audience doesn’t know what a ‘book page’ is. Lastly, displaying “0 attachments” or “0 comments” isn’t very helpful. Especially considering that comments are turned of on most of our pages.

So I set out to theme the search results. To do so I did a quick search on and found that I need a local copy of /modules/search/search-result.tpl.php in my theme directory. From there I could override the search result output.

Here’s what I added above the output of the page:

    if($info_split_value == "0 comments" || $info_split_value == "0 attachments"){
    }//end if
  }//end for each

   #update the info string to hide user and content type
  //remove Author
  //remove Node type
  //rebuild the info string
  $info = implode(' - ', $info_split);?>

I essentially replaced the info line with updated data removing the cruft as it were.
The last line

$info = implode(' - ', $info_split);

I pulled from the search.module code.
Now our search results are clean.

Installed a new admin menu

I moved the administrative menu out of the body of the site today. Putting it in a flyout menu in the upper left hand corner of the site. image of menu icon.
When opening the menu you’ll see your standard options the the list below.
image of open admin menu

I think this is an improvement and will help separate administrative items from content.

Updated administration theme

I updated the Admin theme so things will look a little different now.
The old theme has some conflicts in the code that is causing drupal to erase any former page urls… this is a bad thing. Changing the theme fixes that problem, while I’m testing for the cause.

OUS updates site and broken links

We’ve come across a few broken OUS site links recently and I wanted to pass on a fix.

Here’s an example:
The IT Performance Appraisal Instructions were formerly at:

That link no longer works you can still find the file at their old site located at:

You’ll notice that they replaced the ‘www’ with ‘former’ for their old site.

I ran a report to find any more broken OUS links on our site and found 10 more.
Other departments may encounter the same issue, so feel free to pass this on.

Installed Table of Contents module

I installed a Table of Contents module so we can easily manage long pages with multiple sections.

Here how it looks:

Screen shot of the table of contents

Then I added some styles to position it on the right and highlight the targeted term.

For example if I click #11 the page scrolls down and then the title of the section is highlighted with a dashed line:

Screen shot of the highlighted selected term

Simple; add this to the body of the node: [toc hidden:1]

Here’s the CSS:

/* Table of Contents:
---------------------------------------------------- */
div.content #toc.toc {position:relative; float:right; margin:0 0 1em 1em;}
h2:target, h3:target, h4:target, h5:target, h6:target  {border:dashed green 1px;}
#header:target, #page:target {border:none;}

That last line ensures that the header of the document isn’t highlighted when the top link is clicked.

Updated stylesheet hr2

I updated the style sheets to accommodate extra tabs on our node edit pages:


Screen shot

Screen shot

#sidebar-left {z-index:4}
#main {z-index:3; position:relative;}

ul.tabs li a {margin:6px 0px}

Installed NodeAccess permission module

I Installed the NodeAccess permission module, so we can set up a Recognition event gallery for participants to view. We now have a “Grant” tab available to edit permissions for each node.
Screen shot