• Publicity: Public Only All

content-type-procs.tcl

Procedures for content types

Location:
packages/acs-content-repository/tcl/content-type-procs.tcl
Created:
2004-06-09
Author:
Dave Bauer <dave@thedesignexperience.org>
CVS Identification:
$Id: content-type-procs.tcl,v 1.17.2.1 2019/04/12 21:19:13 gustafn Exp $

Procedures in this file

Detailed information

content::type::attribute::delete (public)

 content::type::attribute::delete -content_type content_type \
    -attribute_name attribute_name [ -drop_column drop_column ]
Switches:
-content_type
(required)
-attribute_name
(required)
-drop_column
(optional)

Partial Call Graph (max 5 caller/called nodes):
%3 package_exec_plsql package_exec_plsql (public) content::type::attribute::delete content::type::attribute::delete content::type::attribute::delete->package_exec_plsql

Testcases:
No testcase defined.

content::type::attribute::new (public)

 content::type::attribute::new -content_type content_type \
    -attribute_name attribute_name -datatype datatype \
    -pretty_name pretty_name [ -pretty_plural pretty_plural ] \
    [ -sort_order sort_order ] [ -default_value default_value ] \
    [ -column_spec column_spec ]
Switches:
-content_type
(required)
-attribute_name
(required)
-datatype
(required)
-pretty_name
(required)
-pretty_plural
(optional)
-sort_order
(optional)
-default_value
(optional)
-column_spec
(optional)
Specification for column to pass to the database. Not optional if the column does not already exist in the table.
Returns:
attribute_id for created attribute

Partial Call Graph (max 5 caller/called nodes):
%3 test_content_item content_item (test acs-content-repository) content::type::attribute::new content::type::attribute::new test_content_item->content::type::attribute::new db_type db_type (public) content::type::attribute::new->db_type package_exec_plsql package_exec_plsql (public) content::type::attribute::new->package_exec_plsql

Testcases:
content_item

content::type::content_type_p (public)

 content::type::content_type_p -content_type content_type \
    -mime_type mime_type

Checks if the mime_type is of the content_type, e.g. if application/pdf is of content_type "image" (which it should not...) Cached

Switches:
-content_type
(required)
content type to check against
-mime_type
(required)
mime type to check for

Partial Call Graph (max 5 caller/called nodes):
%3 fs::add_file fs::add_file (public) content::type::content_type_p content::type::content_type_p fs::add_file->content::type::content_type_p content::type::content_type_p_not_cached content::type::content_type_p_not_cached (private) content::type::content_type_p->content::type::content_type_p_not_cached util_memoize util_memoize (public) content::type::content_type_p->util_memoize

Testcases:
No testcase defined.

content::type::delete (public)

 content::type::delete -content_type content_type \
    [ -drop_children_p drop_children_p ] \
    [ -drop_table_p drop_table_p ] [ -drop_objects_p drop_objects_p ]
Switches:
-content_type
(required)
-drop_children_p
(optional)
-drop_table_p
(optional)
-drop_objects_p
(defaults to "f") (optional)
Drop the objects of this content type along with all entries in cr_items and cr_revisions. Will not be done by default.

Partial Call Graph (max 5 caller/called nodes):
%3 test_content_item content_item (test acs-content-repository) content::type::delete content::type::delete test_content_item->content::type::delete package_exec_plsql package_exec_plsql (public) content::type::delete->package_exec_plsql

Testcases:
content_item

content::type::get_template (public)

 content::type::get_template -content_type content_type \
    [ -use_context use_context ]
Switches:
-content_type
(required)
-use_context
(defaults to "public") (optional)
Returns:
template_id

Partial Call Graph (max 5 caller/called nodes):
%3 package_exec_plsql package_exec_plsql (public) content::type::get_template content::type::get_template content::type::get_template->package_exec_plsql

Testcases:
No testcase defined.

content::type::is_content_type (public)

 content::type::is_content_type -object_type object_type
Switches:
-object_type
(required)
Returns:
t or f

