## content_folder

Content Repository : content_folder

- Overview
- Related Objects
- API

### Overview

Content folders contain related content items and allow content managers to group content as they see fit. Within a content folder, content items must have unique names since this is where they will be served from. For example within the folder "movies" (served from "/movies") all items must have unique names, such as: "terminator," "terminator2" (served from "/movies/terminator, "/movies/terminator2" respectively).

### Related Objects

See also: Content Item

### API

- Function: content_folder.get_index_page

  Returns the item ID of the index page of the folder, null otherwise

  Author: | Michael Pih
  Returns: | The item ID of the index page
  Parameters:

  > folder_id The: |  | folder id

  Declaration:

      function get_index_page (
        folder_id in cr_folders.folder_id%TYPE
      ) return cr_items.item_id%TYPE;

- Function: content_folder.get_label

  Returns the label for the folder. This function is the default name method for the folder object.

  Author: | Karl Goldstein
  Returns: | The folder's label
  Parameters:

  > folder_id: |  | The folder id

  Declaration:

      function get_label (
        folder_id in cr_folders.folder_id%TYPE
      ) return cr_folders.label%TYPE;

  See Also: | acs_object_type.create_type, the docs for the name_method parameter

- Function: content_folder.is_empty

  Determine if the folder is empty

  Author: | Karl Goldstein
  Returns: | 't' if the folder contains no subfolders or items, 'f' otherwise
  Parameters:

  > folder_id: |  | The folder id

  Declaration:

      function is_empty (
        folder_id  in cr_folders.folder_id%TYPE
      ) return varchar2;

  See Also: | content_folder.is_folder

- Function: content_folder.is_folder

  Determine if the item is a folder

  Author: | Karl Goldstein
  Returns: | 't' if the item is a folder, 'f' otherwise
  Parameters:

  > item_id: |  | The item id

  Declaration:

      function is_folder (
        item_id	  in cr_items.item_id%TYPE
      ) return char;

  See Also: | content_folder.new, content_folder.is_sub_folder

- Function: content_folder.is_registered

  change this to is_type_registered Determines if a content type is registered to the folder Only items of the registered type(s) may be added to the folder.

  Author: | Karl Goldstein
  Returns: | 't' if the type is registered to this folder, 'f' otherwise
  Parameters:

  > folder_id: |  | The folder id
  > content_type: |  | The content type to be checked
  > include_subtypes: |  | If 't', all subtypes of the `content_type` will be checked, returning 't' if all of them are registered. If 'f', only an exact match with `content_type` will be performed.

  Declaration:

      function is_registered (
        folder_id		in cr_folders.folder_id%TYPE,
        content_type		in cr_folder_type_map.content_type%TYPE,
        include_subtypes	in varchar2 default 'f'
      ) return varchar2;

  See Also: | content_folder.register_content_type, content_folder.unregister_content_type,

- Function: content_folder.is_sub_folder

  Determine if the item `target_folder_id` is a subfolder of the item `folder_id`

  Author: | Karl Goldstein
  Returns: | 't' if the item `target_folder_id` is a subfolder of the item `folder_id`, 'f' otherwise
  Parameters:

  > folder_id: |  | The superfolder id
  > target_folder_id: |  | The subfolder id

  Declaration:

      function is_sub_folder (
        folder_id		in cr_folders.folder_id%TYPE,
        target_folder_id	in cr_folders.folder_id%TYPE
      ) return char;

  See Also: | content_folder.is_folder

- Function: content_folder.new

  Create a new folder

  Author: | Karl Goldstein
  Returns: | The id of the newly created folder
  Parameters:

  > label: |  | The label for the folder
  > description: |  | A short description of the folder, 4000 characters maximum
  > parent_id: |  | The parent of the folder
  > folder_id: |  | The id of the new folder. A new id will be allocated by default
  > revision_id: |  | The id of the new revision. A new id will be allocated by default
  > creation_date: |  | As in `acs_object.new`
  > creation_ip: |  | As in `acs_object.new`
  > creation_user: |  | As in `acs_object.new`

  Declaration:

      function new (
        name          in cr_items.name%TYPE,
        label         in cr_folders.label%TYPE,
        description   in cr_folders.description%TYPE default null,
        parent_id     in acs_objects.context_id%TYPE default null,
        folder_id	in cr_folders.folder_id%TYPE default null,
        creation_date	in acs_objects.creation_date%TYPE
      			   default sysdate,
        creation_user	in acs_objects.creation_user%TYPE
      			   default null,
        creation_ip	in acs_objects.creation_ip%TYPE default null
      ) return cr_folders.folder_id%TYPE;

  See Also: | acs_object.new, content_item.new

- Procedure: content_folder.copy

  Recursively copy the folder and all items in into a new location. An error is thrown if either of the parameters is not a folder. The root folder of the sitemap and the root folder of the templates cannot be copied

  Author: | Karl Goldstein
  Parameters:

  > folder_id: |  | The id of the folder to copy
  > target_folder_id: |  | The destination folder

  Declaration:

      procedure copy (
        folder_id		in cr_folders.folder_id%TYPE,
        target_folder_id	in cr_folders.folder_id%TYPE
      );

  See Also: | content_folder.new, content_folder.copy

- Procedure: content_folder.delete

  Delete a folder. An error is thrown if the folder is not empty

  Author: | Karl Goldstein
  Parameters:

  > folder_id: |  | The id of the folder to delete

  Declaration:

      procedure delete (
        folder_id	in cr_folders.folder_id%TYPE
      );

  See Also: | acs_object.delete, content_item.delete

- Procedure: content_folder.move

  Recursively move the folder and all items in into a new location. An error is thrown if either of the parameters is not a folder. The root folder of the sitemap and the root folder of the templates cannot be moved.

  Author: | Karl Goldstein
  Parameters:

  > folder_id: |  | The id of the folder to move
  > target_folder_id: |  | The destination folder

  Declaration:

      procedure move (
        folder_id		in cr_folders.folder_id%TYPE,
        target_folder_id	in cr_folders.folder_id%TYPE
      );

  See Also: | content_folder.new, content_folder.copy

- Procedure: content_folder.register_content_type

  Register a content type to the folder, if it is not already registered. Only items of the registered type(s) may be added to the folder.

  Author: | Karl Goldstein
  Parameters:

  > folder_id: |  | The folder id
  > content_type: |  | The content type to be registered

  Declaration:

      procedure register_content_type (
        folder_id		in cr_folders.folder_id%TYPE,
        content_type		in cr_folder_type_map.content_type%TYPE,
        include_subtypes	in varchar2 default 'f'
      );

  See Also: | content_folder.unregister_content_type, content_folder.is_registered

- Procedure: content_folder.edit_name

  Change the name, label and/or description of the folder

  Author: | Karl Goldstein
  Parameters:

  > folder_id: |  | The id of the folder to modify
  > name: |  | The new name for the folder. An error will be thrown if an item with this name already exists under this folder's parent. If this parameter is null, the old name will be preserved
  > label: |  | The new label for the folder. The old label will be preserved if this parameter is null
  > label: |  | The new description for the folder. The old description will be preserved if this parameter is null

  Declaration:

      procedure rename (
        folder_id	 in cr_folders.folder_id%TYPE,
        name           in cr_items.name%TYPE default null,
        label  	 in cr_folders.label%TYPE default null,
        description    in cr_folders.description%TYPE default null
      );

  See Also: | content_folder.new

- Procedure: content_folder.unregister_content_type

  Unregister a content type from the folder, if it has been registered. Only items of the registered type(s) may be added to the folder. If the folder already contains items of the type to be unregistered, the items remain in the folder.

  Author: | Karl Goldstein
  Parameters:

  > folder_id: |  | The folder id
  > content_type: |  | The content type to be unregistered
  > include_subtypes: |  | If 't', all subtypes of `content_type` will be unregistered as well

  Declaration:

      procedure unregister_content_type (
        folder_id		in cr_folders.folder_id%TYPE,
        content_type		in cr_folder_type_map.content_type%TYPE,
        include_subtypes	in varchar2 default 'f'
      );

  See Also: | content_folder.register_content_type, content_folder.is_registered

  Last Modified: $Id: folder.html,v 1.2 2004/06/01 22:54:18 donb Exp $