Index: openacs-4/packages/xotcl-core/xotcl-core.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/xotcl-core.info,v diff -u -r1.13 -r1.14 --- openacs-4/packages/xotcl-core/xotcl-core.info 15 Apr 2006 23:25:29 -0000 1.13 +++ openacs-4/packages/xotcl-core/xotcl-core.info 20 Jun 2006 22:56:52 -0000 1.14 @@ -8,10 +8,10 @@ t xotcl - + Gustaf Neumann XOTcl library functionality (e.g. thread handling, online documentation, Generic Form and List Classes) - 2006-04-16 + 2006-05-03 This component contains some core functionality for OACS applications using XOTcl. It includes XOTcl thread handling for OACS (supporting persistent and @@ -22,10 +22,10 @@ and ad_instproc. This component provides as well an XOTcl Object and Class browser, as well as means to control the recreation of objects and classes -when components are reloaded. 0.23 contains a major overhaul of the Generic classes. Object preliminary object layer for content repository, oo templating. 0.36 brings caching support for cr-items +when components are reloaded. 0.23 contains a major overhaul of the Generic classes. Object preliminary object layer for content repository, oo templating. 0.36 brings caching support for cr-items. 0.38: important change: uses cr_items.name instead of cr_revision.title to label content items. This effects as well the api (lookup uses -name instead of -title). 0 - + Index: openacs-4/packages/xotcl-core/catalog/xotcl-core.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/catalog/xotcl-core.de_DE.ISO-8859-1.xml,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xotcl-core/catalog/xotcl-core.de_DE.ISO-8859-1.xml 30 Mar 2006 00:35:18 -0000 1.3 +++ openacs-4/packages/xotcl-core/catalog/xotcl-core.de_DE.ISO-8859-1.xml 20 Jun 2006 22:56:53 -0000 1.4 @@ -1,5 +1,5 @@ - + Neu: %type% Neue Seite vom Type %type% erzeugen Index: openacs-4/packages/xotcl-core/catalog/xotcl-core.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/catalog/xotcl-core.en_US.ISO-8859-1.xml,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xotcl-core/catalog/xotcl-core.en_US.ISO-8859-1.xml 30 Mar 2006 00:35:19 -0000 1.3 +++ openacs-4/packages/xotcl-core/catalog/xotcl-core.en_US.ISO-8859-1.xml 20 Jun 2006 22:56:53 -0000 1.4 @@ -1,9 +1,11 @@ - + Add %type% Add new item of type %type% + Create New %type% Edit Item + Edit %type% has entered the room Live Revision Revisions of Entry Index: openacs-4/packages/xotcl-core/lib/revisions-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/lib/revisions-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/xotcl-core/lib/revisions-postgresql.xql 14 Dec 2005 15:57:53 -0000 1.1 +++ openacs-4/packages/xotcl-core/lib/revisions-postgresql.xql 20 Jun 2006 22:56:53 -0000 1.2 @@ -5,7 +5,7 @@ - select n.title, n.revision_id as version_id, + select ci.name, n.revision_id as version_id, person__name(n.creation_user) as author, n.creation_user as author_id, to_char(n.last_modified,'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, Index: openacs-4/packages/xotcl-core/lib/revisions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/lib/revisions.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/xotcl-core/lib/revisions.tcl 30 Dec 2005 00:04:44 -0000 1.4 +++ openacs-4/packages/xotcl-core/lib/revisions.tcl 20 Jun 2006 22:56:53 -0000 1.5 @@ -6,9 +6,9 @@ @cvs-id $Id$ } { page_id:integer,notnull - {title ""} + {name ""} } -properties { - title:onevalue + name:onevalue context:onevalue page_id:onevalue revisions:multirow @@ -27,7 +27,7 @@ -multirow revisions \ -elements { version_number {label "" html {align right}} - title { label "" + name { label "" display_template { view -1} {set __atts [lreplace $__atts $__p $__p]} + eval my instvar $__atts set creation_user [expr {[ad_conn isconnected] ? [ad_conn user_id] : ""}] db_transaction { set revision_id [db_nextval acs_object_id_seq] - - db_dml revision_add " - insert into [[my info class] set table_name]i ([join $__atts ,]) + db_dml revision_add "insert into [[my info class] set table_name]i ([join $__atts ,]) \ values (:[join $__atts ,:])" - db_exec_plsql make_live { select content_item__set_live_revision(:revision_id) } @@ -541,18 +536,22 @@ my instvar parent_id item_id set __atts [list item_id revision_id creation_user] - foreach __var [$__class edit_atts] { + foreach __var [$__class edit_atts] { my instvar $__var lappend __atts $__var if {![info exists $__var]} {set $__var ""} } set creation_user [expr {[ad_conn isconnected] ? [ad_conn user_id] : ""}] + # "name" is not part of the *i rule, ignore it for now + set __p [lsearch $__atts name] + if {$__p > -1} {set __atts [lreplace $__atts $__p $__p]} + db_transaction { $__class instvar storage_type object_type $__class folder_type -folder_id $parent_id register set item_id [db_exec_plsql note_insert " - select content_item__new(:title,$parent_id,null,null,null,:creation_user,null,null, + select content_item__new(:name,$parent_id,null,null,null,:creation_user,null,null, 'content_item',:object_type,:title, :description,:mime_type, :nls_language,:text,:storage_type)"] @@ -666,10 +665,10 @@ set folder_id [$data set parent_id] if {![my exists add_page_title]} { - my set add_page_title "New [$class pretty_name]" + my set add_page_title [_ xotcl-core.create_new_type [list type [$class pretty_name]]] } if {![my exists edit_page_title]} { - my set edit_page_title "Edit [$class pretty_name]" + my set edit_page_title [_ xotcl-core.edit_type [list type [$class pretty_name]]] } # check, if the specified fields are available from the data source @@ -707,19 +706,34 @@ $data set $__var [my var $__var] } $data initialize_loaded_object - $data save + db_transaction { + $data save + set old_name [ns_set get [ns_getform] __object_name] + set new_name [$data set name] + if {$old_name ne $new_name} { + db_dml update_name "update cr_items set name = :new_name \ + where item_id = [$data set item_id]" + } + } return [$data set item_id] } - Form instproc request {privelege} { + Form instproc request {privilege} { my instvar edit_form_page_title context auth::require_login - permission::require_permission -object_id [ad_conn package_id] -privilege $privelege - set edit_form_page_title [my add_page_title] + permission::require_permission -object_id [ad_conn package_id] -privilege $privilege + set edit_form_page_title [expr {$privilege eq "create" ? + [my add_page_title] : [my edit_page_title]}] set context [list $edit_form_page_title] } Form instproc new_request {} { my log "--- new_request ---" my request create + my instvar data + foreach var [[$data info class] edit_atts] { + if {[$data exists $var]} { + my var $var [list [$data set $var]] + } + } } Form instproc edit_request {item_id} { my instvar data @@ -749,22 +763,28 @@ Form ad_instproc generate { {-template "formTemplate"} + {-export} } { the method generate is used to actually generate the form template from the specifications and to set up page_title and context when appropriate. @template is the name of the tcl variable to contain the filled in template + @export list of attribue value pairs to be exported to the form (nested list) } { # set form name for adp file my set $template [my name] my instvar data folder_id set object_type [[$data info class] object_type] + set object_name [expr {[$data exists name] ? [$data set name] : ""}] #my log "-- $data, cl=[$data info class] [[$data info class] object_type]" - - my log "--e final fields [my fields]" - ad_form -name [my name] -form [my fields] \ - -export [list [list object_type $object_type] [list folder_id $folder_id]] + my log "--e final fields [my fields]" + set exports [list [list object_type $object_type] \ + [list folder_id $folder_id] \ + [list __object_name $object_name]] + if {[info exists export]} {foreach pair $export {lappend exports $pair}} + ad_form -name [my name] -form [my fields] -export $exports + set new_data "set item_id \[[self] new_data\]" set edit_data "set item_id \[[self] edit_data\]" set new_request "[self] new_request" @@ -784,11 +804,11 @@ #ns_log notice "-- new data category::map_object -remove_old -object_id $item_id $category_ids" db_dml insert_asc_named_object \ "insert into acs_named_objects (object_id,object_name,package_id) \ - values (:item_id, :title, :package_id)" + values (:item_id, :name, :package_id)" } append edit_data { db_dml update_asc_named_object \ - "update acs_named_objects set object_name = :title, \ + "update acs_named_objects set object_name = :name, \ package_id = :package_id where object_id = :item_id" #ns_log notice "-- edit data category::map_object -remove_old -object_id $item_id $category_ids" category::map_object -remove_old -object_id $item_id $category_ids Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/xotcl-core/tcl/thread_mod-procs.tcl'. Fisheye: No comparison available. Pass `N' to diff?