Index: openacs-4/packages/cms/www/modules/templates/template.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/template.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/templates/template.tcl 19 Aug 2002 04:19:45 -0000 1.3 +++ openacs-4/packages/cms/www/modules/templates/template.tcl 20 Aug 2002 04:18:00 -0000 1.4 @@ -55,26 +55,7 @@ # find out which items this template is registered to -template::query get_items items multirow " - select - content_item.get_title(item_id) title, item_id, use_context - from - cr_item_template_map - where - template_id = :template_id - order by - use_context" +db_multirow items get_items "" - # find out which types this template is registered to -template::query get_types types multirow " - select - pretty_name, content_type, use_context - from - acs_object_types types, cr_type_template_map map - where - map.template_id = :template_id - and - types.object_type = map.content_type - order by - types.pretty_name" +db_multirow types get_types "" Index: openacs-4/packages/cms/www/modules/templates/upload.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/upload.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/templates/upload.tcl 8 Jun 2001 01:44:53 -0000 1.2 +++ openacs-4/packages/cms/www/modules/templates/upload.tcl 20 Aug 2002 04:18:00 -0000 1.3 @@ -4,8 +4,7 @@ if { ! [request is_valid] } { return } -template::query get_path path onevalue " - select content_item.get_path(:template_id) from dual" +set path [db_string get_path ""] form create edit_template -html { enctype multipart/form-data } Index: openacs-4/packages/cms/www/modules/types/content-method.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/content-method.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/cms/www/modules/types/content-method.tcl 8 Jun 2001 01:44:53 -0000 1.4 +++ openacs-4/packages/cms/www/modules/types/content-method.tcl 20 Aug 2002 04:18:00 -0000 1.5 @@ -13,32 +13,12 @@ # fetch the content methods registered to this content type -template::query get_methods content_methods multirow " - select - m.content_method, label, is_default, description - from - cm_content_type_method_map map, cm_content_methods m - where - m.content_method = map.content_method - and - map.content_type = :content_type - order by - is_default desc, label -" +db_multirow content_methods get_methods "" # text_entry content method filter # don't show text entry if a text mime type is not registered to the item -template::query check_status has_text_mime_type onevalue " - select - count( mime_type ) - from - cr_content_mime_type_map - where - mime_type like ('%text/%') - and - content_type = :content_type -" +set has_text_mime_type [db_string check_status ""] if { $has_text_mime_type == 0 } { set text_entry_filter_sql "and content_method != 'text_entry'" @@ -48,24 +28,7 @@ # fetch the content methods not register to this content type -template::query get_unregistered_methods unregistered_content_methods multilist " - select - label, m.content_method - from - cm_content_methods m - where - not exists ( - select 1 - from - cm_content_type_method_map - where - content_method = m.content_method - and - content_type = :content_type ) - $text_entry_filter_sql - order by - label -" +set unregistered_content_methods [db_list_of_lists get_unregistered_methods ""] set unregistered_method_count [llength $unregistered_content_methods] Index: openacs-4/packages/cms/www/modules/types/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/index.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/types/index.tcl 25 May 2001 02:15:56 -0000 1.2 +++ openacs-4/packages/cms/www/modules/types/index.tcl 20 Aug 2002 04:18:00 -0000 1.3 @@ -17,100 +17,30 @@ set user_id [User::getID] set root_id [cm::modules::templates::getRootFolderID] -template::query get_module_id module_id onevalue " - select module_id from cm_modules where key = 'types' -" +set module_id [db_string get_module_id ""] content::check_access $module_id cm_examine -user_id $user_id set can_edit_widgets $user_permissions(cm_write) # get the content type pretty name -template::query get_object_type object_type_pretty onevalue " - select - pretty_name - from - acs_object_types - where - object_type = :content_type -" +set object_type_pretty [db_string get_object_type ""] - if { [string equal $object_type_pretty ""] } { # error - invalid content_type template::forward index } # get all the content types that this content type inherits from -template::query get_content_type content_type_tree multirow " - select - decode (supertype, 'acs_object', '', supertype) as parent_type, - decode (object_type, 'content_revision', '', object_type) as object_type, - pretty_name - from - acs_object_types - where - object_type ^= 'acs_object' - connect by - object_type = prior supertype - start with - object_type = :content_type - order by - rownum desc -" +db_multirow content_type_tree get_content_type "" # get all the attribute properties for this object_type -template::query get_attr_types attribute_types multirow " - select - attr.attribute_id, attr.attribute_name, attr.object_type, - attr.pretty_name as attribute_name_pretty, - datatype, types.pretty_name as pretty_name, - nvl(description_key,' ') as description_key, - description, widget - from - acs_attributes attr, acs_attribute_descriptions d, - cm_attribute_widgets w, - ( select - object_type, pretty_name - from - acs_object_types - where - object_type ^= 'acs_object' - connect by - prior supertype = object_type - start with - object_type = :content_type - ) types - where - attr.object_type = types.object_type - and - attr.attribute_id = w.attribute_id(+) - and - attr.attribute_name = d.attribute_name(+) - order by - types.object_type, sort_order, attr.attribute_name -" +db_multirow attribute_types get_attr_types "" # get template information -template::query get_type_templates type_templates multirow " - select - template_id, ttmap.content_type, use_context, is_default, name, - content_item.get_path( - template_id,:root_id) as path, - (select pretty_name - from acs_object_types - where object_type = :content_type) pretty_name - from - cr_type_template_map ttmap, cr_items i - where - i.item_id = ttmap.template_id - and - ttmap.content_type = :content_type - order by - upper(name) -" +db_multirow types_templates get_type_templates "" set page_title "Content Type - $object_type_pretty" Index: openacs-4/packages/cms/www/modules/types/mime-types.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/mime-types.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/types/mime-types.tcl 24 May 2001 23:57:17 -0000 1.2 +++ openacs-4/packages/cms/www/modules/types/mime-types.tcl 20 Aug 2002 04:18:00 -0000 1.3 @@ -5,38 +5,14 @@ request create request set_param content_type -datatype keyword -value 'content_revision' -template::query get_module_id module_id onevalue " - select module_id from cm_modules where key = 'types' -" +set module_id [db_string get_module_id ""] # permissions check - must have cm_examine content::check_access $module_id cm_examine -user_id [User::getID] -template::query get_name content_type_name onevalue " - select - pretty_name - from - acs_object_types - where - object_type = :content_type -" +set type_name [db_string get_name ""] -template::query get_unreg_mime_types unregistered_mime_types multilist " - select - label, mime_type - from - cr_mime_types - where - not exists ( select 1 - from - cr_content_mime_type_map - where - mime_type = cr_mime_types.mime_type - and - content_type = :content_type ) - order by - label -" +set unregistered_mime_types [db_list_of_lists get_unreg_mime_types ""] set unregistered_mime_types_count [llength $unregistered_mime_types] @@ -46,18 +22,7 @@ template::forward "index?id=content_revision" } -template::query get_reg_mime_types registered_mime_types multirow " - select - label, m.mime_type - from - cr_mime_types m, cr_content_mime_type_map map - where - m.mime_type = map.mime_type - and - map.content_type = :content_type - order by - label -" +db_multirow registered_mime_types get_reg_mime_types "" set page_title "Register MIME types to $content_type_name" Index: openacs-4/packages/cms/www/modules/types/register-templates.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/register-templates.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/types/register-templates.tcl 8 Jun 2001 01:44:53 -0000 1.3 +++ openacs-4/packages/cms/www/modules/types/register-templates.tcl 20 Aug 2002 04:18:00 -0000 1.4 @@ -6,13 +6,7 @@ # get the content type pretty name -template::query get_pretty_type object_type_pretty onevalue " - select - pretty_name - from - acs_object_types - where - object_type = :content_type" +set object_type_pretty [db_string get_pretty_type "" -default ""] set invalid_content_type_p f if { [string equal $object_type_pretty ""] } { @@ -47,27 +41,8 @@ # make sure we only get content templates (not folders, symlinks, # etc.) that aren't already registered to this content type -template::query get_content_templates only_marked_templates multilist " - select - template_id, - content_item.get_path( template_id, content_template.get_root_folder ) - as name - from - cr_templates t, cr_items i - where - t.template_id = i.item_id - and not exists ( - select 1 - from - cr_type_template_map - where - template_id = t.template_id - and - content_type = :content_type ) - and - $marked_templates_sql" +set only_marked_templates [db_list_of_lists get_content_templates ""] - set template_count [llength $only_marked_templates] element create register_templates template_count \ @@ -79,10 +54,7 @@ if { $template_count > 0 } { # for the context pick list(s) - template::query get_use_contexts cr_use_contexts multilist " - select use_context, use_context - from cr_template_use_contexts - order by 1" + set cr_use_contexts [db_list_of_lists get_use_contexts ""] } Index: openacs-4/packages/cms/www/modules/types/relation-register.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/relation-register.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/types/relation-register.tcl 26 May 2001 19:45:03 -0000 1.3 +++ openacs-4/packages/cms/www/modules/types/relation-register.tcl 20 Aug 2002 04:18:00 -0000 1.4 @@ -3,9 +3,7 @@ request set_param content_type -datatype keyword -value content_revision -template::query get_module_id module_id onevalue " - select module_id from cm_modules where key = 'types' -" +set module_id [db_string get_module_id ""] # permissions check - must have cm_write on the types module content::check_access $module_id cm_write -user_id [User::getID] @@ -27,25 +25,9 @@ template::forward index?id=$content_type } -template::query get_pretty_name pretty_name onevalue " - select - pretty_name - from - acs_object_types - where - object_type = :content_type -" +set pretty_name [db_string get_pretty_name ""] -template::query get_target_types target_types multilist " - select - lpad(' ', level, '-') || pretty_name, object_type - from - acs_object_types - connect by - prior object_type = supertype - start with - object_type = 'content_revision' -" +set target_types [db_list_of_lists get_target_types ""] element create relation target_type \ -datatype keyword \ Index: openacs-4/packages/cms/www/modules/types/relation-unregister.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/relation-unregister.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/types/relation-unregister.tcl 26 May 2001 19:45:03 -0000 1.3 +++ openacs-4/packages/cms/www/modules/types/relation-unregister.tcl 20 Aug 2002 04:18:00 -0000 1.4 @@ -8,9 +8,7 @@ request set_param target_type -datatype keyword request set_param relation_tag -datatype text -value "" -template::query get_module_id module_id onevalue " - select module_id from cm_modules where key = 'types' -" +set module_id [db_string get_module_id ""] # permissions check - must have cm_write on the types module content::check_access $module_id cm_write -user_id [User::getID] Index: openacs-4/packages/cms/www/modules/types/relations.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/relations.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/types/relations.tcl 24 May 2001 23:57:17 -0000 1.2 +++ openacs-4/packages/cms/www/modules/types/relations.tcl 20 Aug 2002 04:18:00 -0000 1.3 @@ -5,37 +5,11 @@ request create request set_param type -datatype integer -value content_revision -template::query get_module_id module_id onevalue " - select module_id from cm_modules where key = 'types' -" +set module_id [db_string get_module_id ""] # permission check - must have cm_examine on types module content::check_access $module_id cm_examine -user_id [User::getID] +db_multirow rel_types get_rel_types "" -template::query get_rel_types rel_types multirow " - select - pretty_name, target_type, relation_tag, min_n, max_n - from - cr_type_relations r, acs_object_types o - where - o.object_type = r.target_type - and - r.content_type = :type - order by - pretty_name, relation_tag -" - - -template::query get_child_types child_types multirow " - select - pretty_name, child_type, relation_tag, min_n, max_n - from - cr_type_children c, acs_object_types o - where - c.child_type = o.object_type - and - c.parent_type = :type - order by - pretty_name, relation_tag -" +db_multirow child_types get_child_types "" Index: openacs-4/packages/cms/www/modules/types/unregister-mime-type.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/unregister-mime-type.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/types/unregister-mime-type.tcl 24 May 2001 23:57:17 -0000 1.2 +++ openacs-4/packages/cms/www/modules/types/unregister-mime-type.tcl 20 Aug 2002 04:18:00 -0000 1.3 @@ -9,9 +9,7 @@ db_transaction { - template::query get_module_id module_id onevalue " - select module_id from cm_modules where key = 'types' -" + set module_id [db_string get_module_id ""] # permissions check - must have cm_write to unregister mime type content::check_access $module_id cm_write -user_id [User::getID] Index: openacs-4/packages/cms/www/modules/types/widget-register-1.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/widget-register-1.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/types/widget-register-1.tcl 27 May 2001 04:39:19 -0000 1.3 +++ openacs-4/packages/cms/www/modules/types/widget-register-1.tcl 20 Aug 2002 04:18:00 -0000 1.4 @@ -13,15 +13,9 @@ } +set form_widgets [db_list_of_lists get_form_widgets ""] -template::query get_form_widgets form_widgets multilist " - select - widget, widget - from - cm_form_widgets -" - element create widget_register widget \ -datatype keyword \ -widget select \ @@ -41,32 +35,10 @@ if { [form is_request widget_register] } { + db_1row get_attr_info "" - template::query get_attr_info attribute_info onerow " - select - a.pretty_name as attribute_name_pretty, - t.pretty_name as content_type_pretty, - t.object_type as content_type, - a.attribute_name - from - acs_attributes a, acs_object_types t - where - a.object_type = t.object_type - and - a.attribute_id = :attribute_id - " + db_1row get_reg_widget "" - template::query get_reg_widget register_widget onerow " - select - widget as registered_widget, is_required - from - cm_attribute_widgets - where - attribute_id = :attribute_id - " - - - template::util::array_to_vars attribute_info element set_properties widget_register content_type_pretty \ -value $content_type_pretty element set_properties widget_register attribute_name_pretty \ @@ -76,7 +48,6 @@ element set_properties widget_register content_type \ -value $content_type - template::util::array_to_vars register_widget if { ![template::util::is_nil registered_widget] } { element set_properties widget_register widget \ -values $registered_widget @@ -96,19 +67,11 @@ db_transaction { - template::query check_registered already_registered onevalue " - select 1 - from - cm_attribute_widgets - where - attribute_id = :attribute_id - and - widget = :widget - " + set already_registered [db_string registered "" -default ""] # just update the is_required column if this widget is already registered # this way we don't overwrite the existing attribute widget params - if { ![template::util::is_nil already_registered] && \ + if { ![string equal $already_registered ""] && \ $already_registered } { db_dml update_widgets " update cm_attribute_widgets Index: openacs-4/packages/cms/www/modules/types/widget-register-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/widget-register-2.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/types/widget-register-2.tcl 27 May 2001 04:39:19 -0000 1.3 +++ openacs-4/packages/cms/www/modules/types/widget-register-2.tcl 20 Aug 2002 04:18:00 -0000 1.4 @@ -15,22 +15,7 @@ } - -template::query get_attr_info attribute_info onerow " - select - a.pretty_name as attribute_name_pretty, - a.attribute_name, - t.pretty_name as content_type_pretty, - a.object_type as content_type - from - acs_attributes a, acs_object_types t - where - a.object_type = t.object_type - and - a.attribute_id = :attribute_id -" - -template::util::array_to_vars attribute_info +db_1row get_attr_info "" element set_properties widget_register content_type_pretty \ -value $content_type_pretty element set_properties widget_register attribute_name_pretty \ @@ -44,28 +29,7 @@ # get a list of params for this widget -template::query get_params widget_params multilist " - select - f.param_id, param, - decode(f.is_required,'t','t',w.is_required) is_required, is_html, - nvl(w.value,f.default_value) default_value, - nvl(w.param_source,'literal') param_source - from - cm_form_widget_params f, - ( select - is_required, param_id, param_source, value - from - cm_attribute_widget_params awp, cm_attribute_widgets aw - where - awp.attribute_id = :attribute_id - and - awp.attribute_id = aw.attribute_id - ) w - where - widget = :widget - and - f.param_id = w.param_id (+) -" +set widget_params [db_list_of_lists get_params ""] # create form sections and elements for each widget param