etp::get_pa (private)

 etp::get_pa package_id name [ content_type ]

Defined in packages/edit-this-page/tcl/etp-procs.tcl

Parameters:
package_id - The package_id for the current request
name - The page name of the current request.
content_type (optional)
Returns:
The tcl array (in list form) of page attributes. Does the real work of setting up the page-attribute array, which is then fed to the cache. The (package_id name) combination uniquely identifies a page.
Author:
Luke Pond
Created:
2001-05-31

Partial Call Graph (max 5 caller/called nodes):
%3 etp::get_page_attributes etp::get_page_attributes (public) etp::get_pa etp::get_pa etp::get_page_attributes->etp::get_pa ad_conn ad_conn (public) etp::get_pa->ad_conn ad_context_bar ad_context_bar (public) etp::get_pa->ad_context_bar db_1row db_1row (public) etp::get_pa->db_1row etp::get_ext_attribute_columns etp::get_ext_attribute_columns (public) etp::get_pa->etp::get_ext_attribute_columns template::util::richtext template::util::richtext (public) etp::get_pa->template::util::richtext

Testcases:
No testcase defined.
Source code:

        set extended_attributes [get_ext_attribute_columns $content_type]

        set revision_id [ad_conn revision_id]
        if {$revision_id eq ""} {
            # this will throw an error if the page does not exist
            db_1row get_page_attributes "" -column_array pa
        } else {
            # revision_id was set by index.vuh
            db_1row get_page_attributes_other_revision "" -column_array pa
        }

        if {$pa(mime_type) eq ""} {
            set pa(mime_type) "text/html"
        }

        if {"text/html" ne $pa(mime_type) } {
            set pa(content) [template::util::richtext get_property html_value [list $pa(content) $pa(mime_type)]]
        }
        # add in the context bar
        if { $name eq "index" } {
            set cb [ad_context_bar]
            set context [list]
        } else {
            set cb [ad_context_bar $pa(title)]
            set context [list $pa(title)]
        }
        # remove the "Your Workspace" link, so we can cache this context
        # bar and it will work for everyone

        regsub {^<a href="/pvt/home">Your Workspace</a> : } $cb "" cb

        if {[lindex $cb 1] eq "Your Workspace"} {
            set cb [lreplace $cb 0 1]
        }
        set pa(context_bar) $cb
        set pa(context) $context

        return [array get pa]
Generic XQL file:
packages/edit-this-page/tcl/etp-procs.xql

PostgreSQL XQL file:
<fullquery name="etp::get_pa.get_page_attributes">
    <querytext>
	select i.item_id, i.name, r.revision_id, r.title, r.mime_type,
	       r.description, r.publish_date, r.content $extended_attributes
	  from cr_items i, cr_revisions r
	 where i.parent_id = etp__get_folder_id(:package_id)
	   and i.name = :name
	   and i.item_id = r.item_id
	   and r.revision_id = i.live_revision
</querytext>
</fullquery>

<fullquery name="etp::get_pa.get_page_attributes_other_revision">
    <querytext>
	select i.item_id, i.name, r.revision_id, r.title, r.mime_type,
	       r.description, r.publish_date, r.content $extended_attributes
	  from cr_items i, cr_revisions r
	 where i.parent_id = etp__get_folder_id(:package_id)
	   and i.name = :name
	   and i.item_id = r.item_id
	   and r.revision_id = :revision_id
</querytext>
</fullquery>
packages/edit-this-page/tcl/etp-procs-postgresql.xql

Oracle XQL file:
<fullquery name="etp::get_pa.get_page_attributes">
    <querytext>
	select i.item_id, i.name, r.revision_id, r.title, 
	       r.description, r.publish_date, r.content $extended_attributes
	  from cr_items i, cr_revisions r
	 where i.parent_id = etp.get_folder_id(:package_id)
	   and i.name = :name
	   and i.item_id = r.item_id
	   and r.revision_id = i.live_revision
</querytext>
</fullquery>

<fullquery name="etp::get_pa.get_page_attributes_other_revision">
    <querytext>
	select i.item_id, i.name, r.revision_id, r.title, 
	       r.description, r.publish_date, r.content $extended_attributes
	  from cr_items i, cr_revisions r
	 where i.parent_id = etp.get_folder_id(:package_id)
	   and i.name = :name
	   and i.item_id = r.item_id
	   and r.revision_id = :revision_id
</querytext>
</fullquery>
packages/edit-this-page/tcl/etp-procs-oracle.xql

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