Index: openacs-4/packages/dotlrn-wikipedia/dotlrn-wikipedia.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-wikipedia/dotlrn-wikipedia.info,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-wikipedia/dotlrn-wikipedia.info 22 Jun 2006 09:09:08 -0000 1.1
@@ -0,0 +1,24 @@
+
+
+
+
+ dotLRN Wikipedia Applet
+ dotLRN Wikipedia Applets
+ f
+ t
+
+
+ OpenACS
+ 2006-05-15
+ OpenACS
+ 0
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/dotlrn-wikipedia/catalog/dotlrn-wikipedia.ca_ES.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-wikipedia/catalog/dotlrn-wikipedia.ca_ES.ISO-8859-1.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-wikipedia/catalog/dotlrn-wikipedia.ca_ES.ISO-8859-1.xml 22 Jun 2006 09:09:08 -0000 1.1
@@ -0,0 +1,10 @@
+
+
+
+ No s'ha trobat
+ Enciclop�dia
+ Terme
+ Cercar
+ Anar a Enciclop�dia
+ Tot el terme
+
Index: openacs-4/packages/dotlrn-wikipedia/catalog/dotlrn-wikipedia.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-wikipedia/catalog/dotlrn-wikipedia.en_US.ISO-8859-1.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-wikipedia/catalog/dotlrn-wikipedia.en_US.ISO-8859-1.xml 22 Jun 2006 09:09:08 -0000 1.1
@@ -0,0 +1,10 @@
+
+
+
+ Not found
+ Encyclopedia
+ Entry
+ Search
+ Goto Encyclop�dia
+ See full entry
+
Index: openacs-4/packages/dotlrn-wikipedia/catalog/dotlrn-wikipedia.es_ES.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-wikipedia/catalog/dotlrn-wikipedia.es_ES.ISO-8859-1.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-wikipedia/catalog/dotlrn-wikipedia.es_ES.ISO-8859-1.xml 22 Jun 2006 09:09:08 -0000 1.1
@@ -0,0 +1,10 @@
+
+
+
+ No encontrado
+ Enciclopedia
+ T�rmino
+ Buscar
+ Ir a Enciclopedia
+ Entrada completa
+
Index: openacs-4/packages/dotlrn-wikipedia/sql/postgresql/dotlrn-wikipedia-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-wikipedia/sql/postgresql/dotlrn-wikipedia-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-wikipedia/sql/postgresql/dotlrn-wikipedia-create.sql 22 Jun 2006 09:09:08 -0000 1.1
@@ -0,0 +1,127 @@
+
+create function inline_0()
+returns integer as '
+begin
+
+ perform acs_sc_impl__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''dotlrn_wikipedia''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''GetPrettyName'',
+ ''dotlrn_wikipedia::get_pretty_name'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''AddApplet'',
+ ''dotlrn_wikipedia::add_applet'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''RemoveApplet'',
+ ''dotlrn_wikipedia::remove_applet'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''AddAppletToCommunity'',
+ ''dotlrn_wikipedia::add_applet_to_community'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''RemoveAppletFromCommunity'',
+ ''dotlrn_wikipedia::remove_applet_from_community'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''AddUser'',
+ ''dotlrn_wikipedia::add_user'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''RemoveUser'',
+ ''dotlrn_wikipedia::remove_user'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''AddUserToCommunity'',
+ ''dotlrn_wikipedia::add_user_to_community'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''RemoveUserFromCommunity'',
+ ''dotlrn_wikipedia::remove_user_from_community'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''AddPortlet'',
+ ''dotlrn_wikipedia::add_portlet'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''RemovePortlet'',
+ ''dotlrn_wikipedia::remove_portlet'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''Clone'',
+ ''dotlrn_wikipedia::clone'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia'',
+ ''ChangeEventHandler'',
+ ''dotlrn_wikipedia::change_event_handler'',
+ ''TCL''
+ );
+
+ perform acs_sc_binding__new (
+ ''dotlrn_applet'',
+ ''dotlrn_wikipedia''
+ );
+
+ return 0;
+
+end;' language 'plpgsql';
+
+select inline_0();
+drop function inline_0();
+
Index: openacs-4/packages/dotlrn-wikipedia/sql/postgresql/dotlrn-wikipedia-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-wikipedia/sql/postgresql/dotlrn-wikipedia-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-wikipedia/sql/postgresql/dotlrn-wikipedia-drop.sql 22 Jun 2006 09:09:08 -0000 1.1
@@ -0,0 +1,108 @@
+
+select acs_sc_impl__delete(
+ 'dotlrn_applet', -- impl_contract_name
+ 'dotlrn_wikipedia' -- impl_name
+);
+
+
+-- add all the hooks
+
+-- GetPrettyName
+select acs_sc_impl_alias__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia',
+ 'GetPrettyName'
+);
+
+-- AddApplet
+select acs_sc_impl_alias__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia',
+ 'AddApplet'
+);
+
+-- RemoveApplet
+select acs_sc_impl_alias__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia',
+ 'RemoveApplet'
+);
+
+-- AddAppletToCommunity
+select acs_sc_impl_alias__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia',
+ 'AddAppletToCommunity'
+);
+
+-- RemoveAppletFromCommunity
+select acs_sc_impl_alias__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia',
+ 'RemoveAppletFromCommunity'
+);
+
+-- AddUser
+select acs_sc_impl_alias__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia',
+ 'AddUser'
+);
+
+-- RemoveUser
+select acs_sc_impl_alias__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia',
+ 'RemoveUser'
+);
+
+-- AddUserToCommunity
+select acs_sc_impl_alias__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia',
+ 'AddUserToCommunity'
+);
+
+-- RemoveUserFromCommunity
+select acs_sc_impl_alias__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia',
+ 'RemoveUserFromCommunity'
+);
+
+-- AddPortlet
+select acs_sc_impl_alias__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia',
+ 'AddPortlet'
+ );
+
+-- RemovePortlet
+select acs_sc_impl_alias__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia',
+ 'RemovePortlet'
+);
+
+-- Clone
+select acs_sc_impl_alias__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia',
+ 'Clone'
+);
+
+
+-- Clone
+select acs_sc_impl_alias__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia',
+ 'ChangeEventHandler'
+);
+
+-- Add the binding
+select acs_sc_binding__delete (
+ 'dotlrn_applet',
+ 'dotlrn_wikipedia'
+);
+
+
Index: openacs-4/packages/dotlrn-wikipedia/tcl/dotlrn-wikipedia-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-wikipedia/tcl/dotlrn-wikipedia-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-wikipedia/tcl/dotlrn-wikipedia-procs.tcl 22 Jun 2006 09:09:08 -0000 1.1
@@ -0,0 +1,239 @@
+
+ad_library {
+
+}
+
+namespace eval dotlrn_wikipedia {
+
+ ad_proc -public applet_key {
+ } {
+ What's my applet key?
+ } {
+ return dotlrn_wikipedia
+ }
+
+ ad_proc -public my_package_key {
+ } {
+ What's my package key?
+ } {
+ return "dotlrn-wikipedia"
+ }
+
+ ad_proc -public package_key {
+ } {
+ What package does this applet deal with?
+ } {
+ return wikipedia
+ }
+
+ ad_proc -public get_pretty_name {
+ } {
+ return the pretty name of this applet.
+ } {
+ return Wikipedia
+ }
+
+ ad_proc -public add_applet {
+ } {
+ Add the wikipedia applet to dotlrn - for one-time init
+ Must be repeatable!
+ } {
+ if {![dotlrn_applet::applet_exists_p -applet_key [applet_key]]} {
+
+ db_transaction {
+ dotlrn_applet::mount \
+ -package_key [my_package_key] \
+ -url wikipedia \
+ -pretty_name [get_pretty_name]
+
+ dotlrn_applet::add_applet_to_dotlrn \
+ -applet_key [applet_key] \
+ -package_key [my_package_key]
+ }
+
+ }
+ }
+
+ ad_proc -public remove_applet {
+ } {
+ remove the applet from dotlrn
+ } {
+ ad_return_complaint 1 "[applet_key] remove_applet not implemented!"
+ }
+
+ ad_proc -public add_applet_to_community {
+ community_id
+ } {
+ Add the wikipedia applet to a dotlrn community
+ } {
+ # Create and Mount the wikipedia package
+ set package_id [dotlrn::instantiate_and_mount \
+ -mount_point wikipedia \
+ $community_id \
+ [package_key] \
+ ]
+
+ # set up the bboard portlet for this community
+ set portal_id [dotlrn_community::get_portal_id \
+ -community_id $community_id \
+ ]
+
+ # add the portlet to the comm's portal using add_portlet_helper
+ set args [ns_set create]
+ ns_set put $args package_id $package_id
+ ns_set put $args param_action overwrite
+
+ dotlrn_wikipedia::add_portlet_helper $portal_id $args
+
+ return $package_id
+ }
+
+ ad_proc -public remove_applet_from_community {
+ community_id
+ } {
+ remove the applet from the given community
+ } {
+ ad_return_complaint 1 "[applet_key] remove_applet_from_community not implemented!"
+ }
+
+ ad_proc -public add_user {
+ user_id
+ } {
+ Called when the user is initially added as a dotlrn user.
+ For one-time init stuff.
+ } {
+ }
+
+ ad_proc -public remove_user {
+ user_id
+ } {
+ called when a user is removed from dotlrn.
+ } {
+ }
+
+ ad_proc -public add_user_to_community {
+ community_id
+ user_id
+ } {
+ Add a user to a specific dotlrn community
+ } {
+ set portal_id [dotlrn::get_portal_id -user_id $user_id]
+ set package_id [dotlrn_community::get_applet_package_id \
+ -community_id $community_id \
+ -applet_key [applet_key] \
+ ]
+ set args [ns_set create]
+ ns_set put $args package_id $package_id
+ ns_set put $args param_action append
+
+ # don't use the cached version
+ dotlrn_wikipedia::add_portlet_helper \
+ [dotlrn::get_portal_id_not_cached -user_id $user_id] \
+ $args
+
+ dotlrn_wikipedia::add_portlet_helper $portal_id $args
+
+ }
+
+ ad_proc -public remove_user_from_community {
+ community_id
+ user_id
+ } {
+ Remove a user from a community
+ } {
+ set portal_id [dotlrn::get_portal_id -user_id $user_id]
+ set package_id [dotlrn_community::get_applet_package_id \
+ -community_id $community_id \
+ -applet_key [applet_key] \
+ ]
+
+ set args [ns_set create]
+ ns_set put $args package_id $package_id
+
+ remove_portlet $portal_id $args
+
+ }
+
+ ad_proc -public add_portlet {
+ portal_id
+ } {
+ A helper proc to set up default params for templates.
+
+ @param portal_id
+ } {
+ set args [ns_set create]
+ ns_set put $args package_id 0
+ ns_set put $args param_action overwrite
+
+ set type [dotlrn::get_type_from_portal_id -portal_id $portal_id]
+
+ if {[string equal $type user]} {
+ # portal_id is a user portal template
+ }
+
+ add_portlet_helper $portal_id $args
+ }
+
+ ad_proc -public add_portlet_helper {
+ portal_id
+ args
+ } {
+ This does the call to add the portlet to the given portal.
+ Params for the portlet are set by the calllers.
+
+ @param portal_id
+ @param args An ns_set of params
+ } {
+ wikipedia_portlet::add_self_to_page \
+ -portal_id $portal_id \
+ -package_id [ns_set get $args package_id] \
+ -param_action [ns_set get $args param_action]
+ }
+
+ ad_proc -public remove_portlet {
+ portal_id
+ args
+ } {
+ A helper proc to remove the underlying portlet from the given portal.
+
+ @param portal_id
+ @param args An ns_set of args
+ } {
+ set package_id [ns_set get $args package_id]
+ #wikipedia_portlet::remove_self_from_page $portal_id $package_id
+ }
+
+ ad_proc -public clone {
+ old_community_id
+ new_community_id
+ } {
+ Clone this applet's content from the old community to the new one
+ } {
+ dotlrn_wikipedia::add_applet_to_community $new_community_id
+ }
+
+ ad_proc -public change_event_handler {
+ community_id
+ event
+ old_value
+ new_value
+ } {
+ listens for the following events: rename
+ } {
+ switch $event {
+ rename {
+ handle_rename -community_id $community_id -old_value $old_value -new_value $new_value
+ }
+ }
+ }
+
+ ad_proc -private handle_rename {
+ {-community_id:required}
+ {-old_value:required}
+ {-new_value:required}
+ } {
+ what to do with wikipedia when the name of the community changes
+ } {
+ }
+
+}
Index: openacs-4/packages/dotlrn-wikipedia/tcl/dotlrn-wikipedia-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-wikipedia/tcl/dotlrn-wikipedia-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-wikipedia/tcl/dotlrn-wikipedia-procs.xql 22 Jun 2006 09:09:08 -0000 1.1
@@ -0,0 +1,3 @@
+
+
+
Index: openacs-4/packages/wikipedia/wikipedia.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia/wikipedia.info,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia/wikipedia.info 22 Jun 2006 09:07:44 -0000 1.1
@@ -0,0 +1,23 @@
+
+
+
+
+ Wikipedia
+ Wikipedia
+ f
+ f
+ wikipedia
+
+
+ Agustin Lopez
+ 0
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/wikipedia/www/search.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia/www/search.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia/www/search.adp 22 Jun 2006 09:07:44 -0000 1.1
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+ @toshow;noquote@
+
Index: openacs-4/packages/wikipedia/www/search.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia/www/search.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia/www/search.tcl 22 Jun 2006 09:07:44 -0000 1.1
@@ -0,0 +1,82 @@
+ad_page_contract {
+} {
+ {whatsearch:trim ""}
+ {xlang:trim "es"}
+ {see:trim "short"}
+} -properties {
+}
+
+
+set WIKIPEDIA_BASE "http://%s.wikipedia.org"
+set WIKIPEDIA_URL [format "$WIKIPEDIA_BASE" $xlang]
+set WIKIPEDIA_SEARCH_URL "$WIKIPEDIA_URL/wiki"
+set STRING_MAX_LENGTH 5000
+
+set timeout 30
+set depth 3
+set redirect_url "error.tcl"
+set result ""
+set toshow ""
+
+switch -glob $xlang {
+ "es" {set s_es "selected"; set s_ca ""; set s_en ""; set s_fr "";
+ set s_de ""; set s_pt ""; set s_it "";}
+ "ca" {set s_es ""; set s_ca "selected"; set s_en ""; set s_fr "";
+ set s_de ""; set s_pt ""; set s_it "";}
+ "en" {set s_es ""; set s_ca ""; set s_en "selected"; set s_fr "";
+ set s_de ""; set s_pt ""; set s_it "";}
+ "fr" {set s_es ""; set s_ca ""; set s_en ""; set s_fr "selected";
+ set s_de ""; set s_pt ""; set s_it "";}
+ "de" {set s_es ""; set s_ca ""; set s_en ""; set s_fr "";
+ set s_de "selected"; set s_pt ""; set s_it "";}
+ "pt" {set s_es ""; set s_ca ""; set s_en ""; set s_fr "";
+ set s_de ""; set s_pt "selected"; set s_it "";}
+ "it" {set s_es ""; set s_ca ""; set s_en ""; set s_fr "";
+ set s_de ""; set s_pt ""; set s_it "selected";}
+ default {set s_es ""; set s_ca ""; set s_en "selected"; set s_fr "";
+ set s_de ""; set s_pt ""; set s_it "";}
+}
+
+set user_id [ad_conn user_id]
+set urltoform [ad_conn url]
+set url ""
+set urlfull ""
+if {$whatsearch ne ""} {
+ set whatsearch [string toupper [string index $whatsearch 0]][string range $whatsearch 1 end]
+ set whatsearch_cod [ns_urlencode $whatsearch]
+ set url [format "$WIKIPEDIA_SEARCH_URL/%s" $whatsearch_cod]
+ set urlfull "/wikipedia/search?whatsearch=$whatsearch_cod"
+
+ if {[catch {set rawtext [ns_httpget $url $timeout $depth]} result]} {
+ #ERROR
+ set toshow "Temporalment fora de servei"
+ } else {
+ set fn "/tmp/wikipedia_$user_id"
+ set fd [open $fn w]
+ puts -nonewline $fd $rawtext
+ close $fd
+ set fd [open $fn r]
+ fconfigure $fd -encoding "utf-8"
+ set rawtext [read $fd [file size $fn]]
+ close $fd
+ file delete $fn
+
+ set L [string length $rawtext]
+ set start [string first "" $rawtext]
+ if {$start <= -1} {
+ set start 0
+ }
+ set end [string first "" $rawtext]
+ set end [expr $end - 1]
+ if {$end <= -1} {
+ set end $L
+ }
+
+ set rawtext [string range $rawtext $start $end]
+ set inter "href=\"\?search=Buscar\\&xlang=$xlang\\&whatsearch="
+ regsub -nocase -line -all {href=\"/wiki/} $rawtext $inter rawtext
+ regsub -nocase -line -all {href=\"/w/} $rawtext "href=\"$WIKIPEDIA_URL/w/" rawtext
+
+ set toshow $rawtext
+ }
+}
Index: openacs-4/packages/wikipedia/www/search_portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia/www/search_portlet.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia/www/search_portlet.adp 22 Jun 2006 09:07:44 -0000 1.1
@@ -0,0 +1,23 @@
+
+
+
+
+ @toshow;noquote@
+
Index: openacs-4/packages/wikipedia/www/search_portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia/www/search_portlet.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia/www/search_portlet.tcl 22 Jun 2006 09:07:44 -0000 1.1
@@ -0,0 +1,86 @@
+ad_page_contract {
+} {
+} -properties {
+}
+
+set WIKIPEDIA_BASE "http://%s.wikipedia.org"
+set WIKIPEDIA_URL [format "$WIKIPEDIA_BASE" $xlang]
+set WIKIPEDIA_SEARCH_URL "$WIKIPEDIA_URL/wiki"
+set STRING_MAX_LENGTH 5000
+
+set timeout 30
+set depth 3
+set redirect_url "error.tcl"
+set result ""
+set toshow ""
+
+switch -glob $xlang {
+ "es" {set s_es "selected"; set s_ca ""; set s_en ""; set s_fr "";
+ set s_de ""; set s_pt ""; set s_it "";}
+ "ca" {set s_es ""; set s_ca "selected"; set s_en ""; set s_fr "";
+ set s_de ""; set s_pt ""; set s_it "";}
+ "en" {set s_es ""; set s_ca ""; set s_en "selected"; set s_fr "";
+ set s_de ""; set s_pt ""; set s_it "";}
+ "fr" {set s_es ""; set s_ca ""; set s_en ""; set s_fr "selected";
+ set s_de ""; set s_pt ""; set s_it "";}
+ "de" {set s_es ""; set s_ca ""; set s_en ""; set s_fr "";
+ set s_de "selected"; set s_pt ""; set s_it "";}
+ "pt" {set s_es ""; set s_ca ""; set s_en ""; set s_fr "";
+ set s_de ""; set s_pt "selected"; set s_it "";}
+ "it" {set s_es ""; set s_ca ""; set s_en ""; set s_fr "";
+ set s_de ""; set s_pt ""; set s_it "selected";}
+ default {set s_es ""; set s_ca ""; set s_en "selected"; set s_fr "";
+ set s_de ""; set s_pt ""; set s_it "";}
+}
+
+set user_id [ad_conn user_id]
+set urltoform [ad_conn url]
+set url ""
+set urlfull ""
+if {$whatsearch ne ""} {
+ set whatsearch [string toupper [string index $whatsearch 0]][string range $whatsearch 1 end]
+ set whatsearch_cod [ns_urlencode $whatsearch]
+ set url [format "$WIKIPEDIA_SEARCH_URL/%s" $whatsearch_cod]
+ set urlfull "/wikipedia/search?xlang=$xlang&whatsearch=$whatsearch_cod"
+
+ if {[catch {set rawtext [ns_httpget $url $timeout $depth]} result]} {
+ #ERROR
+ set toshow "Temporalment fora de servei"
+ } else {
+
+ set fn "/tmp/wikipedia_$user_id"
+ set fd [open $fn w]
+ puts -nonewline $fd $rawtext
+ close $fd
+ set fd [open $fn r]
+ fconfigure $fd -encoding "utf-8"
+ set rawtext [read $fd [file size $fn]]
+ close $fd
+ file delete $fn
+
+ set L [string length $rawtext]
+ set start [string first "" $rawtext]
+ if {$start <= -1} {
+ set start 0
+ }
+ set end [string first "" $rawtext]
+ set end [expr $end - 1]
+ if {$end <= -1} {
+ set end $L
+ }
+
+ set rawtext [string range $rawtext $start $end]
+ set inter "href=\"\?search=Buscar\\&xlang=$xlang\\&whatsearch="
+ regsub -nocase -line -all {href=\"/wiki/} $rawtext $inter rawtext
+ regsub -nocase -line -all {href=\"/w/} $rawtext "href=\"$WIKIPEDIA_URL/w/" rawtext
+
+ set toshow $rawtext
+ if {$see ne "full"} {
+ if {[string length $toshow] > $STRING_MAX_LENGTH} {
+ set toshow [string range $toshow 0 $STRING_MAX_LENGTH]
+ set toshow "$toshow \"...\n"
+ }
+ }
+ }
+}
+
Index: openacs-4/packages/wikipedia-portlet/wikipedia-portlet.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia-portlet/wikipedia-portlet.info,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia-portlet/wikipedia-portlet.info 22 Jun 2006 09:08:28 -0000 1.1
@@ -0,0 +1,21 @@
+
+
+
+
+ Wikipedia Portlet
+ Wikipedia Portlets
+ f
+ t
+
+
+ OpenACS
+ 2006-04-11
+ OpenACS
+ 0
+
+
+
+
+
+
+
Index: openacs-4/packages/wikipedia-portlet/catalog/wikipedia-portlet.ca_ES.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia-portlet/catalog/wikipedia-portlet.ca_ES.ISO-8859-1.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia-portlet/catalog/wikipedia-portlet.ca_ES.ISO-8859-1.xml 22 Jun 2006 09:08:28 -0000 1.1
@@ -0,0 +1,8 @@
+
+
+
+ Administraci� de Wikipedia
+ Wikipedia
+ P�gina principal
+ Wikipedia
+
Index: openacs-4/packages/wikipedia-portlet/catalog/wikipedia-portlet.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia-portlet/catalog/wikipedia-portlet.en_US.ISO-8859-1.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia-portlet/catalog/wikipedia-portlet.en_US.ISO-8859-1.xml 22 Jun 2006 09:08:28 -0000 1.1
@@ -0,0 +1,8 @@
+
+
+
+ Wikipedia administration
+ Wikipedia
+ Main page
+ Wikipedia
+
Index: openacs-4/packages/wikipedia-portlet/catalog/wikipedia-portlet.es_ES.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia-portlet/catalog/wikipedia-portlet.es_ES.ISO-8859-1.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia-portlet/catalog/wikipedia-portlet.es_ES.ISO-8859-1.xml 22 Jun 2006 09:08:28 -0000 1.1
@@ -0,0 +1,8 @@
+
+
+
+ Administraci�n de wikipedia
+ Wikipedia
+ P�gina principal
+ Wikipedia
+
Index: openacs-4/packages/wikipedia-portlet/sql/postgresql/wikipedia-portlet-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia-portlet/sql/postgresql/wikipedia-portlet-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia-portlet/sql/postgresql/wikipedia-portlet-create.sql 22 Jun 2006 09:08:28 -0000 1.1
@@ -0,0 +1,161 @@
+
+create function inline_0()
+returns integer as '
+declare
+ ds_id portal_datasources.datasource_id%TYPE;
+begin
+
+ ds_id = portal_datasource__new(
+ ''wikipedia_portlet'', -- Name
+ ''Wikipedia portlet'' -- description
+ );
+
+ -- the standard 4 params
+
+ -- shadeable_p
+ perform portal_datasource__set_def_param (
+ ds_id, -- datasource_id
+ ''t'', -- config_required_p
+ ''t'', -- configured_p
+ ''shadeable_p'', -- key
+ ''t'' -- value
+);
+
+
+ -- hideable_p
+ perform portal_datasource__set_def_param (
+ ds_id,
+ ''t'',
+ ''t'',
+ ''hideable_p'',
+ ''t''
+);
+
+ -- user_editable_p
+ perform portal_datasource__set_def_param (
+ ds_id,
+ ''t'',
+ ''t'',
+ ''user_editable_p'',
+ ''f''
+);
+
+ -- shaded_p
+ perform portal_datasource__set_def_param (
+ ds_id,
+ ''t'',
+ ''t'',
+ ''shaded_p'',
+ ''f''
+);
+
+ -- link_hideable_p
+ perform portal_datasource__set_def_param (
+ ds_id,
+ ''t'',
+ ''t'',
+ ''link_hideable_p'',
+ ''t''
+);
+
+-- wikipedia-specific params
+
+ -- community_id must be configured
+ perform portal_datasource__set_def_param (
+ ds_id,
+ ''t'',
+ ''f'',
+ ''package_id'',
+ ''''
+);
+
+ return 0;
+
+end;' language 'plpgsql';
+
+select inline_0();
+
+drop function inline_0();
+
+
+create function inline_1()
+returns integer as '
+begin
+
+ -- create the implementation
+ perform acs_sc_impl__new (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''wikipedia_portlet''
+ );
+
+ -- add all the hooks
+ perform acs_sc_impl_alias__new (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''GetMyName'',
+ ''wikipedia_portlet::get_my_name'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''GetPrettyName'',
+ ''wikipedia_portlet::get_pretty_name'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''Link'',
+ ''wikipedia_portlet::link'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''AddSelfToPage'',
+ ''wikipedia_portlet::add_self_to_page'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''Show'',
+ ''wikipedia_portlet::show'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''Edit'',
+ ''wikipedia_portlet::edit'',
+ ''TCL''
+ );
+
+ perform acs_sc_impl_alias__new (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''RemoveSelfFromPage'',
+ ''wikipedia_portlet::remove_self_from_page'',
+ ''TCL''
+ );
+
+ -- Add the binding
+ perform acs_sc_binding__new (
+ ''portal_datasource'',
+ ''wikipedia_portlet''
+ );
+
+ return 0;
+end;' language 'plpgsql';
+
+select inline_1();
+
+drop function inline_1();
+
Index: openacs-4/packages/wikipedia-portlet/sql/postgresql/wikipedia-portlet-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia-portlet/sql/postgresql/wikipedia-portlet-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia-portlet/sql/postgresql/wikipedia-portlet-drop.sql 22 Jun 2006 09:08:28 -0000 1.1
@@ -0,0 +1,82 @@
+
+create function inline_1()
+returns integer as '
+declare
+ ds_id portal_datasources.datasource_id%TYPE;
+begin
+
+ select datasource_id into ds_id
+ from portal_datasources
+ where name = ''wikipedia_portlet'';
+
+ if not found then
+ RAISE EXCEPTION '' No datasource id found '', ds_id;
+ ds_id := null;
+ end if;
+
+ if ds_id is NOT null then
+ perform portal_datasource__delete(ds_id);
+ end if;
+
+ -- drop the hooks
+ perform acs_sc_impl_alias__delete (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''GetMyName''
+ );
+
+ perform acs_sc_impl_alias__delete (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''GetPrettyName''
+ );
+
+
+ perform acs_sc_impl_alias__delete (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''Link''
+ );
+
+ perform acs_sc_impl_alias__delete (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''AddSelfToPage''
+ );
+
+ perform acs_sc_impl_alias__delete (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''Show''
+ );
+
+ perform acs_sc_impl_alias__delete (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''Edit''
+ );
+
+ perform acs_sc_impl_alias__delete (
+ ''portal_datasource'',
+ ''wikipedia_portlet'',
+ ''RemoveSelfFromPage''
+ );
+
+ -- Drop the binding
+ perform acs_sc_binding__delete (
+ ''portal_datasource'',
+ ''wikipedia_portlet''
+ );
+
+ -- drop the impl
+ perform acs_sc_impl__delete (
+ ''portal_datasource'',
+ ''wikipedia_portlet''
+ );
+
+ return 0;
+end;' language 'plpgsql';
+
+select inline_1();
+drop function inline_1();
+
Index: openacs-4/packages/wikipedia-portlet/tcl/wikipedia-portlet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia-portlet/tcl/wikipedia-portlet-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia-portlet/tcl/wikipedia-portlet-procs.tcl 22 Jun 2006 09:08:28 -0000 1.1
@@ -0,0 +1,76 @@
+ad_library {
+}
+
+namespace eval wikipedia_portlet {
+
+ ad_proc -private get_my_name {
+ } {
+ return "wikipedia_portlet"
+ }
+
+ ad_proc -private my_package_key {
+ } {
+ return "wikipedia-portlet"
+ }
+
+ ad_proc -public get_pretty_name {
+ } {
+ return "#wikipedia-portlet.pretty_name#"
+ }
+
+ ad_proc -public link {
+ } {
+ return ""
+ }
+
+ ad_proc -public add_self_to_page {
+ {-portal_id:required}
+ {-page_name ""}
+ {-package_id:required}
+ {-extra_params ""}
+ {-force_region ""}
+ {-param_action:required}
+ } {
+ add the portlet element to the given portal
+ } {
+ return [portal::add_element_parameters \
+ -portal_id $portal_id \
+ -page_name $page_name \
+ -pretty_name [get_pretty_name] \
+ -portlet_name [get_my_name] \
+ -key package_id \
+ -value $package_id \
+ -force_region $force_region \
+ -extra_params $extra_params \
+ -param_action $param_action
+ ]
+ }
+
+ ad_proc -public remove_self_from_page {
+ {-portal_id:required}
+ {-package_id:required}
+ } {
+ Removes a wikipedia PE from the given page or the package_id of the
+ wikipedia package from the portlet if there are others remaining
+
+ @param portal_id The page to remove self from
+ @param package_id
+ } {
+ portal::remove_element_parameters \
+ -portal_id $portal_id \
+ -portlet_name [get_my_name] \
+ -value $package_id
+ }
+
+ ad_proc -public show {
+ cf
+ } {
+ } {
+ portal::show_proc_helper \
+ -package_key [my_package_key] \
+ -config_list $cf \
+ -template_src "wikipedia-portlet"
+ }
+
+}
+
Index: openacs-4/packages/wikipedia-portlet/www/wikipedia-portlet-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia-portlet/www/wikipedia-portlet-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia-portlet/www/wikipedia-portlet-postgresql.xql 22 Jun 2006 09:08:28 -0000 1.1
@@ -0,0 +1,7 @@
+
+
+
+postgresql7.1
+
+
+
Index: openacs-4/packages/wikipedia-portlet/www/wikipedia-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia-portlet/www/wikipedia-portlet.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia-portlet/www/wikipedia-portlet.adp 22 Jun 2006 09:08:28 -0000 1.1
@@ -0,0 +1,4 @@
+
+
+
+
Index: openacs-4/packages/wikipedia-portlet/www/wikipedia-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/wikipedia-portlet/www/wikipedia-portlet.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/wikipedia-portlet/www/wikipedia-portlet.tcl 22 Jun 2006 09:08:28 -0000 1.1
@@ -0,0 +1,26 @@
+#dotlrn-wikipedia/www/wikipedia-portlet.tcl
+
+ad_page_contract {
+ The display logic for the wikipedia portlet
+
+ @author Agustin Lopez (Agustin.Lopez@uv.es)
+ @version $Id: wikipedia-portlet.tcl,v 1.1 2006/06/22 09:08:28 darior Exp $
+} {
+ {whatsearch:trim ""}
+ {xlang:trim ""}
+ {see:trim "short"}
+ {page_num:trim "0"}
+} -properties {
+}
+
+if {$xlang eq ""} {
+ set xlang [string range [lang::user::site_wide_locale] 0 1]
+}
+
+array set config $cf
+set community_id [dotlrn_community::get_community_id]
+
+set user_id [ad_conn user_id]
+
+ad_return_template
+