Index: openacs-4/packages/xowiki/tcl/xowiki-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-procs.tcl,v diff -u -r1.55 -r1.56 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 8 Nov 2006 09:17:19 -0000 1.55 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 14 Nov 2006 12:25:23 -0000 1.56 @@ -154,9 +154,7 @@ # # Operations on the whole instance # - Class create Folder - Page ad_proc select_query { {-select_attributes ""} {-order_clause ""} @@ -259,6 +257,7 @@ set limit_clause [expr {[info exists maxentries] ? " limit $maxentries" : ""}] set timerange_clause [expr {[info exists days] ? " and p.last_modified > (now() + interval '$days days ago')" : ""}] + set xmlMap { & & < < > > \" " ' ' } set content [my rss_head \ @@ -301,7 +300,104 @@ set t text/xml ns_return 200 $t $content } + + Page ad_proc sitemapindex { + {-changefreq "daily"} + {-priority "priority"} + } { + Provide a sitemap index of all xowiki instances in google site map format + https://www.google.com/webmasters/sitemaps/docs/en/protocol.html + + @param maxentries maximum number of entries retrieved + @param package_id to determine the xowiki instance + @param changefreq changefreq as defined by google + @param priority priority as defined by google + + } { + + set content { + +} + db_foreach get_xowiki_packages {select package_id + from apm_packages p, site_nodes s + where package_key = 'xowiki' and s.object_id = p.package_id} { + my log "--package_id = $package_id" + set last_modified [db_string get_newest_modification_date \ + "select last_modified from acs_objects where package_id = $package_id \ + order by last_modified desc limit 1"] + + regexp {^([^.]+)[.][0-9]+(.*)$} $last_modified _ time tz + set time "[clock format [clock scan $time] -format {%Y-%m-%dT%T}]${tz}:00" + + my log "--site_node::get_from_object_id -object_id $package_id" + array set info [site_node::get_from_object_id -object_id $package_id] + + append content \n\ + [ad_url]$info(url)?gsm \n\ + $time \n\ + + } + append content \n + set t text/plain + #set t text/xml + ns_return 200 $t $content + } + + Page ad_proc gsm { + -maxentries + -package_id:required + {-changefreq "daily"} + {-priority "priority"} + } { + Report content of xowiki folder in google site map format + https://www.google.com/webmasters/sitemaps/docs/en/protocol.html + + @param maxentries maximum number of entries retrieved + @param package_id to determine the xowiki instance + @param changefreq changefreq as defined by google + @param priority priority as defined by google + + } { + set folder_id [::$package_id folder_id] + + set limit_clause [expr {[info exists maxentries] ? " limit $maxentries" : ""}] + set timerange_clause "" + set xmlMap { & & < < > > \" " ' ' } + + set content { + +} + db_foreach get_pages \ + "select s.body, p.name, p.creator, p.title, p.page_id,\ + p.object_type as content_type, p.last_modified, p.description \ + from xowiki_pagex p, syndication s, cr_items i \ + where i.parent_id = $folder_id and i.live_revision = s.object_id \ + and s.object_id = p.page_id $timerange_clause \ + order by p.last_modified desc $limit_clause \ + " { + + if {[string match "::*" $name]} continue + if {$content_type eq "::xowiki::PageTemplate::"} continue + + regexp {^([^.]+)[.][0-9]+(.*)$} $last_modified _ time tz + + set time "[clock format [clock scan $time] -format {%Y-%m-%dT%T}]${tz}:00" + append content \n\ + [::$package_id pretty_link -absolute true $name] \n\ + $time \n\ + $changefreq \n\ + $priority \n\ + \n + } + + append content \n + set t text/plain + #set t text/xml + ns_return 200 $t $content + } + + Page proc import {-user_id -package_id -folder_id {-replace 0} -objects} { set object_type [self] if {![info exists folder_id]} {set folder_id [$object_type require_folder -name xowiki]}