content::get_content (public)

 content::get_content [ content_type ]

Defined in packages/acs-content-repository/tcl/filter-procs.tcl

sets the content in the array "content" in the callers scope assumes item_id or revision_id is set in the ::content namespace.

Parameters:
content_type (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 acs_object_type::get_table_name acs_object_type::get_table_name (public) db_0or1row db_0or1row (public) db_map db_map (public) db_string db_string (public) template::util::is_nil template::util::is_nil (public) content::get_content content::get_content content::get_content->acs_object_type::get_table_name content::get_content->db_0or1row content::get_content->db_map content::get_content->db_string content::get_content->template::util::is_nil

Testcases:
No testcase defined.
Source code:
    variable item_id
    variable revision_id

    if { [template::util::is_nil item_id] } {
        ns_log warning "content::get_content: No active item in content::get_content"
        return
    }

    if { [template::util::is_nil revision_id] } {
    # Try to get the live revision
    ns_log notice "content::get_content: trying to get live revision"
    set revision_id [db_string get_revision ""]
    if { [template::util::is_nil revision_id] } {
        ns_log notice "content::get_content: No live revision for item $item_id"
        return
    }
    }

    # Get the mime type, decide if we want the text
    set mime_type [db_string get_mime_type ""]

    if { [template::util::is_nil mime_type] } {
        ns_log notice "content::get_content: No such revision: $revision_id"
        return
    }

    if { [string equal -length 4 "text" $mime_type] } {
        set text_sql [db_map content_as_text]
    } else {
        set text_sql ""
    }

    # Get the content type
    if { $content_type eq "" } {
        set content_type [db_string get_content_type ""]
    }

    # Get the table name
    set table_name [acs_object_type::get_table_name  -object_type $content_type]

    upvar content content

    # Get (all) the content (note this is really dependent on file type)
    if {![db_0or1row get_content "" -column_array content]} {
        ns_log notice "content::get_content: No data found for item $item_id, revision $revision_id"
        return 0
    }
Generic XQL file:
<fullquery name="content::get_content.get_revision">
    <querytext>

        select live_revision from cr_items where item_id = :item_id

      </querytext>
</fullquery>

<fullquery name="content::get_content.get_mime_type">
    <querytext>

        select mime_type from cr_revisions 
        where revision_id = :revision_id

      </querytext>
</fullquery>

<fullquery name="content::get_content.get_content_type">
    <querytext>

        select content_type from cr_items 
        where item_id = :item_id

      </querytext>
</fullquery>

<fullquery name="content::get_content.content_as_text">
    <querytext>

	, content as text

	</querytext>
</fullquery>

<fullquery name="content::get_content.get_content">
    <querytext>

        select 
           x.*, 
          :content_type as content_type
          $text_sql
        from
          cr_revisions r, ${table_name}x x
        where
          r.revision_id = :revision_id
        and 
          x.revision_id = r.revision_id

      </querytext>
</fullquery>
packages/acs-content-repository/tcl/filter-procs.xql

PostgreSQL XQL file:
packages/acs-content-repository/tcl/filter-procs-postgresql.xql

Oracle XQL file:
packages/acs-content-repository/tcl/filter-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: