Hi People,

I been evaluating the various Open Source CMS and trying to replace our old lousy intranet system built on ASP
Been trying out drupal for about a month and impress with the way it is designed, very modular.
At the same time, I have been trying to understand some of the codes which are rather difficult for a newbie like me.

As we have different departments, I have been thinking how to build one block for each department.
Each department (block) will have a
-book (posting reports, procedures,information about the department)
-forum (Chit-Chat)
-image library (Gallery of images)
In the begining, all the above will be given access to all staff with the userID/Password of our intranet.
In future, I would be restricting access base on roles/simple access groups on sensitive info like maybe accounts reports.
So I have to plan long term and decide on which way to go

I tried out the organic groups but sees the limitation of how it works. It is also quite restictive as we have to follow the way the block is displayed and the album feature is not too impressive.
Nextup is restrict by access using node/role base. But then, I need to code the 'check user role' per block and node. And with my work commitments, I might not have the time to do that.
Lastly, taxonomy. Have not got a full understanding of it so correct me if I am wrong, I will be able to categories the book, forum. image library into per department. So the best way to go is using taxonomy. I added in the taxnonomy access module but can't really understand how to give the correct permissions.

Could anyone offer some advice on whether my decision above is correct and how to further make use of taxonomy
I have big plans for drupal usuage in our intranet which will have more features in future like meeting room bookings, company forms etc which will discuss further in future.
Thanks.

Regards,
AT

Comments

pgregg’s picture

I created a taxo hierarchy similar to:
-Company
--Departments
---IS
---HR
---Finance
---etc
--projects
--news

And used PHP code as the homepage / projects page on each Departments page that selects nodes that have taxonomies related.

e.g. If HR wants to create a news story, then they tag it HR and news (pretty simple, huh? ;)

The following function is used to generate the HTML for the pages:

File: my_taxo.inc.php


Function GetDeptTaxoHTML($taxo_dept, $taxo_names, $style='div', $max=0) {

  $taxo_names_sql = " AND t3.name IN ('"
                . implode ("','",$taxo_names) . "')";
  $sql = <<<EOSQL
select distinct(node.title), node.nid, node.teaser FROM node INNER JOIN (term_data t1, term_data t2, term_data t3, term_hierarchy h1, term_hierarchy h2, term_node n1, term_node n2) ON node.nid=n1.nid AND node.nid=n2.nid WHERE t1.name='department' AND t1.tid=h1.parent AND h1.tid=t2.tid AND t2.name='$taxo_dept' AND n1.tid=t2.tid AND n2.tid=t3.tid AND t3.tid=h2.tid $taxo_names_sql ORDER BY created DESC
EOSQL;

  $output = '';
  #$output .= "SQL: $sql\n";
  switch($style) {
    case 'div':
      $output .= '<div style="overflow:auto;">';
      break;
    case 'ul':
    default:
      $output .= '<ul>';
      break;
  }

  $result = db_query($sql);
  $limit = 0;
  while ($anode = db_fetch_object($result)) {
    if ($max>0) ++$limit;

    switch($style) {

      case 'div':
        $output .= '<div class="comment" style="width:200px; float: left;">'
                .  l($anode->title, "node/$anode->nid")
                .  '<br><small>'
                .  t($anode->teaser)
                .  '</small></div>';
        break;


      case 'ul':
      default:
        $output .= '<li>&nbsp;'
                .  l($anode->title, "node/$anode->nid")
                .  '<br><small>'
                .  t($anode->teaser)
                .  '</small></li>';
        break;
    }
  }

  switch($style) {
    case 'div':
      $output .= '</div><br clear="all">';
      break;
    case 'ul':
    default:
      $output .= '</ul>';
      break;
      break;
  }


  return $output;
}

Then in each page that you want to display nodes relevant to your dept/term you simply do something like:

$taxo_names = array('intranet', 'page', 'project');
$taxo_dept = 'is';
$max = 0; # Unlimited
$style = 'div';

include "/web/my_taxo.inc.php";
$output = GetDeptTaxoHTML($taxo_dept, $taxo_names, $style, $max);
print $output;

Hope this helps.

www.pgregg.com

infigaro’s picture

Hi pgregg,

Thanks for your reply on the taxo. Its helps when I taxo the contents against my company hotels structure which is rather complex as the departments are also scatter all around the world. I am still in the planning stage for the intranet especially on the taxo for example:

Company
-countries
--Singapore
--Maldives
--Seychelles
--Thailand
-department
--IT
--HR
--Accounts
--Housekeeping
-content
--news
--reports
--policy
--ftp

As for your code, it sure looks complex for me. I just finish my first test module with the guide from the drupal handbook and now trying to learn more on the coding as for my intranet requirements, I would need to tweak drupal for my needs which should be easy once I can understand the drupal codings.

Regards,
Infigaro
www.infigaro.com