Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -N -r1.16 -r1.17 --- openacs-4/packages/xowiki/xowiki.info 3 May 2006 12:03:23 -0000 1.16 +++ openacs-4/packages/xowiki/xowiki.info 19 Jun 2006 00:40:03 -0000 1.17 @@ -8,24 +8,24 @@ f xowiki - + Gustaf Neumann A more generic xotcl-based wikis example with object types and subtypes based on the content repository (with category support) - 2006-05-03 + 2006-06-19 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.24 provides link-types, more includeletes (most-recently viewed, most frequently accessed pages). 0.26 provides Weblog support. 0.27: alignment with xotcl-core 0.38 (use cr_item.name instead of cr_revisions.title), change page_title to title (potential incompatibility) to rely more strictly to the CR data model (most files are effected). +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.24 provides link-types, more includeletes (most-recently viewed, most frequently accessed pages). 0.26 provides Weblog support. 0.27: alignment with xotcl-core 0.38 (use cr_item.name instead of cr_revisions.title), change page_title to title (potential incompatibility) to rely more strictly to the CR data model (most files are effected). 0.28: tag and improved weblog support 0 - + Index: openacs-4/packages/xowiki/catalog/xowiki.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/catalog/xowiki.de_DE.ISO-8859-1.xml,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/xowiki/catalog/xowiki.de_DE.ISO-8859-1.xml 23 May 2006 17:58:47 -0000 1.7 +++ openacs-4/packages/xowiki/catalog/xowiki.de_DE.ISO-8859-1.xml 19 Jun 2006 00:40:04 -0000 1.8 @@ -6,14 +6,18 @@ L�schen Kurzbeschreibung Bearbeiten + bearbeiten Index Sprache Name Neue Seite Titel der Seite Typ der Seite + H�ufig verwendete Schlagworte + h�ufige Schlagworte Verweise auf diese Seite: Verlauf Titel Ansehen + Pers�nliche Schlagworte Index: openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 23 May 2006 17:58:47 -0000 1.7 +++ openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 19 Jun 2006 00:40:04 -0000 1.8 @@ -8,14 +8,18 @@ Delete Description Edit + edit Index Language Name New Page Page Title Page Type + Popular tags + popular tags References to this Page: Revisions Title View + Your Tags 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 -N -r1.38 -r1.39 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 7 Jun 2006 17:08:24 -0000 1.38 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 19 Jun 2006 00:40:04 -0000 1.39 @@ -83,6 +83,22 @@ db_dml create-xowiki-last-visited-index \ "create index xowiki_last_visited_index ON xowiki_last_visited(user_id, package_id)" } + + if {![db_0or1row check-tag-table \ + "select tablename from pg_tables where tablename = 'xowiki_tags'"]} { + db_dml create-xowiki-tag-table "create table xowiki_tags( + item_id integer references cr_items(item_id) on delete cascade, + package_id integer, + user_id integer references users(user_id), + tag text, + time timestamp)" + db_dml create-xowiki-tags-index-user \ + "create index xowiki_tags_index_user ON xowiki_tags(user_id, page_id)" + db_dml create-xowiki-tags-index-tag \ + "create index xowiki_tags_index-tag ON xowiki_tags(tag, package_id)" + } + + # # upgrade logic @@ -385,6 +401,37 @@ } } + Page proc save_tags {-package_id:required -item_id:required -user_id:required tags} { + db_dml delete_tags \ + "delete from xowiki_tags where item_id = $item_id and user_id = $user_id" + foreach tag $tags { + db_dml insert_tag \ + "insert into xowiki_tags (item_id,package_id, user_id, tag, time) \ + values ($item_id, $package_id, $user_id, :tag, current_timestamp)" + } + } + Page proc get_tags {-package_id:required -item_id -user_id} { + if {[info exists item_id]} { + if {[info exists user_id]} { + # tags for item and user + set tags [db_list get_tags "SELECT distinct tag from xowiki_tags where user_id=$user_id and item_id=$item_id and package_id=$package_id"] + } else { + # all tags for this item + set tags [db_list get_tags "SELECT distinct tag from xowiki_tags where item_id=$item_id and package_id=$package_id"] + } + } else { + if {[info exists user_id]} { + # all tags for this user + set tags [db_list get_tags "SELECT distinct tag from xowiki_tags where user_id=$user_id and package_id=$package_id"] + } else { + # all tags for the package + set tags [db_list get_tags "SELECT distinct tag from xowiki_tags where package_id=$package_id"] + } + } + join $tags " " + } + + Page instproc initialize_loaded_object {} { my instvar title creator if {[info exists title] && $title eq ""} {set title [my set name]} @@ -554,7 +601,7 @@ object_type {folder_id -100} {lang_links ""} - {lang de} + {lang en} {render_adp 1} } Page set recursion_count 0 Index: openacs-4/packages/xowiki/www/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/delete.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/xowiki/www/delete.tcl 25 Apr 2006 23:05:36 -0000 1.5 +++ openacs-4/packages/xowiki/www/delete.tcl 19 Jun 2006 00:40:04 -0000 1.6 @@ -1,7 +1,7 @@ ad_page_contract { - This deletes a note + This deletes a page - @author Your Name (you@example.com) + @author gustaf neumann @cvs-id $Id$ @param item_id The item_id of the note to delete Index: openacs-4/packages/xowiki/www/oacs-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/oacs-view.adp,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/xowiki/www/oacs-view.adp 10 Jun 2006 09:31:26 -0000 1.1 +++ openacs-4/packages/xowiki/www/oacs-view.adp 19 Jun 2006 00:40:04 -0000 1.2 @@ -12,7 +12,7 @@ #wikicmds {position: relative; top: -24px; right: 0px; height: 0px; text-align: right; font-family: sans-serif; font-size: 85%;color: #7A7A78;} -#portal #wikicmds {top: -80px} +#portal #wikicmds {top: -90px} #wikicmds a, #wikicmds a:visited { color: #7A7A78; text-decoration: none;} #wikicmds a:hover {text-decoration: underline;} #wikicmds a:active {color: rgb(255,153,51);} @@ -68,19 +68,20 @@ #sidebar .sidebox li {font-size: 10px; margin: 0;} img.found {border: 0; height: 12px} img.undefined {border: 10; color: yellow; height: 12px} + #left-col {float: left; width: 40%; top: 0px;} #right-col {float: right; width: 59%; top: 0px;} -#left-col20 {float: left; width: 14%; top: 0px; margin-right: 10px;} -#left-col25 {float: left; width: 24%; top: 0px; margin-right: 10px;} -#left-col30 {float: left; width: 29%; top: 0px; margin-right: 10px;} +#left-col20 {float: left; width: 14%; top: 0px; margin-right: 10px;} +#left-col25 {float: left; width: 24%; top: 0px; margin-right: 10px;} +#left-col30 {float: left; width: 29%; top: 0px; margin-right: 10px;} #left-col70 {float: left; width: 69%; top: 0px;} #left-col75 {float: left; width: 74%; top: 0px;} #left-col80 {float: left; width: 79%; top: 0px;} -#right-col20 {float: right; width: 14%; top: 0px; margin-right: 10px;} -#right-col25 {float: right; width: 24%; top: 0px; margin-right: 10px;} -#right-col30 {float: right; width: 29%; top: 0px; margin-right: 10px;} +#right-col20 {float: right; width: 14%; top: 0px; margin-right: 10px;} +#right-col25 {float: right; width: 24%; top: 0px; margin-right: 10px;} +#right-col30 {float: right; width: 29%; top: 0px; margin-right: 10px;} #right-col70 {float: right; width: 69%; top: 0px;} #right-col75 {float: right; width: 74%; top: 0px;} #right-col80 {float: right; width: 79%; top: 0px;} @@ -102,6 +103,24 @@ a:visited.rss {color: #FFF} a:link.rss {color: #FFF} + @@ -135,7 +154,18 @@

 


