Index: openacs-4/packages/cms/www/modules/categories/create-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/categories/create-oracle.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/categories/create-oracle.xql 19 Sep 2002 13:09:13 -0000 1.3 +++ openacs-4/packages/cms/www/modules/categories/create-oracle.xql 12 Apr 2005 21:45:42 -0000 1.4 @@ -10,8 +10,8 @@ heading => :heading, description => :description, keyword_id => :keyword_id, - creation_user => :user_id, - creation_ip => :ip$pid); end; + creation_user => null, + creation_ip => null); end; Index: openacs-4/packages/cms/www/modules/categories/create-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/categories/create-postgresql.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/categories/create-postgresql.xql 19 Sep 2002 13:09:13 -0000 1.3 +++ openacs-4/packages/cms/www/modules/categories/create-postgresql.xql 12 Apr 2005 21:45:42 -0000 1.4 @@ -12,8 +12,8 @@ :pid, :keyword_id, now(), - :user_id, - :ip, + null, + null, 'content_keyword'); Index: openacs-4/packages/cms/www/modules/categories/create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/categories/create.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/cms/www/modules/categories/create.tcl 19 Sep 2002 13:09:13 -0000 1.5 +++ openacs-4/packages/cms/www/modules/categories/create.tcl 12 Apr 2005 21:45:42 -0000 1.6 @@ -25,8 +25,6 @@ if { [form is_valid add_keyword] } { form get_values add_keyword keyword_id heading parent_id description - set user_id [User::getID] - set ip [ns_conn peeraddr] db_transaction { @@ -36,16 +34,12 @@ set pid "" } - set keyword_id [db_exec_plsql new_keyword " - begin :1 := content_keyword.new( - heading => :heading, - description => :description, - keyword_id => :keyword_id, - creation_user => :user_id, - creation_ip => :ip$pid); end;"] + set keyword_id [db_exec_plsql new_keyword {}] + } - template::forward "refresh-tree?id=_all_&goto_id=$parent_id&mount_point=$mount_point" + set id $parent_id + ad_returnredirect [export_vars -base index?mount_point=$mount_point { id }] } Index: openacs-4/packages/cms/www/modules/categories/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/categories/delete.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/cms/www/modules/categories/delete.tcl 30 Sep 2003 12:10:05 -0000 1.5 +++ openacs-4/packages/cms/www/modules/categories/delete.tcl 12 Apr 2005 21:45:42 -0000 1.6 @@ -11,10 +11,7 @@ # If nonempty, show error if { [string equal $is_empty "f"] } { - set message "This category contains subcategories and cannot be deleted." - set return_url "modules/categories/index" - set passthrough [list [list id $id] [list parent_id $parent_id]] - template::forward "../../error?message=$message&return_url=$return_url&passthrough=$passthrough" + ad_complain "This category contains subcategories and cannot be deleted." } else { @@ -29,6 +26,6 @@ clipboard::set_cookie $clip clipboard::free $clip - template::forward "refresh-tree?id=_all_&goto_id=$parent_id&mount_point=$mount_point" + ad_returnredirect "index?id=$parent_id&mount_point=$mount_point" } Index: openacs-4/packages/cms/www/modules/categories/edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/categories/edit.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/categories/edit.tcl 16 Aug 2002 00:25:33 -0000 1.3 +++ openacs-4/packages/cms/www/modules/categories/edit.tcl 12 Apr 2005 21:45:42 -0000 1.4 @@ -26,15 +26,11 @@ form get_values edit_keyword keyword_id heading description db_transaction { - db_exec_plsql edit_keyword { - begin - content_keyword.set_heading(:keyword_id, :heading); - content_keyword.set_description(:keyword_id, :description); - end; - } + db_exec_plsql edit_keyword {} } - template::forward "refresh-tree?id=$keyword_id&goto_id=$parent_id&mount_point=$mount_point" + set id $keyword_id + ad_returnredirect [export_vars -base index { id parent_id mount_point }] } Index: openacs-4/packages/cms/www/modules/categories/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/categories/index.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/categories/index.adp 22 May 2003 14:27:12 -0000 1.3 +++ openacs-4/packages/cms/www/modules/categories/index.adp 12 Apr 2005 21:45:42 -0000 1.4 @@ -1,126 +1,30 @@ -Subject Categories +@page_title@ - - - +

- - - - -
- - Subject @what@ - @info.heading@ - - Subject Keywords - -  @info.path;noquote@
-
+ -

@info.heading@

+@page_title;noquote@ -

@info.description@

+

- +    +@info.description@ +No description - - - - - +

-

-
Subject Keywords 
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
     Heading   Assigned Items
- - - - - - - - - - -     - @items.heading@   @items.item_count@
-
- + + back to @parent_heading@ - - No subcategories - -
-


+

- + - - Edit this @what@
- - - - Delete this @what@
-
- -
- - - - Create a new keyword - -within this category.
- - - - Move - -marked keywords into this category.
- -

-

-

