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.5 -r1.6 --- openacs-4/packages/wiki/lib/new.tcl 27 Sep 2005 12:46:10 -0000 1.5 +++ openacs-4/packages/wiki/lib/new.tcl 25 Oct 2005 14:58:04 -0000 1.6 @@ -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,55 @@ -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 \ + -mime_type "text/x-openacs-wiki" \ + -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.5 -r1.6 --- openacs-4/packages/wiki/lib/page.adp 27 Sep 2005 12:46:10 -0000 1.5 +++ openacs-4/packages/wiki/lib/page.adp 25 Oct 2005 14:58:04 -0000 1.6 @@ -3,13 +3,23 @@ @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.5 -r1.6 --- openacs-4/packages/wiki/lib/page.tcl 27 Sep 2005 12:46:10 -0000 1.5 +++ openacs-4/packages/wiki/lib/page.tcl 25 Oct 2005 14:58:04 -0000 1.6 @@ -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"] Index: openacs-4/packages/wiki/tcl/wikit-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wiki/tcl/wikit-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/wiki/tcl/wikit-procs.tcl 27 Sep 2005 12:46:10 -0000 1.3 +++ openacs-4/packages/wiki/tcl/wikit-procs.tcl 25 Oct 2005 14:59:36 -0000 1.4 @@ -111,15 +111,6 @@ foreach line [split $text \n] { # Per line, classify the it and extract the main textual information. foreach {tag depth txt aux} [linetype $line] break ; # lassign -ns_log debug " -DB -------------------------------------------------------------------------------- -DB DAVE debugging /var/lib/aolserver/openacs-5-2/packages/wiki/tcl/wikit-procs.tcl -DB -------------------------------------------------------------------------------- -DB tag = '${tag}' -DB depth = '${depth}' -DB txt = '${txt}' -DB aux = '${aux}' -DB --------------------------------------------------------------------------------" # Classification tags # # UL, OL, DL = Lists (unordered/bullet, ordered/enum, @@ -526,10 +517,10 @@ x { # support embedded images if present in "images" view set iseq "" - if {[regexp {\.(gif|jpg|png)$} $text - ifmt]} { + if {[regexp -nocase {\.(gif|jpg|png)$} $text - ifmt]} { set iseq [mk::select wdb.images url $text -count 1] if {$iseq != "" && [info commands eim_$iseq] == ""} { - if {$ifmt == "jpg"} { set ifmt jpeg } + if {[string equal -nocase $ifmt "jpg"]} { set ifmt jpeg } catch { package require tkimg::$ifmt } catch { image create photo eim_$iseq -format $ifmt \ @@ -702,7 +693,7 @@ [quote $text] $html_frag(_a) } x { - if {[regexp {\.(gif|jpg|png)$} $text]} { + if {[regexp -nocase {\.(gif|jpg|png)$} $text]} { append result $html_frag(i_) $text $html_frag(tc) } else { append result \ @@ -736,6 +727,9 @@ regsub -all {<} $q {\<} q regsub -all {>} $q {\>} q regsub -all {&(#\d+;)} $q {\&\1} q + # allow
and
+ regsub -all {\<br\>} $q {
} q + regsub -all {\<br /\>} $q {
} q return $q } @@ -825,6 +819,10 @@ vs D B

vs D C

vs D E

+ vs U A

+ vs U B

+ vs U C

+ vs U E