#xowiki.references_label# @references;noquote@ -@lang_links;noquote@

+@lang_links;noquote@ +
#xowiki.your_tags_label#: @tags_with_links;noquote@ +(#xowiki.edit_link#, +#xowiki.popular_tags_link#) + + +

#general-comments.Comments#

    @gc_comments;noquote@

Index: openacs-4/packages/xowiki/www/popular_tags.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/popular_tags.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/popular_tags.tcl 19 Jun 2006 00:40:04 -0000 1.1 @@ -0,0 +1,26 @@ +# +# gustaf neumann, fecit june 2006 +ad_page_contract { + load popular tags for a certain page + + @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) + @creation-date June 2006 + @cvs-id $Id: popular_tags.tcl,v 1.1 2006/06/19 00:40:04 gustafn Exp $ + + @param item_id show popular tags for the give item_id +} -query { + item_id + {limit 20} +} +set package_id [ad_conn package_id] +set folder_id [::xowiki::Page require_folder -package_id $package_id -name xowiki] + +set href [site_node::get_url_from_object_id -object_id $package_id]weblog?summary=1 +set entries [list] +db_foreach get_popular_tags \ + "select count(*) as nr,tag from xowiki_tags \ + where item_id=$item_id group by tag order by nr limit $limit" { + lappend entries "$tag ($nr)" +} +ns_return 200 text/html "[_ xowiki.popular_tags_label]: [join $entries {, }]" + Index: openacs-4/packages/xowiki/www/save_tags.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/save_tags.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/save_tags.tcl 19 Jun 2006 00:40:04 -0000 1.1 @@ -0,0 +1,18 @@ +ad_page_contract { + save tags for a page + + @author gustaf neumann + @cvs-id $Id: save_tags.tcl,v 1.1 2006/06/19 00:40:04 gustafn Exp $ + + @param item_id The item_id for which the tags should be saved + @param tags The tags to be saved + @param query The query for redisplay +} -query { + item_id:integer + tags + {query "."} +} +::xowiki::Page save_tags -user_id [ad_conn user_id] -item_id $item_id -package_id [ad_conn package_id] $tags +ns_log notice "--Q query=$query" +ad_returnredirect $query + Index: openacs-4/packages/xowiki/www/view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view.adp,v diff -u -N -r1.19 -r1.20 --- openacs-4/packages/xowiki/www/view.adp 23 May 2006 17:58:47 -0000 1.19 +++ openacs-4/packages/xowiki/www/view.adp 19 Jun 2006 00:40:04 -0000 1.20 @@ -66,19 +66,20 @@ #sidebar .sidebox li {font-size: 10px; margin: 0;} img.found {border: 0; height: 12px} img.undefined {border: 10; color: yellow; height: 12px} + #left-col {float: left; width: 40%; top: 0px;} #right-col {float: right; width: 59%; top: 0px;} -#left-col20 {float: left; width: 14%; top: 0px; margin-right: 10px;} -#left-col25 {float: left; width: 24%; top: 0px; margin-right: 10px;} -#left-col30 {float: left; width: 29%; top: 0px; margin-right: 10px;} +#left-col20 {float: left; width: 14%; top: 0px; margin-right: 10px;} +#left-col25 {float: left; width: 24%; top: 0px; margin-right: 10px;} +#left-col30 {float: left; width: 29%; top: 0px; margin-right: 10px;} #left-col70 {float: left; width: 69%; top: 0px;} #left-col75 {float: left; width: 74%; top: 0px;} #left-col80 {float: left; width: 79%; top: 0px;} -#right-col20 {float: right; width: 14%; top: 0px; margin-right: 10px;} -#right-col25 {float: right; width: 24%; top: 0px; margin-right: 10px;} -#right-col30 {float: right; width: 29%; top: 0px; margin-right: 10px;} +#right-col20 {float: right; width: 14%; top: 0px; margin-right: 10px;} +#right-col25 {float: right; width: 24%; top: 0px; margin-right: 10px;} +#right-col30 {float: right; width: 29%; top: 0px; margin-right: 10px;} #right-col70 {float: right; width: 69%; top: 0px;} #right-col75 {float: right; width: 74%; top: 0px;} #right-col80 {float: right; width: 79%; top: 0px;} @@ -100,6 +101,24 @@ a:visited.rss {color: #FFF} a:link.rss {color: #FFF} + @@ -122,7 +141,18 @@ @content;noquote@

 


