You are here

function filedepot_view in filedepot 6

Same name and namespace in other branches
  1. 7 filedepot.module \filedepot_view()

Implementation of hook_view().

File

./filedepot.module, line 561
filedepot.module Filedepot: File Management Module developed by Nextide www.nextide.ca Full featured document managment module with a desktop application feel. Integrated role and user permissions to secure folders, automated notifications, Tag Cloud…

Code

function filedepot_view($node, $teaser = FALSE, $page = FALSE) {
  if (!$teaser) {

    // Using the default view
    $node = node_prepare($node, $teaser);
    $node->title = filter_xss($node->title);
    $node->folderdesc = nl2br(filter_xss($node->folderdesc));
    $node->content['folderdesc'] = array(
      '#value' => theme('item', array(
        '#title' => t('Description'),
        '#value' => $node->folderdesc,
      )),
    );

    // Now add the parent folder selection
    $parentFolder = db_result(db_query("SELECT pid FROM {filedepot_categories} WHERE nid=%d", $node->nid));
    if ($parentFolder == 0) {
      $parentFolderName = t('Top Level Folder');
    }
    else {
      $parentFolderName = db_result(db_query("SELECT name FROM {filedepot_categories} WHERE cid=%d", $parentFolder));
    }
    $node->content['parentfolder'] = array(
      '#value' => theme('item', array(
        '#title' => t('Parent Folder'),
        '#value' => $parentFolderName,
      )),
      '#weight' => 3,
    );
    $node->content['nexfiles'] = array(
      '#value' => theme('filedepot_files', $node),
      '#weight' => 2,
    );

    // Hide the default CCK view of the attachements (files)
    unset($node->field_filedepot_file);
  }
  return $node;
}