FOSSology Project Logo FOSSology
Advancing open source analysis and development
 

Customizing Tips

The entire FOSSology user interface is controlled by a collection of plug-ins. A beautiful thing about open source is that you are free to customize and add plugins to suite your needs. Modifying just a few plug-ins will really help you to integrate FOSSology into your work environment. To do so, go to the plug-in directory at your installation. This might be in

/usr/share/fossology/www/plugins

and get ready to modify some code. BTW, PHP or HTML experience is a plus for this.

Page Titles

When you first log-in with your browser to a new FOSSology installation, you will see something like

This page is displayed by a plug-in called ui-default.php. Let's say you want to change the title, “Welcome to FOSSology” to “The Cat's Meow - License Scanner”. Simply change $Title in ui-default.php from:

class ui_default extends FO_Plugin
  {
  var $Name       = "Default";
  var $Title      = "Welcome to FOSSology";
  var $Version    = "2.0";
  var $MenuList   = "";

to

class ui_default extends FO_Plugin
  {
  var $Name       = "Default";
  var $Title      = "The Cat's Meow - License Scanner";
  var $Version    = "2.0";
  var $MenuList   = "";

Save it, reload the page in your browser, and you should see:

This is how you change any plug-in page title. Pretty easy, huh?

Look at the rest of ui_default.php and you will see the rest of the text on this page. That's how you customize the rest of page.

The fossology logo is displayed by a top navigation plug-in, ui-topnav.php. Look in this file and you will see the logo in output()

  function Output()
    {
    if ($this->State != PLUGIN_STATE_READY) { return; }
    $V="";
    .
    .
    .
    $V .= "<td width='150' rowspan='2'>
           <a href='http://fossology.org' target='_top' style='background:white;'>
           <img alt='FOSSology' title='FOSSology' src='" . Traceback_uri() . 
           "images/fossology-logo.gif' border=0></a></td>";
    $V .= "<td colspan='2'>";
    $V .= $this->menu_html($Menu,0);

Change the href to point to your website and your logo:

    $V .= "<td width='150' rowspan='2'>
           <a href='http://CatsLLP.com/fossology' target='_top' style='background:white;'>
           <img alt='FOSSology' title='FOSSology' src='" . Traceback_uri() . 
           "images/CatsLLP.jpg' border=0></a></td>";

Here's what you get:

Check some of the other screens as well, and you will see your new logo on them as well.

Help

It's good for you to customize Help in the top menu so that the users of your FOSSology installation will know who to go to inside your company or project for help. In this example, let's just create a new plug-in called “Who to call”, that will appear inside your Help menu. Here is the default menu with our new logo:

To create a new simple quick and easy plug-in, let's start with a generic plug-in template. I ususally do this by copying one plug-in and removing the stuff I don't want. In this case I copied ui-about.php to ui-whotocall.php since ui-about.php is already in the help menu. Here is my new plug-in:

global $GlobalReady;
if (!isset($GlobalReady)) { exit; }

class ui_whotocall extends FO_Plugin
{
  var $Name       = "Who_to_Call";   // this is used for the URL
  var $Title      = "Who to Call";   // Title displayed on the page
  var $Version    = "1.0";
  var $MenuList   = "Help::Who to Call";  // put Who to Call in the Help menu
  var $DBaccess   = PLUGIN_DB_NONE;
  var $LoginFlag  = 0; 

  var $MyText = "Call Jack or Jill at extension 5678 if you need help with this applic
ation";
  
  function Output()
  { 
    if ($this->State != PLUGIN_STATE_READY) { return; }
    $V="";
    switch($this->OutputType)
    {
      case "XML":
           $V .= "<text>$this->MyText</text>\n";
           break;
      case "HTML":
           $V .="<h3>Need help?</h3>";
           $V .= "$this->MyText";
           break;
      case "Text":
      default:
           $V .= $this->MyText;
    }      
    if (!$this->OutputToStdout) { return($V); }
    print($V);
    return;
    }
    
  };
$NewPlugin = new ui_whotocall;
$NewPlugin->Initialize();
?>

Here is the new Help menu with our new Who to Call menu choice:

And when you click on Who to Call you will see your our new screen:

More about plugins

You can learn more about creating plug-ins at our page on how to write agents and plugins.

 
customizingtips.txt · Last modified: 2009/04/17 14:37 by bobg

Copyright (C) 2007-2009 Hewlett-Packard Development Company, L.P.
FOSSology Project documentation is licensed under the GNU Free Documentation License Version 1.2
Recent changes RSS feed Valid XHTML 1.0 Valid CSS3 Driven by DokuWiki