Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/wiki/lib/fix.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/wiki/lib/new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wiki/lib/new.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/wiki/lib/new.tcl 22 Feb 2005 16:15:13 -0000 1.3 +++ openacs-4/packages/wiki/lib/new.tcl 4 Oct 2005 15:14:42 -0000 1.3.2.1 @@ -26,10 +26,9 @@ } -edit_request { # content::item::get -item_id $item_id - db_1row get_item "select cr_items.item_id, title, content from cr_items, cr_revisions where name=:name and parent_id=:folder_id and latest_revision=revision_id" + db_0or1row get_item "select cr_items.item_id, title, content from cr_items, cr_revisions where name=:name and parent_id=:folder_id and latest_revision=revision_id" } -new_data { - content::item::new \ -name $name \ -parent_id $folder_id \ @@ -42,31 +41,54 @@ -storage_type "text" \ -mime_type "text/x-openacs-wiki" + # see if any references exist that go to this page + db_foreach get_refs "select cr.rel_id from cr_item_rels cr, cr_items ci where ci.item_id=cr.object_id and ci.parent_id=:folder_id and cr.related_object_id is null and cr.relation_tag = 'wiki_reference__' || $name" { + db_dml update_rel "update cr_item_rels set related_object_id=:item_id where rel_id=:rel_id" + } } -edit_data { - content::revision::new \ -item_id $item_id \ -title $title \ -content $content \ - -description $revision_notes + -description $revision_notes \ + -is_live "t" - db_dml set_live "update cr_items set live_revision=latest_revision where item_id=:item_id" - } -after_submit { # do something clever with internal refs set stream [Wikit::Format::TextToStream $content] set refs [Wikit::Format::StreamToRefs $stream "wiki::get_info"] - if {![llength $refs]} { - set refs [list ""] - } - db_foreach get_ids "select ci.item_id as ref_item_id from cr_items ci left join cr_item_rels cr on (cr.related_object_id=:item_id) where ci.parent_id=:folder_id and ci.name in ([template::util:::tcl_to_sql_list $refs]) and cr.rel_id is null" { - content::item::relate \ - -item_id $item_id \ - -object_id $ref_item_id \ - -relation_tag "wiki_reference" - } + if {[llength $refs]} { + + array set existing_refs [list] + # get references that have cr_items already + db_foreach get_ids "select cr.rel_id,ci.item_id as ref_item_id, ci.name as ref_name from cr_items ci left join cr_item_rels cr on (cr.related_object_id=:item_id) where ci.parent_id=:folder_id and ci.name in ([template::util:::tcl_to_sql_list $refs])" { + set existing_refs($ref_name) $ref_item_id + } + foreach ref $refs { + # if there isn't an existing reference to a cr_item, create a + # new one and create the cr_item_rel + # leave the content blank until someone edits the page + if {![string equal "" $ref] && ![info exists existing_refs($ref)]} { + # no page exists for this link yet, create a placeholder + set existing_refs($ref) [content::item::new \ + -name $ref \ + -parent_id $folder_id \ + -creation_user $user_id \ + -creation_ip $ip_address \ + -is_live "t" \ + -storage_type "text" \ + -mime_type "text/x-openacs-wiki"] + + content::item::relate \ + -item_id $item_id \ + -object_id $existing_refs($ref) \ + -relation_tag "wiki_reference" + } + + } + } ad_returnredirect "./$name" } Index: openacs-4/packages/wiki/lib/page.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wiki/lib/page.adp,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/wiki/lib/page.adp 22 Feb 2005 16:15:13 -0000 1.3 +++ openacs-4/packages/wiki/lib/page.adp 4 Oct 2005 15:14:42 -0000 1.3.2.1 @@ -3,13 +3,22 @@ @header_stuff@ @context@ @focus@ - -@content;noquote@ + -

Pages that link to his page: + + +

+
+ +@content;noquote@ + + + Index: openacs-4/packages/wiki/lib/page.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wiki/lib/page.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/wiki/lib/page.tcl 22 Feb 2005 16:15:13 -0000 1.3 +++ openacs-4/packages/wiki/lib/page.tcl 4 Oct 2005 15:14:42 -0000 1.3.2.1 @@ -51,10 +51,25 @@ } -db_1row get_content "select content,title from cr_revisions, cr_items where revision_id=live_revision and cr_items.item_id=:item_id" +if {![db_0or1row get_content "select content,title from cr_revisions, cr_items where revision_id=live_revision and cr_items.item_id=:item_id"]} { + set form [rp_getform] + ns_log debug " +DB -------------------------------------------------------------------------------- +DB DAVE debugging /var/lib/aolserver/openacs-5-head-cr-tcl-api/packages/wiki/lib/page.tcl +DB -------------------------------------------------------------------------------- +DB form = '${form}' +DB [ns_set find $form "item_id"] +DB --------------------------------------------------------------------------------" + if {[ns_set find $form "item_id"] < 0} { + rp_form_put item_id $item_id + rp_form_put name $name + } + rp_internal_redirect "/packages/wiki/lib/new" +} set stream [Wikit::Format::TextToStream $content] set refs [Wikit::Format::StreamToRefs $stream "wiki::get_info"] + db_multirow related_items get_related_items "select cr.name, cr.title, cr.description from cr_revisionsx cr, cr_items ci, cr_item_rels cir where cir.related_object_id=:item_id and cir.relation_tag='wiki_reference' and ci.live_revision=cr.revision_id and ci.item_id=cir.item_id" set content [ad_wiki_text_to_html $content "wiki::get_info"] Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/wiki/www/resources/wiki.css'. Fisheye: No comparison available. Pass `N' to diff?