-  - Index: openacs-4/packages/cms/www/modules/categories/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/categories/index.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/cms/www/modules/categories/index.tcl 16 Aug 2002 00:25:33 -0000 1.4 +++ openacs-4/packages/cms/www/modules/categories/index.tcl 12 Apr 2005 21:45:42 -0000 1.5 @@ -1,55 +1,99 @@ -# Index page for keywords +ad_page_contract { + Index page for keywords -request create -params { - id -datatype keyword -optional - mount_point -datatype keyword -optional -value categories - parent_id -datatype keyword -optional + @author Michael Steigman + @creation-date April 2005 +} { + { id:integer,optional ""} + { mount_point "categories" } + { parent_id:integer,optional ""} + { orderby "title,asc" } + { page:optional } } set original_id $id -set img_checked "[ad_conn package_url]resources/checked.gif" - -# Create all the neccessary URL params for passthrough -set passthrough "mount_point=$mount_point&parent_id=$parent_id" - set root_id [cm::modules::${mount_point}::getRootFolderID] if { [util::is_nil id] || [string equal $id _all_] } { - set where_clause "k.parent_id is null" + set where_clause "k.parent_id is null" } else { - set where_clause "k.parent_id = :id" + set where_clause "k.parent_id = :id" } # Get self - if { ![util::is_nil id] && ![string equal $id _all_] } { db_1row get_info "" -column_array info } else { - set info(is_leaf) "f" - set info(heading) "" - set info(description) "You can create content categories here -in order to classify content items." - set info(path) "/" + set info(is_leaf) "f" + set info(heading) "Root" + set info(description) "You can create content categories here in order to classify content items." } +# Get the parent id if it is missing +if { [util::is_nil parent_id] && ![util::is_nil id] } { + db_0or1row get_parent_info {} +# set parent_url "index?id=$parent_id&mount_point=categories" +} +# else { +# if {$parent_id == $root_id} { +# set parent_url "" +# } +# } + +set actions " +\"Create new keyword\" create?mount_point=categories&parent_id=$id \"Create new keyword within this category\" +\"Move marked keywords\" move?mount_point=categories&target_id=$id \"Move marked keywords into this category\" +" + if { [string equal $info(is_leaf) t] } { + append actions " +\"Edit keyword\" [export_vars -base edit?mount_point=categories {id parent_id}] \"Edit keyword\" +\"Delete keyword\" [export_vars -base delete?mount_point=categories {id parent_id}] \"Delete keyword\" +" set what "keyword" } else { + append actions " +\"Edit category\" [export_vars -base edit?mount_point=categories {id parent_id}] \"Edit category\" +" set what "category" } +set page_title "$info(heading) $what" set clip [clipboard::parse_cookie] -# Get children -db_multirow items get_items "" +template::list::create \ + -name items \ + -multirow items \ + -has_checkboxes \ + -actions $actions \ + -no_data "No subcategories" \ + -key item_id \ + -elements { + copy { + label "Clipboard" + display_template "

@items.copy;noquote@
" + } + heading { + label "Name" + link_html { title "View this item"} + link_url_col keyword_url + } + type { + label "Type" + } + item_count { + label "Assigned Items" + } + } -# Get the parent id if it is missing -if { [util::is_nil parent_id] && ![util::is_nil id] } { - set parent_id [db_string get_parent_id ""] +# Get children +db_multirow -extend { copy keyword_url type } items get_items {} { + if { [string match $is_leaf t] } { + set type Keyword + } else { + set type Category + } + set id $keyword_id + set keyword_url [export_vars -base index?mount_point=categories { id parent_id }] + set copy [clipboard::render_bookmark categories $keyword_id [ad_conn package_url]] } - - - - - - Index: openacs-4/packages/cms/www/modules/categories/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/categories/index.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/categories/index.xql 8 Jun 2001 01:44:53 -0000 1.2 +++ openacs-4/packages/cms/www/modules/categories/index.xql 12 Apr 2005 21:45:42 -0000 1.3 @@ -1,15 +1,13 @@ - + - select - context_id - from - acs_objects - where - object_id = :id + select o.context_id as parent_id, k.heading as parent_heading + from acs_objects o, cr_keywords k + where object_id = :id + and o.object_id = k.keyword_id Index: openacs-4/packages/cms/www/modules/categories/move.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/categories/move.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/categories/move.tcl 24 May 2001 01:30:52 -0000 1.2 +++ openacs-4/packages/cms/www/modules/categories/move.tcl 12 Apr 2005 21:45:42 -0000 1.3 @@ -21,27 +21,21 @@ clipboard::map_code $clip $mount_point { if { [catch { - db_dml move_keyword_item " - update cr_items set parent_id = $update_value - where item_id = $item_id - and exists ( - select 1 from cr_keywords where keyword_id = item_id - )" - - db_dml move_keyword_keyword " - update cr_keywords set parent_id = $update_value - where keyword_id = $item_id" + db_dml move_keyword_item {} + db_dml move_keyword_keyword {} + db_dml update_context_id {} } errmsg] } { } } } clipboard::free $clip -# Specify a null id so that the entire branch will be refreshed -template::forward "refresh-tree?goto_id=$target_id&mount_point=$mount_point" +set id $target_id +ad_returnredirect [export_vars -base index {id mount_point}] + Index: openacs-4/packages/cms/www/modules/categories/move.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/categories/move.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/categories/move.xql 25 May 2001 02:56:11 -0000 1.1 +++ openacs-4/packages/cms/www/modules/categories/move.xql 12 Apr 2005 21:45:42 -0000 1.2 @@ -21,5 +21,14 @@ + + + + + update acs_objects set context_id = $update_value + where object_id = $item_id + + +