Partial Call Graph (max 5 caller/called nodes):
%3 application_data_link::get_links_from application_data_link::get_links_from (public) content::type::is_content_type content::type::is_content_type application_data_link::get_links_from->content::type::is_content_type application_data_link::get_links_to application_data_link::get_links_to (public) application_data_link::get_links_to->content::type::is_content_type package_exec_plsql package_exec_plsql (public) content::type::is_content_type->package_exec_plsql

Testcases:
No testcase defined.

content::type::new (public)

 content::type::new -content_type content_type [ -supertype supertype ] \
    -pretty_name pretty_name -pretty_plural pretty_plural \
    -table_name table_name -id_column id_column \
    [ -name_method name_method ]
Switches:
-content_type
(required)
-supertype
(defaults to "content_revision") (optional)
-pretty_name
(required)
-pretty_plural
(required)
-table_name
(required)
-id_column
(required)
-name_method
(optional)
Returns:
type_id

Partial Call Graph (max 5 caller/called nodes):
%3 test_content_item content_item (test acs-content-repository) content::type::new content::type::new test_content_item->content::type::new package_exec_plsql package_exec_plsql (public) content::type::new->package_exec_plsql email_image::create_type_folder_rel email_image::create_type_folder_rel (public) email_image::create_type_folder_rel->content::type::new subsite::after_upgrade subsite::after_upgrade (private) subsite::after_upgrade->content::type::new subsite::package_install subsite::package_install (private) subsite::package_install->content::type::new

Testcases:
content_item

content::type::refresh_view (public)

 content::type::refresh_view -content_type content_type
Switches:
-content_type
(required)
Creates or replaces the view associated with the supplied content type. By convention, this view is called TYPEx .

Partial Call Graph (max 5 caller/called nodes):
%3 package_exec_plsql package_exec_plsql (public) content::type::refresh_view content::type::refresh_view content::type::refresh_view->package_exec_plsql

Testcases:
No testcase defined.

content::type::register_child_type (public)

 content::type::register_child_type -parent_type parent_type \
    -child_type child_type [ -relation_tag relation_tag ] \
    [ -min_n min_n ] [ -max_n max_n ]
Switches:
-parent_type
(required)
-child_type
(required)
-relation_tag
(optional)
-min_n
(optional)
-max_n
(optional)
Returns:
0

Partial Call Graph (max 5 caller/called nodes):
%3 package_exec_plsql package_exec_plsql (public) content::type::register_child_type content::type::register_child_type content::type::register_child_type->package_exec_plsql

Testcases:
No testcase defined.

content::type::register_mime_type (public)

 content::type::register_mime_type -content_type content_type \
    -mime_type mime_type

Associate a content_type with a mime_type (both params are strings, e.g. folder , application/pdf )

Switches:
-content_type
(required)
-mime_type
(required)
Returns:
0

Partial Call Graph (max 5 caller/called nodes):
%3 package_exec_plsql package_exec_plsql (public) content::type::register_mime_type content::type::register_mime_type content::type::register_mime_type->package_exec_plsql

Testcases:
No testcase defined.

content::type::register_relation_type (public)

 content::type::register_relation_type -content_type content_type \
    -target_type target_type [ -relation_tag relation_tag ] \
    [ -min_n min_n ] [ -max_n max_n ]
Switches:
-content_type
(required)
-target_type
(required)
-relation_tag
(optional)
-min_n
(optional)
-max_n
(optional)
Returns:
0

Partial Call Graph (max 5 caller/called nodes):
%3 package_exec_plsql package_exec_plsql (public) content::type::register_relation_type content::type::register_relation_type content::type::register_relation_type->package_exec_plsql

Testcases:
No testcase defined.

content::type::register_template (public)

 content::type::register_template -content_type content_type \
    -template_id template_id [ -use_context use_context ] \
    [ -is_default is_default ]
Switches:
-content_type
(required)
-template_id
(required)
-use_context
(defaults to "public") (optional)
-is_default
(optional)

Partial Call Graph (max 5 caller/called nodes):
%3 package_exec_plsql package_exec_plsql (public) content::type::register_template content::type::register_template content::type::register_template->package_exec_plsql

Testcases:
No testcase defined.

content::type::rotate_template (public)

 content::type::rotate_template -template_id template_id \
    -content_type content_type [ -use_context use_context ]

