Recent HelpDesk Activity

From Pirates@Home

Jump to: navigation, search
BOINC Hacks
  

This page describes modifications you can make to customize your BOINC project or application.


On many BOINC projects the "Help Desk" forums are either unused or under-used. Some projects simply turn them off, or don't bother to create Help Desk forums in the first place.

One reason the Help Desk forums may not be considered to be useful is that if there is not much traffic in them then nobody notices when there is a new posting. This hack adds an indicator to the main forums showing when there is recent activity in the Help Desk forums.

The sections below describe the changes you need to make to various BOINC files:

project.inc

In the file html/project/project.inc define a constant called HELP_DESK_AGE,

define("HELP_DESK_AGE", 8);       

This is the number of days for which we look for recent activity. The indicator will only be shown if there are postings in the past 8 days (or whatever you set this to).

Next add the following function to project.inc to determine the newest posting time for the forums (or just for the Help Desk forums)

 /**                                                                             
  * Return the last time there was a posting to any forum.                       
  * If the optional argument is true then only helpdesk forums                   
  * are scanned.                                                                 
  */
   
 function newest_post_time($is_helpdesk=false){
    $t_list=array();
    $sql = "SELECT * FROM forum ORDER BY timestamp DESC";
    //echo "<br><tt>$sql</tt><br>\n";                                           
    $result = mysql_query($sql);
    $N = mysql_num_rows($result);
    //echo "<br>Got $N records.\n";                                             
    while( $forum=mysql_fetch_object($result) ) {
        //echo "<br>Forum: ". $forum->id . "(" . $forum->title .")\n";          
 
        if( !isset($forum->timestamp) ) continue;
 
        // check category until we find a helpdesk                              
        $category = $forum->category;
        if( isset($t_list[$category]) && $t_list[$category] == 0) continue;
 
        $sql="SELECT * FROM category WHERE id=$category";
        //echo "<br><tt>$sql</tt><br>\n";                                       
        $r2 =  mysql_query($sql);
        $cat = mysql_fetch_object($r2);
        $t_list[$category] = $cat->is_helpdesk;
        if( $t_list[$category] ) break;
    }
    //  echo "<br>Forum: ". $forum->id . "(" . $forum->title .")\n";            
    return $forum->timestamp;
 }

This is based on the "old" forum code, so it may not work with the latest BOINC. I think it probably does, because it just accesses the database table directly, but to be included in the BOINC code base it would have to be altered to use the newer database abstraction layer.

forum_index.php

In the file html/user/forum_index.php find the function which outputs the page header, and the comment above the listing of forums. Mine looks like:

 page_head(tr(FORUM_TITLE));
 
 if(1) {
  
  echo "<TABLE width=100%><TR><TD>                                              
      For <em>Questions and Answers</em> see also the                           
      <a href=forum_help_desk.php>Help Desk</a>                                 
       ";
After this, add the following code:
  // Signal if there are any recent posts in the Help Desk area                 
  //                                                                            
  $t1=time();
  $t2=newest_post_time(true);
 
  if( ($dt = ($t1-$t2)) < HELP_DESK_AGE*86400 ) {
      echo " (<font color='ORANGE' size='-1'>Last post ";
      echo time_diff_str($t2,$t1);
      echo "</font>) ";
  }

mine then finishes the line with a link to the search menus at the bottom of the page:

  // Link to search menus, which are now at the bottom                          
  //                                                                            
  echo "<TD align='RIGHT'>                                                      
    <a href='#Search'>Search via <i>title</i> or <i>text</i></a>                
      </TD>                                                                     
      </TR></TABLE>                                                             
    ";
 }

The top of your page may be different, but the main thing is to add the test using newest_post_time(), and then print a message (with a link to the Help Desks) if there is recent activity.

Good luck. Please make corrections above, or comments in the talk page.

Personal tools