Index: openacs-4/packages/xowiki/xowiki.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v
diff -u -r1.11 -r1.12
--- openacs-4/packages/xowiki/xowiki.info 22 Feb 2006 12:35:53 -0000 1.11
+++ openacs-4/packages/xowiki/xowiki.info 13 Apr 2006 19:19:36 -0000 1.12
@@ -10,17 +10,17 @@
Gustaf Neumann
- A more generic xotcl-based wikis example with object types
+ A more generic xotcl-based wikis example with object types
and subtypes based on the content repository (with category support)
2006-02-22
- XoWiki is a wiki implementation for OpenACS in xotcl. Instead of trying to
-implement the full set of wiki markup commands of systems like MediaWiki,
-XoWiki is based on a rich text editor and focuses more on integration
-with oacs (e.g categories, general comments, adp-includes). XoWiki
-combines aspects of wikis (ease of page-creation) with aspects of a
-content management system (revisions, re-usable items, multiple
-languages). Furthermore, XoWiki allows to define different types of links such
-one could define book-structures (where a navigation structure could be built on the fly) or glossaries with differnt kind of word relationships (like synonyms, etc.). XoWiki supports pages in multiple languages and is localized (currently only for English and German). Currently, richtext and plaintext type entries are supported. Included support for adp-substitution in wiki pages and a file-selector. 0.13 supports page templates and uses the new generic form interface. Use of the oo layer for the content repository, reduced number of database interactions.0.18 supports text/enhanced, nice page names, import/export. Support for search (::xowiki::Page and ::xowiki::PlainPage); 0.20 support ::xowiki::Object, directory object, rss generation into syndication table, improved admin pages; 0.21: ajax-ased chat added, new attributes creator and page_title for all xowiki::Pages; 0.22 improved permission checking
+ XoWiki is a wiki implementation for OpenACS in xotcl. Instead of trying to
+implement the full set of wiki markup commands of systems like MediaWiki,
+XoWiki is based on a rich text editor and focuses more on integration
+with oacs (e.g categories, general comments, adp-includes). XoWiki
+combines aspects of wikis (ease of page-creation) with aspects of a
+content management system (revisions, re-usable items, multiple
+languages). Furthermore, XoWiki allows to define different types of links such
+one could define book-structures (where a navigation structure could be built on the fly) or glossaries with differnt kind of word relationships (like synonyms, etc.). XoWiki supports pages in multiple languages and is localized (currently only for English and German). Currently, richtext and plaintext type entries are supported. Included support for adp-substitution in wiki pages and a file-selector. 0.13 supports page templates and uses the new generic form interface. Use of the oo layer for the content repository, reduced number of database interactions.0.18 supports text/enhanced, nice page names, import/export. Support for search (::xowiki::Page and ::xowiki::PlainPage); 0.20 support ::xowiki::Object, directory object, rss generation into syndication table, improved admin pages; 0.21: ajax-ased chat added, new attributes creator and page_title for all xowiki::Pages; 0.22 improved permission checking
0
@@ -31,12 +31,12 @@
+
-
-
+
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.24 -r1.25
--- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 31 Mar 2006 19:36:45 -0000 1.24
+++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 13 Apr 2006 19:19:36 -0000 1.25
@@ -86,15 +86,28 @@
# -edit_form ::xowiki::PageInstanceEditForm
-if {![db_0or1row check-xowiki-table \
+if {![db_0or1row check-xowiki-references-table \
"select tablename from pg_tables where tablename = 'xowiki_references'"]} {
- db_dml create-xowiki-table "create table xowiki_references(
+ db_dml create-xowiki-references-table "create table xowiki_references(
reference integer references cr_items(item_id) on delete cascade,
link_type text,
page integer references cr_items(item_id) on delete cascade)"
- db_dml create-xowiki-table \
+ db_dml create-xowiki-references-index \
"create index xowiki_ref_index ON xowiki_references(reference)"
}
+if {![db_0or1row check-xowiki-last-visited-table \
+ "select tablename from pg_tables where tablename = 'xowiki_last_visited'"]} {
+ db_dml create-xowiki-last-visited-table "create table xowiki_last_visited(
+ page_id integer references cr_items(item_id) on delete cascade,
+ package_id integer,
+ user_id integer,
+ count integer,
+ time timestamp)"
+ db_dml create-xowiki-last-visited-update-index \
+ "create unique index xowiki_last_visited_index_unique ON xowiki_last_visited(user_id, page_id)"
+ db_dml create-xowiki-last-visited-index \
+ "create index xowiki_last_visited_index ON xowiki_last_visited(user_id, package_id)"
+}
namespace eval ::xowiki {
@@ -204,7 +217,7 @@
{options {editor xinha plugins {
GetHtml CharacterMap ContextMenu FullScreen
ListType TableOperations EditTag LangMarks Abbreviation OacsFs
- } height 350px \$::xowiki::folderspec}}
+ } height 350px}}
{html {rows 15 cols 50 style {width: 100%}}}}
}
{f.description
@@ -217,17 +230,29 @@
{{title {\[::xowiki::validate_title\]} {Item with this name exists already}}}}
{with_categories true}
{submit_link "view"}
+ {folderspec ""}
}
- WikiForm instproc folderspec {value} {
- set ::xowiki::folderspec $value
- }
WikiForm instproc mkFields {} {
- set fields ""
- foreach field [my field_list] {
- append fields [list [my set f.$field]] \n
+ set __fields ""
+ foreach __field [my field_list] {
+ set __spec [my set f.$__field]
+ if {[string first "richtext" [lindex $__spec 0]] > -1
+ && [my folderspec] ne ""} {
+ # we have a richtext widget. append the folder spec to its options
+ set __newspec [list [lindex $__spec 0]]
+ foreach __e [lrange $__spec 1 end] {
+ foreach {__name __value} $__e break
+ if {$__name eq "options"} {eval lappend __value [my folderspec]}
+ lappend __newspec $__name $__value
+ }
+ my log "--F rewritten spec is '$__newspec'"
+ set __spec $__newspec
+ }
+ #my log "--F field <$__field> = $__spec"
+ append __fields [list $__spec] \n
}
- my set fields $fields
+ my set fields $__fields
}
proc ::xowiki::locales {} {
@@ -283,9 +308,12 @@
my instvar data
if {![my istype PageInstanceForm]} {
### danger: update references does an ad_eval, which breaks the [template::adp_level]
- ### ad_form! don't do it here.
+ ### ad_form! don't do it in pageinstanceforms.
$data render_adp false
$data render -update_references
+ } else {
+ # for the subsequent pretty_link; in the other branch, render sets it up already
+ Page set url_prefix [site_node::get_url_from_object_id -object_id [ad_conn package_id]]
}
my set submit_link [::xowiki::Page pretty_link [$data set title]]?
}
@@ -850,6 +878,24 @@
return [expr {$render_adp ? [my adp_subst $content] : $content}]
}
+
+ Page instproc record_last_visited {-user_id} {
+ my instvar parent_id item_id
+ if {![info exists user_id]} {set user_id [ad_conn user_id]}
+ if {$user_id > 0} {
+ # only record information for authenticated users
+ set package_id [$parent_id set package_id]
+ db_dml update_last_visisted \
+ "update xowiki_last_visited set time = current_timestamp, count = count + 1 \
+ where page_id = $item_id and user_id = $user_id"
+ if {[db_resultrows] < 1} {
+ db_dml insert_last_visisted \
+ "insert into xowiki_last_visited (page_id, package_id, user_id, count, time) \
+ values ($item_id, $package_id, $user_id, 1, current_timestamp)"
+ }
+ }
+ }
+
#
# Plain Page methods
#
@@ -872,7 +918,7 @@
}
#
- # Page Instance methods
+ # PageInstance methods
#
PageInstance instproc get_field_type {name template default_spec} {
Index: openacs-4/packages/xowiki/www/edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/edit.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/xowiki/www/edit.tcl 27 Feb 2006 12:37:30 -0000 1.10
+++ openacs-4/packages/xowiki/www/edit.tcl 13 Apr 2006 19:19:37 -0000 1.11
@@ -46,23 +46,17 @@
}
#
-# setting up file selector fs
+# setting up folder id for file selector (use community folder if available)
#
set fs_folder_id ""
if {[info commands dotlrn_fs::get_community_shared_folder] ne ""} {
set fs_folder_id [dotlrn_fs::get_community_shared_folder \
-community_id [dotlrn_community::get_community_id]]
}
-if {$fs_folder_id ne ""} {
- set folderspec "folder_id $fs_folder_id"
-} else {
- set folderspec ""
-}
-set form_class [$object_type getFormClass]
-$form_class create ::xowiki::f1 -volatile \
+[$object_type getFormClass] create ::xowiki::f1 -volatile \
-data $page \
- -folderspec $folderspec
+ -folderspec [expr {$fs_folder_id ne "" ? "folder_id $fs_folder_id" : ""}]
#ns_log notice "-- form f1 has class [::xowiki::f1 info class]"
::xowiki::f1 generate
Index: openacs-4/packages/xowiki/www/view.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view.tcl,v
diff -u -r1.14 -r1.15
--- openacs-4/packages/xowiki/www/view.tcl 11 Apr 2006 09:37:58 -0000 1.14
+++ openacs-4/packages/xowiki/www/view.tcl 13 Apr 2006 19:19:37 -0000 1.15
@@ -29,6 +29,10 @@
::xowiki::Page require_folder_object -folder_id $folder_id -package_id [ad_conn package_id]
set content [$page render]
+
+if {[ad_parameter "user_tracking" -package_id [ad_conn package_id]] } {
+ $page record_last_visited
+}
set references [$page references]
set header_stuff [::xowiki::Page header_stuff]
Index: openacs-4/packages/xowiki/www/portlets/last-visited.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/last-visited.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xowiki/www/portlets/last-visited.adp 13 Apr 2006 19:19:37 -0000 1.1
@@ -0,0 +1,6 @@
+
+
+@content;noquote@
+
Index: openacs-4/packages/xowiki/www/portlets/last-visited.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/last-visited.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xowiki/www/portlets/last-visited.tcl 13 Apr 2006 19:19:37 -0000 1.1
@@ -0,0 +1,39 @@
+# $Id: last-visited.tcl,v 1.1 2006/04/13 19:19:37 gustafn Exp $
+# display last visited entries
+# -gustaf neumann
+#
+# valid parameters from the include are
+# max_entries: show given number of new entries
+
+::xowiki::Page requireCSS "/resources/acs-templating/lists.css"
+
+if {![info exists max_entries]} {set max_entries 20}
+if {![info exists user_id]} {set user_id [ad_conn user_id]}
+if {![info exists package_id]} {set package_id [ad_conn package_id]}
+
+# get the folder id from the including page
+set folder_id [$__including_page set parent_id]
+
+TableWidget t1 -volatile \
+ -columns {
+ AnchorField title -label [_ xowiki.page_title]
+ }
+
+set content ""
+db_foreach get_pages \
+ "select p.page_title,r.title, to_char(x.time,'YYYY-MM-DD HH24:MI:SS') as visited_date \
+ from xowiki_last_visited x, xowiki_page p, cr_items i, cr_revisions r \
+ where x.page_id = i.item_id and i.live_revision = p.page_id and \
+ r.revision_id = p.page_id and x.user_id = $user_id and x.package_id = $package_id
+ order by x.time desc limit $max_entries
+ " {
+ns_log notice "-- GOT $page_title"
+ if {$page_title eq ""} {set page_title $title}
+
+ t1 add \
+ -title $page_title \
+ -title.href [::xowiki::Page pretty_link $title]
+ }
+
+set content [t1 asHTML]
+set link ""
Index: openacs-4/packages/xowiki/www/portlets/most-popular.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/most-popular.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xowiki/www/portlets/most-popular.adp 13 Apr 2006 19:19:37 -0000 1.1
@@ -0,0 +1,6 @@
+
+
+@content;noquote@
+
Index: openacs-4/packages/xowiki/www/portlets/most-popular.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/most-popular.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xowiki/www/portlets/most-popular.tcl 13 Apr 2006 19:19:37 -0000 1.1
@@ -0,0 +1,39 @@
+# $Id: most-popular.tcl,v 1.1 2006/04/13 19:19:37 gustafn Exp $
+# display last visited entries
+# -gustaf neumann
+#
+# valid parameters from the include are
+# max_entries: show given number of new entries
+
+::xowiki::Page requireCSS "/resources/acs-templating/lists.css"
+
+if {![info exists max_entries]} {set max_entries 20}
+if {![info exists package_id]} {set package_id [ad_conn package_id]}
+
+# get the folder id from the including page
+set folder_id [$__including_page set parent_id]
+
+TableWidget t1 -volatile \
+ -columns {
+ AnchorField title -label [_ xowiki.page_title]
+ Field count -label Count -html { align right }
+ }
+
+set content ""
+db_foreach get_pages \
+ "select sum(x.count), x.page_id, p.page_title,r.title \
+ from xowiki_last_visited x, xowiki_page p, cr_items i, cr_revisions r \
+ where x.page_id = i.item_id and i.live_revision = p.page_id and r.revision_id = p.page_id \
+ and x.package_id = $package_id group by x.page_id, p.page_title, r.title \
+ order by sum desc limit $max_entries \
+ " {
+ if {$page_title eq ""} {set page_title $title}
+
+ t1 add \
+ -title $page_title \
+ -title.href [::xowiki::Page pretty_link $title] \
+ -count $sum
+ }
+
+set content [t1 asHTML]
+set link ""