Index: openacs-4/packages/acs-content-repository/tcl/deprecated-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/deprecated-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-content-repository/tcl/deprecated-procs.tcl 25 Jul 2018 18:39:58 -0000 1.4 +++ openacs-4/packages/acs-content-repository/tcl/deprecated-procs.tcl 25 Jul 2018 18:40:21 -0000 1.5 @@ -9,7 +9,7 @@ ns_section ns/server/${server}/acs ns_param WithDeprecatedCode 0 - + @cvs-id $Id$ } @@ -48,7 +48,7 @@ } set keyword_id [db_exec_plsql content_keyword_new {}] - + return $keyword_id } @@ -116,7 +116,7 @@ {-singular:boolean} } { Assign one or more keywords to a content_item. - + @param singular If singular is specified, then any keywords with the same parent_id as this keyword_id will first be unassigned. @@ -154,7 +154,7 @@ If parent_id is supplied, only keywords that are children of parent_id are listed. - + @see content::keyword::item_get_assigned } { @@ -184,7 +184,7 @@ an empty list if there are no children. @author Peter Marklund - @see content::keyword::get_children + @see content::keyword::get_children } { return [content::keyword::get_children -parent_id $parent_id] } @@ -340,31 +340,31 @@ namespace eval item {} -ad_proc -public -deprecated item::get_content { +ad_proc -public -deprecated item::get_content { {-revision_id ""} {-array:required} {-item_id ""} } { @public get_revision_content - + Create a onerow datasource called content in the calling frame which contains all attributes for the revision (including inherited ones).

The datasource will contain a column called "text", representing the main content (blob) of the revision, but only if the revision has a textual mime-type. - + @param revision_id The revision whose attributes are to be retrieved - + @option item_id The item_id of the corresponding item. You can provide this as an optimization. - If you don't provide revision_id, you must provide item_id, + If you don't provide revision_id, you must provide item_id, and the item must have a live revision. - + @return 1 on success (and set the array in the calling frame), - 0 on failure - + 0 on failure + @see content::item::get_content } { @@ -375,25 +375,25 @@ if { $item_id eq "" } { ns_log notice "item::get_content: no such revision: $revision_id" return 0 - } + } } elseif { $revision_id eq "" } { set revision_id [::content::item::get_live_revision -item_id $item_id] } if { $revision_id eq "" } { error "You must supply revision_id, or the item must have a live revision." } - + return [item::get_revision_content $revision_id $item_id] } ad_proc -public -deprecated item::content_is_null { revision_id } { @public content_is_null - + Determines if the content for the revision is null (not mereley zero-length) @param revision_id The revision id - + @return 1 if the content is null, 0 otherwise @see content::item::content_is_null @@ -407,52 +407,52 @@ ad_proc -public -deprecated item::get_revision_content { revision_id args } { @public get_revision_content - + Create a onerow datasource called content in the calling frame which contains all attributes for the revision (including inherited ones).

The datasource will contain a column called "text", representing the main content (blob) of the revision, but only if the revision has a textual mime-type. - + @param revision_id The revision whose attributes are to be retrieved - + @option item_id {default auto-generated} The item_id of the corresponding item. - + @return 1 on success (and create a content array in the calling frame), - 0 on failure - + 0 on failure + @see content::item::get_revision_content } { template::util::get_opts $args - + if { ![info exists opts(item_id)] } { # Get the item id set item_id [::content::revision::item_id -revision_id $revision_id] if { [template::util::is_nil item_id] } { ns_log warning "item::get_revision_content: No such revision: $revision_id" return 0 - } + } } else { set item_id $opts(item_id) } # Get the mime type, decide if we want the text content::item::get -item_id $item_id -array_name item_info - if { [info exists item_info(mime_type)] - && $item_info(mime_type) ne "" - && [string match "text/*" $item_info(mime_type)] + if { [info exists item_info(mime_type)] + && $item_info(mime_type) ne "" + && [string match "text/*" $item_info(mime_type)] } { set text_sql [db_map grc_get_all_content_1] } else { set text_sql "" } - + # Get the content type set content_type $item_info(content_type) @@ -464,38 +464,38 @@ # Get (all) the content (note this is really dependent on file type) db_0or1row grc_get_all_content "" -column_array content - if { ![array exists content] } { + if { ![array exists content] } { ns_log warning "item::get_revision_content: No data found for item $item_id, revision $revision_id" return 0 } - + return 1 } ad_proc -public -deprecated item::content_methods_by_type { content_type args } { @public content_methods_by_type - - Determines all the valid content methods for instantiating + + Determines all the valid content methods for instantiating a content type. - Possible choices are text_entry, file_upload, no_content and + Possible choices are text_entry, file_upload, no_content and xml_import. Currently, this proc merely removes the text_entry method if the item does not have a text mime type registered to it. In the future, a more sophisticated mechanism will be implemented. - + @param content_type The content type - + @option get_labels Return not just a list of types, but a list of name-value pairs, as in the -options - ATS switch for form widgets - + ATS switch for form widgets + @return A Tcl list of all possible content methods @see content::item::content_methods_by_type } { - + template::util::get_opts $args set types [db_list cmbt_get_content_mime_types ""] @@ -509,14 +509,14 @@ if { $need_text } { lappend methods [list "Text Entry" text_entry] - } + } lappend methods [list "XML Import" xml_import] } else { set methods [list no_content file_upload] if { $need_text } { lappend methods text_entry - } + } lappend methods xml_import } @@ -528,16 +528,16 @@ ad_proc -public -deprecated item::get_mime_info { revision_id {datasource_ref mime_info} } { @public get_mime_info - + Creates a onerow datasource in the calling frame which holds the mime_type and file_extension of the specified revision. If the revision does not exist, does not create the datasource. - + @param revision_id The revision id @param datasource_ref {default mime_info} The name of the - datasource to be created. The datasource will have two columns, + datasource to be created. The datasource will have two columns, mime_type and file_extension. - + return 1 (one) if the revision exists, 0 (zero) otherwise. @see proc content::item::get @@ -550,22 +550,22 @@ ad_proc -public -deprecated item::get_extended_url { item_id args } { Retrieves the relative URL of the item with a file extension based - on the item's mime_type (Example: "/foo/bar/baz.html"). - + on the item's mime_type (Example: "/foo/bar/baz.html"). + @param item_id The item id - + @option template_extension Signifies that the file extension should be retrieved using the mime_type of the template assigned to the item, not from the item itself. The live revision of the template is used. If there is no template which could be used to render the item, or if the template has no live revision, the extension defaults to ".html" - + @option revision_id {default the live revision} Specifies the revision_id which will be used to retrieve the item's mime_type. - This option is ignored if the -template_extension + This option is ignored if the -template_extension option is specified. - + @return The relative URL of the item with the appropriate file extension or an empty string on failure @see proc item::get_url @@ -595,11 +595,11 @@ set template_id [get_template_id $item_id] if { ![template::util::is_nil template_id] } { - # Get extension from the template mime type + # Get extension from the template mime type set template_revision_id [::content::item::get_best_revision -item_id $template_id] if { ![template::util::is_nil template_revision_id] } { - get_mime_info $template_revision_id mime_info + get_mime_info $template_revision_id mime_info if { [info exists mime_info(file_extension)] } { set file_extension $mime_info(file_extension) @@ -623,16 +623,16 @@ set revision_id $opts(revision_id) } - get_mime_info $revision_id mime_info + get_mime_info $revision_id mime_info if { [info exists mime_info(file_extension)] } { set file_extension $mime_info(file_extension) - } else { + } else { set file_extension "html" } } append file_url ".$file_extension" - + return $file_url } @@ -691,22 +691,22 @@ ####################################################### # -# all the following procs are deprecated and do not have +# all the following procs are deprecated and do not have # direct sql calls. # ####################################################### ad_proc -public -deprecated item::get_title { item_id } { @public get_title - + Get the title for the item. If a live revision for the item exists, use the live revision. Otherwise, use the latest revision. - + @param item_id The item id - + @return The title of the item - + @see item::get_best_revision @see content::item::get_title @@ -717,22 +717,22 @@ ad_proc -public -deprecated item::get_publish_status { item_id } { @public get_publish_status - + Get the publish status of the item. The publish status will be one of - the following: + the following:

- + @param item_id The item id - + @return The publish status of the item, or the empty string on failure - + @see proc item::is_publishable } { @@ -749,26 +749,26 @@ (according to min_n and max_n)
  • The workflow (if any) for the item is finished
  • - + @param item_id The item id @see content::item::is_publishable - + @return 1 if the item is publishable, 0 otherwise } { return [string equal [::content::item::is_publishable -item_id $item_id] "t"] -} +} ad_proc -public -deprecated item::get_content_type { item_id } { @public get_content_type - + Retrieves the content type of the item. If the item does not exist, returns an empty string. - + @param item_id The item id - + @return The content type of the item, or an empty string if no such item exists @@ -781,13 +781,13 @@ ad_proc -public -deprecated item::get_item_from_revision { revision_id } { @public get_item_from_revision - + Gets the item_id of the item to which the revision belongs. - + @param revision_id The revision id - + @return The item_id of the item to which this revision belongs - @see content::item::get_live_revision + @see content::item::get_live_revision @see content::revision::item_id } { @@ -797,13 +797,13 @@ ad_proc -public -deprecated item::get_id { url {root_folder ""}} { @public get_id - + Looks up the URL and gets the item id at that URL, if any. - + @param url The URL @param root_folder {default The Sitemap} The ID of the root folder to use for resolving the URL - + @return The item ID of the item at that URL, or the empty string on failure @see proc item::get_url @@ -827,19 +827,19 @@ ad_proc -public -deprecated item::get_template_id { item_id {context public} } { @public get_template_id - + Retrieves the template which can be used to render the item. If there is a template registered directly to the item, returns the id of that template. Otherwise, returns the id of the default template registered to the item's content_type. Returns an empty string on failure. - + @param item_id The item id - @param context {default 'public'} The context in which the template + @param context {default 'public'} The context in which the template will be used. - + @return The template_id of the template which can be used to render the item, or an empty string on failure - + @see proc item::get_template_url @see content::item::get_template @@ -850,18 +850,18 @@ ad_proc -public -deprecated item::get_template_url { item_id {context public} } { @public get_template_url - + Retrieves the relative URL of the template which can be used to render the item. The URL is relative to the TemplateRoot as it is specified in the ini file. - + @param item_id The item id - @param context {default 'public'} The context in which + @param context {default 'public'} The context in which the template will be used. - + @return The template_id of the template which can be used to render the item, or an empty string on failure - + @see proc item::get_template_id @see content::item::get_path @@ -882,10 +882,10 @@ } { @public get_url - + Retrieves the relative URL stub to the item. The URL is relative to the - page root, and has no extension (Example: "/foo/bar/baz"). - + page root, and has no extension (Example: "/foo/bar/baz"). + @param item_id The item id @param root_folder_id Starts path resolution from this folder. Defaults to the root of the sitemap (when null). @@ -901,24 +901,24 @@ } else { return [::content::item::get_virtual_path -item_id $item_id -root_folder_id $root_folder_id] } - + } ad_proc -public -deprecated item::get_best_revision { item_id } { @public get_best_revision - + Attempts to retrieve the live revision for the item. If no live revision exists, attempts to retrieve the latest revision. If the item has no revisions, returns an empty string. - + @param item_id The item id - + @return The best revision id for the item, or an empty string if no revisions exist - @see content::item::get_live_revision - @see content::item::get_latest_revision - @see content::item::get_best_revision + @see content::item::get_live_revision + @see content::item::get_latest_revision + @see content::item::get_best_revision } { return [::content::item::get_best_revision -item_id $item_id] } @@ -927,38 +927,38 @@ Retrieves the latest revision for the item. If the item has no live revision, returns an empty string. - + @param item_id The item id - + @return The latest revision id for the item, or an empty string if no revisions exist - @see content::item::get_live_revision - @see content::item::get_latest_revision - @see content::item::get_best_revision + @see content::item::get_live_revision + @see content::item::get_latest_revision + @see content::item::get_best_revision } { return [::content::item::get_latest_revision -item_id $item_id] } ad_proc -public -deprecated item::get_live_revision { item_id } { @public get_live_revision - + Retrieves the live revision for the item. If the item has no live revision, returns an empty string. - + @param item_id The item id - + @return The live revision id for the item, or an empty string if no live revision exists - @see item::get_best_revision + @see item::get_best_revision @see content::revision::item_id @see content::item::get_live_revision } { return [::content::item::get_live_revision -item_id $item_id] } - + ad_proc -public -deprecated item::get_type { item_id } { Returns the content type of the specified item, or empty string if the item_id is invalid @@ -1146,7 +1146,7 @@ This function returns a hard-coded name for the root level. One should use for path generation for items the appropriate API, such as e.g. content::item::get_virtual_path - @see content::item::get_virtual_path + @see content::item::get_virtual_path } { variable item_id