#xowiki.references_label# @references;noquote@ -@lang_links;noquote@

+@lang_links;noquote@ +
#xowiki.your_tags_label#: @tags_with_links;noquote@ +(#xowiki.edit_link#, +#xowiki.popular_tags_link#) + + +

#general-comments.Comments#

    @gc_comments;noquote@

Index: openacs-4/packages/xowiki/www/view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view.tcl,v diff -u -N -r1.19 -r1.20 --- openacs-4/packages/xowiki/www/view.tcl 23 May 2006 17:58:47 -0000 1.19 +++ openacs-4/packages/xowiki/www/view.tcl 19 Jun 2006 00:40:04 -0000 1.20 @@ -15,6 +15,7 @@ {folder_id:optional} {object_type:optional} {master 1} + page:optional } set package_id [ad_conn package_id] @@ -23,38 +24,61 @@ set admin_p [permission::permission_p -object_id $package_id -privilege "admin"] ::xowiki::Page set recursion_count 0 -set page [::Generic::CrItem instantiate \ - -item_id $item_id \ - -revision_id $revision_id] +if {![info exists page]} { + set static_page 0 + set page [::Generic::CrItem instantiate \ + -item_id $item_id \ + -revision_id $revision_id] +} else { + set static_page 1 +} if {![info exists folder_id]} {set folder_id [$page set parent_id]} ::xowiki::Page require_folder_object -folder_id $folder_id -package_id $package_id set content [$page render] -if {[ad_parameter "user_tracking" -package_id $package_id] } { - $page record_last_visited +if {!$static_page} { + if {[ad_parameter "user_tracking" -package_id $package_id]} { + $page record_last_visited + } + set references [$page references] +} else { + set references "" } -set references [$page references] -set header_stuff [::xowiki::Page header_stuff] -#ns_log notice "--HEADER-Stuff = <$header_stuff>" +# only activate tags when the user is logged in +set no_tags [expr {[ad_conn user_id] == 0}] +set tags "" +if {!$no_tags} { + ::xowiki::Page requireJS "/resources/xowiki/get-http-object.js" + set entries [list] + set tags [lsort [::xowiki::Page get_tags -user_id [ad_conn user_id] \ + -item_id $item_id -package_id $package_id]] + set href [site_node::get_url_from_object_id -object_id $package_id]weblog?summary=1 + foreach tag $tags {lappend entries "$tag"} + set tags_with_links [join $entries {, }] +} + +set header_stuff [::xowiki::Page header_stuff] if {[$page exists master] && $master == 1} {set master [$page set master]} # export title, text, and lang_links to current scope $page instvar title name text lang_links if {$master} { set context [list $title] + set return_url [::xowiki::Page pretty_link $name] + set base [apm_package_url_from_id $package_id] set rev_link [export_vars -base ${base}revisions {{page_id $item_id} name}] set edit_link [export_vars -base ${base}edit {item_id}] set delete_link [export_vars -base ${base}delete {item_id}] set new_link [export_vars -base ${base}edit {object_type}] set admin_link [export_vars -base ${base}admin/ {}] set index_link [export_vars -base ${base} {}] - - set return_url [::xowiki::Page pretty_link $name] + set save_tag_link [export_vars -base ${base}save_tags {}] + set popular_tags_link [export_vars -base ${base}popular_tags {item_id}] set gc_link [general_comments_create_link $item_id $return_url] set gc_comments [general_comments_get_comments $item_id $return_url] Index: openacs-4/packages/xowiki/www/weblog.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/weblog.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/weblog.tcl 19 Jun 2006 00:40:04 -0000 1.1 @@ -0,0 +1,36 @@ + +set package_id [ad_conn package_id] +set folder_id [::xowiki::Page require_folder -package_id $package_id -name xowiki] +set weblog_page [$folder_id get_payload weblog_page] +if {$weblog_page eq ""} {set weblog_page "en:weblog"} +set item_id [Generic::CrItem lookup -name $weblog_page -parent_id $folder_id] + +if {$item_id == 0} { + set page [::xowiki::Page create new -volatile -noinit \ + -set creator {Gustaf Neumann} \ + -set name $weblog_page \ + -set title {Weblog} \ + -set creation_date {2006-06-18 00:32:30.674009+02} \ + -set creation_user 0 \ + -set item_id 0 \ + -set parent_id $folder_id \ + -set mime_type text/html \ + -set description {} \ + -set text {{

>>content<< +
{{adp portlets/weblog {name Weblog}}} +
>><< +
>>sidebar<< +
{{adp portlets/weblog-mini-calendar}} +
{{adp portlets/categories {count 1 skin plain-include}}} +
{{adp portlets/tags {skin plain-include}}} +
>><< +

} text/html}] + set item_id [$page save_new] +} + +#if {[ns_queryget page] eq ""} {rp_form_put page $page} +if {[ns_queryget item_id] eq ""} {rp_form_put item_id $item_id} +if {[ns_queryget folder_id] eq ""} {rp_form_put folder_id $folder_id} +rp_internal_redirect "/packages/xowiki/www/view" + + Index: openacs-4/packages/xowiki/www/portlets/categories-recent.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/categories-recent.adp,v diff -u -N --- openacs-4/packages/xowiki/www/portlets/categories-recent.adp 14 Feb 2006 12:07:44 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,6 +0,0 @@ -
-@name@ -
-
-@content;noquote@ -
Index: openacs-4/packages/xowiki/www/portlets/categories-recent.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/categories-recent.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/xowiki/www/portlets/categories-recent.tcl 3 May 2006 12:03:23 -0000 1.5 +++ openacs-4/packages/xowiki/www/portlets/categories-recent.tcl 19 Jun 2006 00:40:04 -0000 1.6 @@ -5,6 +5,7 @@ # valid parameters from the include are # tree_name: match pattern, if specified displays only the trees with matching names # max_entries: show given number of new entries +# skin: name of adp-file to render content ::xowiki::Page proc __render_html { -folder_id @@ -57,3 +58,8 @@ ] if {![info exists name]} {set name "Recently Changed Pages by Categories"} set link "" + +if {![info exists skin]} {set skin portlet-skin} +if {![string match /* $skin]} {set skin [file dir $__adp_stub]/$skin} +template::set_file $skin + Index: openacs-4/packages/xowiki/www/portlets/categories.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/categories.adp,v diff -u -N --- openacs-4/packages/xowiki/www/portlets/categories.adp 27 Jan 2006 17:35:00 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,6 +0,0 @@ -
-@name@ -
-
-@content;noquote@ -
Index: openacs-4/packages/xowiki/www/portlets/categories.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/categories.tcl,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/xowiki/www/portlets/categories.tcl 4 May 2006 13:33:43 -0000 1.13 +++ openacs-4/packages/xowiki/www/portlets/categories.tcl 19 Jun 2006 00:40:04 -0000 1.14 @@ -16,6 +16,7 @@ -tree_style -no_tree_name:boolean -count:boolean + {-summary 0} {-open_page ""} } { @@ -55,7 +56,8 @@ db_foreach get_counts \ "select count(*) as nr,category_id from $sql group by category_id" { $category($category_id) set count $nr - $category($category_id) href [ad_conn url]?category_id=$category_id + set s [expr {$summary ? "&summary=$summary" : ""}] + $category($category_id) href [ad_conn url]?category_id=$category_id$s $category($category_id) open_tree } append content [$cattree(0) render -tree_style $tree_style] @@ -81,16 +83,18 @@ set link "" if {![info exists name]} {set name "Categories"} +set summary [ns_queryget summary 0] set content [::xowiki::Page __render_html \ -folder_id [$__including_page set parent_id] \ -tree_name [expr {[info exists tree_name] ? $tree_name : ""}] \ -tree_style [expr {[info exists tree_style] ? $tree_style : 1}] \ -no_tree_name [info exists no_tree_name] \ -count [info exists count] \ + -summary $summary \ -open_page [expr {[info exists open_page] ? $open_page : ""}] \ ] -if {[info exists skin]} { - template::set_file "[file dir $__adp_stub]/$skin" -} +if {![info exists skin]} {set skin portlet-skin} +if {![string match /* $skin]} {set skin [file dir $__adp_stub]/$skin} +template::set_file $skin 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 -N --- openacs-4/packages/xowiki/www/portlets/last-visited.adp 13 Apr 2006 19:19:37 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,6 +0,0 @@ -
-@name@ -
-
-@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 -N -r1.4 -r1.5 --- openacs-4/packages/xowiki/www/portlets/last-visited.tcl 3 May 2006 12:03:23 -0000 1.4 +++ openacs-4/packages/xowiki/www/portlets/last-visited.tcl 19 Jun 2006 00:40:04 -0000 1.5 @@ -5,6 +5,7 @@ # valid parameters from the include are # max_entries: show given number of new entries # user_id +# skin: name of adp-file to render content ::xowiki::Page requireCSS "/resources/acs-templating/lists.css" @@ -45,3 +46,8 @@ [ad_conn isconnected] ? [ad_conn user_id] : 0}] \ ] +if {![info exists skin]} {set skin portlet-skin} +if {![string match /* $skin]} {set skin [file dir $__adp_stub]/$skin} +template::set_file $skin + + 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 -N --- openacs-4/packages/xowiki/www/portlets/most-popular.adp 13 Apr 2006 19:19:37 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,6 +0,0 @@ -
-@name@ -
-
-@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 -N -r1.3 -r1.4 --- openacs-4/packages/xowiki/www/portlets/most-popular.tcl 3 May 2006 12:03:23 -0000 1.3 +++ openacs-4/packages/xowiki/www/portlets/most-popular.tcl 19 Jun 2006 00:40:04 -0000 1.4 @@ -4,6 +4,7 @@ # # valid parameters from the include are # max_entries: show given number of new entries +# skin: name of adp-file to render content ::xowiki::Page requireCSS "/resources/acs-templating/lists.css" @@ -42,3 +43,8 @@ ] if {![info exists name]} {set name "Most Popular Pages"} set link "" + +if {![info exists skin]} {set skin portlet-skin} +if {![string match /* $skin]} {set skin [file dir $__adp_stub]/$skin} +template::set_file $skin + Index: openacs-4/packages/xowiki/www/portlets/recent.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/recent.adp,v diff -u -N --- openacs-4/packages/xowiki/www/portlets/recent.adp 14 Feb 2006 12:07:44 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,6 +0,0 @@ -
-@name@ -
-
-@content;noquote@ -
Index: openacs-4/packages/xowiki/www/portlets/recent.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/recent.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/xowiki/www/portlets/recent.tcl 3 May 2006 12:03:23 -0000 1.4 +++ openacs-4/packages/xowiki/www/portlets/recent.tcl 19 Jun 2006 00:40:04 -0000 1.5 @@ -4,6 +4,7 @@ # # valid parameters from the include are # max_entries: show given number of new entries +# skin: name of adp-file to render content ::xowiki::Page requireCSS "/resources/acs-templating/lists.css" @@ -43,3 +44,7 @@ -max_entries [expr {[info exists max_entries] ? $max_entries : 20}] \ ] +if {![info exists skin]} {set skin portlet-skin} +if {![string match /* $skin]} {set skin [file dir $__adp_stub]/$skin} +template::set_file $skin + Index: openacs-4/packages/xowiki/www/portlets/tags.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/tags.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/portlets/tags.tcl 19 Jun 2006 00:40:04 -0000 1.1 @@ -0,0 +1,58 @@ +# $Id: tags.tcl,v 1.1 2006/06/19 00:40:04 gustafn Exp $ +# display the tags +# -gustaf neumann +# +# valid parameters from the adp include are +# popular: list tags from all users +# skin: name of adp-file to render content + +::xowiki::Page proc __render_html { + -folder_id + -user_id + {-limit 20} + {-summary 0} + {-popular 0} +} { + + # get the folder id from the including page + set package_id [$folder_id set package_id] + + if {$popular} { + set label [_ xowiki.popular_tags_label] + set tag_type ptag + set sql "select count(*) as nr,tag from xowiki_tags where \ + package_id=$package_id group by tag order by tag limit $limit" + } else { + set label [_ xowiki.your_tags_label] + set tag_type tag + set sql "select count(*) as nr,tag from xowiki_tags where \ + user_id=$user_id and package_id=$package_id group by tag order by tag" + } + set content "

$label

" + set entries [list] + db_foreach get_counts $sql { + set s [expr {$summary ? "&summary=$summary" : ""}] + set href [ad_conn url]?$tag_type=[ad_urlencode $tag]$s + lappend entries "$tag ($nr)" + } + append content "[join $entries {, }]
\n" + return $content +} + +set link "" +if {![info exists name]} {set name "Tags"} +if {![info exists limit]} {set limit 20} +set summary [ns_queryget summary 0] +set content [::xowiki::Page __render_html \ + -folder_id [$__including_page set parent_id] \ + -user_id [ad_conn user_id] \ + -summary $summary \ + -limit $limit \ + -popular [info exists popular] \ + ] + +if {![info exists skin]} {set skin portlet-skin} +if {![string match /* $skin]} {set skin [file dir $__adp_stub]/$skin} +template::set_file $skin + + Index: openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl 30 Apr 2006 23:53:35 -0000 1.1 +++ openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl 19 Jun 2006 00:40:04 -0000 1.2 @@ -1,5 +1,5 @@ ::xowiki::Page requireCSS "/resources/calendar/calendar.css" -set folder_id [$__including_page set parent_id] +set folder_id [$__including_page set parent_id] set including_item_id [$__including_page set item_id] if {![exists_and_not_null base_url]} { Index: openacs-4/packages/xowiki/www/portlets/weblog.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/weblog.adp,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/xowiki/www/portlets/weblog.adp 30 Apr 2006 23:53:35 -0000 1.1 +++ openacs-4/packages/xowiki/www/portlets/weblog.adp 19 Jun 2006 00:40:04 -0000 1.2 @@ -4,7 +4,7 @@
-
@filter_msg@
+
@filter_msg;noquote@
@content;noquote@ Index: openacs-4/packages/xowiki/www/portlets/weblog.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/weblog.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/xowiki/www/portlets/weblog.tcl 3 May 2006 12:03:23 -0000 1.2 +++ openacs-4/packages/xowiki/www/portlets/weblog.tcl 19 Jun 2006 00:40:04 -0000 1.3 @@ -22,33 +22,52 @@ -page_size -page_number -date + -tag + -ptag -category_id -filter_msg -nr_items + {-summary:boolean false} } { upvar $filter_msg my_filter_msg ;# pass info back to caller upvar $nr_items my_nr_items ;# pass info back to caller set package_id [$folder_id set package_id] $including_page set render_adp 0 ;# no double substitutions set my_filter_msg "" + set query_parm "" # set up filters + set extra_from_clause "" + set extra_where_clause "" + if {$date ne ""} { set date_clause "and date_trunc('day',p.publish_date) = '$date'" set my_filter_msg "Filtered by date $date" + set query_parm "&date=$date" } else { set date_clause "" } if {$category_id ne ""} { - set cat_clause "and c.object_id = ci.item_id and c.category_id = $category_id" - set extra_from_clause ",category_object_map c" + append extra_where_clause "and c.object_id = ci.item_id and c.category_id = $category_id " + append extra_from_clause ",category_object_map c " set my_filter_msg "Filtered by category [::category::get_name $category_id]" - } else { - set cat_clause "" - set extra_from_clause "" + set query_parm "&category_id=$category_id" } - + if {$tag ne ""} { + set my_filter_msg "Filtered by your tag $tag" + append extra_from_clause ",xowiki_tags tags " + append extra_where_clause "and tags.item_id = ci.item_id and tags.tag = :tag and tags.user_id = [ad_conn user_id]" + set query_parm "&tag=[ad_urlencode $tag]" + } + if {$ptag ne ""} { + set my_filter_msg "Filtered by popular tag $ptag" + append extra_from_clause ",xowiki_tags tags " + append extra_where_clause "and tags.item_id = ci.item_id and tags.tag = :ptag " + set query_parm "&ptag=[ad_urlencode $ptag]" + } + + # define item container set items [::xo::OrderedComposite new -proc render {} { set content "" @@ -65,7 +84,7 @@ -page_number $page_number -page_size $page_size \ -extra_from_clause $extra_from_clause \ -extra_where_clause "and ci.item_id != [$including_page set item_id] $date_clause \ - and ci.content_type not in ('::xowiki::PageTemplate') $cat_clause" ] + and ci.content_type not in ('::xowiki::PageTemplate') $extra_where_clause" ] set my_nr_items [db_string count [eval ::xowiki::Page select_query $query -count true]] @@ -81,17 +100,24 @@ $p set pretty_date $pretty_date #ns_log notice "--Render object=$p, $page_id $name $title" - if {[catch {$p set description [$p render]} errorMsg]} { + if {!$summary && [catch {$p set description [$p render]} errorMsg]} { ns_log notice "--Render Error ($errorMsg) $page_id $name $title" continue } #ns_log notice "--Render DONE $page_id $name $title" $items add $p } + + array set smsg {1 full 0 summary} + set flink "$smsg($summary)" if {$my_filter_msg eq ""} { - set my_filter_msg "Showing [llength [$items children]] of $my_nr_items Postings" + append my_filter_msg "Showing [llength [$items children]] of $my_nr_items Postings " \ + "($flink)" + } else { + append my_filter_msg " (all, $flink)" } + ::xowiki::Page instmixin add ::xowiki::WeblogEntry set content [$items render] ::xowiki::Page instmixin delete ::xowiki::WeblogEntry @@ -111,13 +137,17 @@ if {![info exists page_size]} {set page_size 10} set page_size [ns_queryget page_size $page_size] set page_number [ns_queryget page_number 1] +set summary [ns_queryget summary 0] set content [::xowiki::Page __render_html \ -folder_id [$__including_page set parent_id] \ -including_page $__including_page \ -page_size $page_size \ -page_number $page_number \ + -summary $summary \ -date [ns_queryget date] \ -category_id [ns_queryget category_id] \ + -tag [ns_queryget tag] \ + -ptag [ns_queryget ptag] \ -filter_msg filter_msg \ -nr_items nr_items] Index: openacs-4/packages/xowiki/www/portlets/wiki.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/wiki.adp,v diff -u -N --- openacs-4/packages/xowiki/www/portlets/wiki.adp 14 Dec 2005 16:13:37 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,6 +0,0 @@ -
-@name@ -
-
-@content;noquote@ -
Index: openacs-4/packages/xowiki/www/portlets/wiki.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/wiki.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/xowiki/www/portlets/wiki.tcl 3 May 2006 12:03:23 -0000 1.5 +++ openacs-4/packages/xowiki/www/portlets/wiki.tcl 19 Jun 2006 00:40:04 -0000 1.6 @@ -1,7 +1,12 @@ # $Id$ # display a wiki page included in a different wiki page # -gustaf neumann +# +# valid parameters from the include are +# name: name of the xowiki page to render +# skin: name of adp-file to render content + set folder_id [$__including_page set parent_id] set item_id [::Generic::CrItem lookup -name $name -parent_id $folder_id] set page [::Generic::CrItem instantiate -item_id $item_id] @@ -17,3 +22,8 @@ ::xowiki::Page incr recursion_count -1 #strip language prefix for name regexp {^..:(.*)$} $name _ name + +if {![info exists skin]} {set skin portlet-skin} +if {![string match /* $skin]} {set skin [file dir $__adp_stub]/$skin} +template::set_file $skin +