Force all items of content_type to use a new template. This will also cause items of this content type with no template assigned to use the new template. Finally, sets new template as default for this type. (IS THIS RIGHT ???? ----------------- ??????? )

Switches:
-template_id
(required)
-content_type
(required)
-use_context
(defaults to "public") (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 package_exec_plsql package_exec_plsql (public) content::type::rotate_template content::type::rotate_template content::type::rotate_template->package_exec_plsql

Testcases:
No testcase defined.

content::type::set_default_template (public)

 content::type::set_default_template -content_type content_type \
    -template_id template_id [ use_context ]
Switches:
-content_type
(required)
-template_id
(required)
Parameters:
use_context (defaults to "public")
Returns:
0

Partial Call Graph (max 5 caller/called nodes):
%3 package_exec_plsql package_exec_plsql (public) content::type::set_default_template content::type::set_default_template content::type::set_default_template->package_exec_plsql

Testcases:
No testcase defined.

content::type::unregister_child_type (public)

 content::type::unregister_child_type -parent_type parent_type \
    -child_type child_type [ -relation_tag relation_tag ]
Switches:
-parent_type
(required)
-child_type
(required)
-relation_tag
(optional)
Returns:
0
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 package_exec_plsql package_exec_plsql (public) content::type::unregister_child_type content::type::unregister_child_type content::type::unregister_child_type->package_exec_plsql

Testcases:
No testcase defined.

content::type::unregister_mime_type (public)

 content::type::unregister_mime_type -content_type content_type \
    -mime_type mime_type
Switches:
-content_type
(required)
-mime_type
(required)
Returns:
0
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 package_exec_plsql package_exec_plsql (public) content::type::unregister_mime_type content::type::unregister_mime_type content::type::unregister_mime_type->package_exec_plsql

Testcases:
No testcase defined.

content::type::unregister_relation_type (public)

 content::type::unregister_relation_type -content_type content_type \
    -target_type target_type [ -relation_tag relation_tag ]
Switches:
-content_type
(required)
-target_type
(required)
-relation_tag
(optional)
Returns:
0
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 package_exec_plsql package_exec_plsql (public) content::type::unregister_relation_type content::type::unregister_relation_type content::type::unregister_relation_type->package_exec_plsql

Testcases:
No testcase defined.

content::type::unregister_template (public)

 content::type::unregister_template [ -content_type content_type ] \
    -template_id template_id [ -use_context use_context ]
Switches:
-content_type
(optional)
-template_id
(required)
-use_context
(optional)
Returns:
0
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 package_exec_plsql package_exec_plsql (public) content::type::unregister_template content::type::unregister_template content::type::unregister_template->package_exec_plsql

Testcases:
No testcase defined.
[ hide source ] | [ make this the default ]

Content File Source

ad_library {
    
    Procedures for content types
    
    @author Dave Bauer (dave@thedesignexperience.org)
    @creation-date 2004-06-09
    @cvs-id $Id: content-type-procs.tcl,v 1.17.2.1 2019/04/12 21:19:13 gustafn Exp $
}

namespace eval ::content::type {}

namespace eval ::content::type::attribute {}

d_proc -public content::type::new {
    -content_type:required
    {-supertype "content_revision"}
    -pretty_name:required
    -pretty_plural:required
    -table_name:required
    -id_column:required
    {-name_method ""}
} {
    @param content_type
    @param supertype
    @param pretty_name
    @param pretty_plural
    @param table_name
    @param id_column
    @param name_method
    @return type_id
} {
    return [package_exec_plsql -var_list [list \
        [list content_type $content_type ] \
        [list supertype $supertype ] \
        [list pretty_name $pretty_name ] \
        [list pretty_plural $pretty_plural ] \
        [list table_name $table_name ] \
        [list id_column $id_column ] \
        [list name_method $name_method ] \
    ] content_type create_type]
}

d_proc -public content::type::delete {
    -content_type:required
    {-drop_children_p ""}
    {-drop_table_p ""}
    {-drop_objects_p "f"}
} {
    @param content_type
    @param drop_children_p
    @param drop_table_p
    @param drop_objects_p Drop the objects of this content type along with all entries in cr_items and cr_revisions. Will not be done by default.
} {
    if {$drop_objects_p == "f"} {
    return [package_exec_plsql -var_list [list \
                          [list content_type $content_type ] \
                          [list drop_children_p $drop_children_p ] \
                          [list drop_table_p $drop_table_p ] \
                         ] content_type drop_type]
    } else {
    return [package_exec_plsql -var_list [list \
                          [list content_type $content_type ] \
                          [list drop_children_p $drop_children_p ] \
                          [list drop_table_p $drop_table_p ] \
                          [list drop_objects_p $drop_objects_p ] \
                         ] content_type drop_type]
    }
}

d_proc -public content::type::attribute::new {
    -content_type:required
    -attribute_name:required
    -datatype:required
    -pretty_name:required
    {-pretty_plural ""}
    {-sort_order ""}
    {-default_value ""}
    {-column_spec ""}
} {
    @param content_type
    @param attribute_name
    @param datatype
    @param pretty_name
    @param pretty_plural
    @param sort_order
    @param default_value
    @param column_spec Specification for column to pass to the
 database. Not optional if the column does not already exist in the table.

    @return attribute_id for created attribute
} {
    if {[db_type] eq "oracle"} {
    switch -- $column_spec {
        text { set column_spec clob }
        boolean { set column_spec "char(1)" }
    }
    } else {
    switch -- $column_spec {
        clob { set column_spec text }
    }
    }

    return [package_exec_plsql -var_list [list \
        [list content_type $content_type ] \
        [list attribute_name $attribute_name ] \
        [list datatype $datatype ] \
        [list pretty_name $pretty_name ] \
        [list pretty_plural $pretty_plural ] \
        [list sort_order $sort_order ] \
        [list default_value $default_value ] \
        [list column_spec $column_spec ] \
    ] content_type create_attribute]
}



d_proc -public content::type::attribute::delete {
    -content_type:required
    -attribute_name:required
    {-drop_column ""}
} {
    @param content_type
    @param attribute_name
    @param drop_column
} {
    return [package_exec_plsql -var_list [list \
        [list content_type $content_type ] \
        [list attribute_name $attribute_name ] \
        [list drop_column $drop_column ] \
    ] content_type drop_attribute]
}



d_proc -public content::type::get_template {
    -content_type:required
    {-use_context "public"}
} {
    @param content_type
    @param use_context

    @return template_id
} {
    return [package_exec_plsql -var_list [list \
        [list content_type $content_type ] \
        [list use_context $use_context ] \
    ] content_type get_template]
}


d_proc -public content::type::is_content_type {
    -object_type:required
} {
    @param object_type

    @return t or f
} {
    return [package_exec_plsql -var_list [list \
        [list object_type $object_type ] \
    ] content_type is_content_type]
}


d_proc -public content::type::refresh_view {
    -content_type:required
} {
    @param content_type

    Creates or replaces the view associated with the supplied content type. By convention,
    this view is called TYPEx .
} {
    return [package_exec_plsql -var_list [list \
        [list content_type $content_type ] \
    ] content_type refresh_view]
}


d_proc -public content::type::register_child_type {
    -parent_type:required
    -child_type:required
    {-relation_tag ""}
    {-min_n ""}
    {-max_n ""}
} {
    @param parent_type
    @param child_type
    @param relation_tag
    @param min_n
    @param max_n
    @return 0
} {
    return [package_exec_plsql -var_list [list \
        [list parent_type $parent_type ] \
        [list child_type $child_type ] \
        [list relation_tag $relation_tag ] \
        [list min_n $min_n ] \
        [list max_n $max_n ] \
    ] content_type register_child_type]
}


d_proc -public content::type::register_mime_type {
    -content_type:required
    -mime_type:required
} {
    Associate a content_type with a mime_type (both params are strings, e.g. folder , application/pdf )
    @param content_type
    @param mime_type
    @return 0
} {
    return [package_exec_plsql -var_list [list \
        [list content_type $content_type ] \
        [list mime_type $mime_type ] \
    ] content_type register_mime_type]
}


d_proc -public content::type::register_relation_type {
    -content_type:required
    -target_type:required
    {-relation_tag ""}
    {-min_n ""}
    {-max_n ""}
} {
    @param content_type
    @param target_type
    @param relation_tag
    @param min_n
    @param max_n
    @return 0
} {
    return [package_exec_plsql -var_list [list \
        [list content_type $content_type ] \
        [list target_type $target_type ] \
        [list relation_tag $relation_tag ] \
        [list min_n $min_n ] \
        [list max_n $max_n ] \
    ] content_type register_relation_type]
}


d_proc -public content::type::register_template {
    -content_type:required
    -template_id:required
    {-use_context "public"}
    {-is_default ""}
} {
    @param content_type
    @param template_id
    @param use_context
    @param is_default
} {
    return [package_exec_plsql -var_list [list \
        [list content_type $content_type ] \
        [list template_id $template_id ] \
        [list use_context $use_context ] \
        [list is_default $is_default ] \
    ] content_type register_template]
}


d_proc -public content::type::rotate_template {
    -template_id:required
    -content_type:required
    {-use_context "public"}
} {
    Force all items of content_type to use a new template. This will also cause items of this content
    type with no template assigned to use the new template. Finally, sets new template as default for
    this type. (IS THIS RIGHT ???? ----------------- ??????? )

    @param template_id
    @param content_type
    @param use_context
} {
    return [package_exec_plsql -var_list [list \
        [list template_id $template_id ] \
        [list content_type $v_content_type ] \
        [list use_context $use_context ] \
    ] content_type rotate_template]
}


d_proc -public content::type::set_default_template {
    -content_type:required
    -template_id:required
    {use_context "public"}
} {
    @param content_type
    @param template_id
    @param use_context
    @return 0
} {
    return [package_exec_plsql -var_list [list \
        [list content_type $content_type ] \
        [list template_id $template_id ] \
        [list use_context $use_context ] \
    ] content_type set_default_template]
}


d_proc -public content::type::unregister_child_type {
    -parent_type:required
    -child_type:required
    {-relation_tag ""}
} {
    @param parent_type
    @param child_type
    @param relation_tag
    @see content::type::register_child_type
    @return 0
} {
    return [package_exec_plsql -var_list [list \
        [list parent_type $parent_type ] \
        [list child_type $child_type ] \
        [list relation_tag $relation_tag ] \
    ] content_type unregister_child_type]
}


d_proc -public content::type::unregister_mime_type {
    -content_type:required
    -mime_type:required
} {
    @param content_type
    @param mime_type
    @see content::type::register_mime_type
    @return 0
} {
    return [package_exec_plsql -var_list [list \
        [list content_type $content_type ] \
        [list mime_type $mime_type ] \
    ] content_type unregister_mime_type]
}


d_proc -public content::type::unregister_relation_type {
    -content_type:required
    -target_type:required
    {-relation_tag ""}
} {
    @param content_type
    @param target_type
    @param relation_tag
    @see content::type::register_relation_type
    @return 0
} {
    return [package_exec_plsql -var_list [list \
        [list content_type $content_type ] \
        [list target_type $target_type ] \
        [list relation_tag $relation_tag ] \
    ] content_type unregister_relation_type]
}


d_proc -public content::type::unregister_template {
    {-content_type ""}
    -template_id:required
    {-use_context ""}
} {
    @param content_type
    @param template_id
    @param use_context
    @see content::type::register_template
    @return 0
} {
    return [package_exec_plsql -var_list [list \
        [list content_type $content_type ] \
        [list template_id $template_id ] \
        [list use_context $use_context ] \
    ] content_type unregister_template]
}

d_proc -public content::type::content_type_p {
    -content_type:required
    -mime_type:required
} {
    Checks if the mime_type is of the content_type, e.g. if application/pdf is of content_type "image" (which it should not...)

    Cached

    @param content_type content type to check against
    @param mime_type mime type to check for
} {
    return [util_memoize [list content::type::content_type_p_not_cached -mime_type $mime_type -content_type $content_type]]
}

d_proc -private content::type::content_type_p_not_cached {
    -content_type:required
    -mime_type:required
} {
    Checks if the mime_type is of the content_type, e.g. if application/pdf is of content_type "image" (which it should not...)
    @param content_type content type to check against
    @param mime_type mime type to check for
} {
    return [db_string content_type_p "" -default 0]
}

# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: