Index: openacs-4/packages/dotlrn-glossar/dotlrn-glossar.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-glossar/dotlrn-glossar.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-glossar/dotlrn-glossar.info 20 Aug 2005 09:38:45 -0000 1.1 @@ -0,0 +1,28 @@ + + + + + dotLRN Glossar + dotLRN Glossars + f + f + + + Bjoern Kiesbye + Malte Sussdorff + Intigrates the Glossar Portlet into dotLRN. + Cognovis + Intigrates the Glossar Portlet into dotLRN. + 0 + + + + + + + + + + + + Index: openacs-4/packages/dotlrn-glossar/sql/postgresql/dotlrn-glossar-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-glossar/sql/postgresql/dotlrn-glossar-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-glossar/sql/postgresql/dotlrn-glossar-create.sql 20 Aug 2005 09:38:45 -0000 1.1 @@ -0,0 +1,162 @@ +-- +-- Copyright (C) 2005 Cognovis +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- The dotlrn-glossar applet's implimentation of the dotlrn applet contract +-- +-- +-- +-- $Id: dotlrn-glossar-create.sql +-- + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + -- create the implementation + foo := acs_sc_impl__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''dotlrn_glossar'' + ); + + -- GetPrettyName + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''GetPrettyName'', + ''dotlrn_glossar::get_pretty_name'', + ''TCL'' + ); + + -- AddApplet + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''AddApplet'', + ''dotlrn_glossar::add_applet'', + ''TCL'' + ); + + -- RemoveApplet + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''RemoveApplet'', + ''dotlrn_glossar::remove_applet'', + ''TCL'' + ); + + -- AddAppletToCommunity + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''AddAppletToCommunity'', + ''dotlrn_glossar::add_applet_to_community'', + ''TCL'' + ); + + -- RemoveAppletFromCommunity + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''RemoveAppletFromCommunity'', + ''dotlrn_glossar::remove_applet_from_community'', + ''TCL'' + ); + + -- AddUser + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''AddUser'', + ''dotlrn_glossar::add_user'', + ''TCL'' + ); + + -- RemoveUser + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''RemoveUser'', + ''dotlrn_glossar::remove_user'', + ''TCL'' + ); + + -- AddUserToCommunity + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''AddUserToCommunity'', + ''dotlrn_glossar::add_user_to_community'', + ''TCL'' + ); + + -- RemoveUserFromCommunity + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''RemoveUserFromCommunity'', + ''dotlrn_glossar::remove_user_from_community'', + ''TCL'' + ); + + -- AddPortlet + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''AddPortlet'', + ''dotlrn_glossar::add_portlet'', + ''TCL'' + ); + + -- RemovePortlet + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''RemovePortlet'', + ''dotlrn_glossar::remove_portlet'', + ''TCL'' + ); + + -- Clone + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''Clone'', + ''dotlrn_glossar::clone'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'', + ''ChangeEventHandler'', + ''dotlrn_glossar::change_event_handler'', + ''TCL'' + ); + + -- Add the binding + perform acs_sc_binding__new ( + ''dotlrn_applet'', + ''dotlrn_glossar'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn-glossar/tcl/dotlrn-glossar-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-glossar/tcl/dotlrn-glossar-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-glossar/tcl/dotlrn-glossar-procs.tcl 20 Aug 2005 09:38:45 -0000 1.1 @@ -0,0 +1,255 @@ +# Copyright (C) 2005 Cognovis +# This file is part of dotLRN. +# dotLRN is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. + +ad_library { + + the dotlrn applet for Glossar + + @author Bjoern Kiesbye (kiesbye@theservice.de) + @version $Id: dotlrn-glossar-procs.tcl,v 1.1 2005/08/20 09:38:45 maltes Exp $ +} + +namespace eval dotlrn_glossar {} + +ad_proc -public dotlrn_glossar::package_key { +} { + What package does this applet deal with? +} { + return "glossar" +} + +ad_proc -public dotlrn_glossar::my_package_key { +} { + What's my package key? +} { + return "dotlrn-glossar" +} + +ad_proc -public dotlrn_glossar::applet_key { +} { + What's my applet key? +} { + return "dotlrn_glossar" +} + +ad_proc -public dotlrn_glossar::get_pretty_name { +} { +} { + return "Glossar" +} + +ad_proc -public dotlrn_glossar::add_applet { +} { + Called for one time init - must be repeatable! + @return new pkg_id or 0 on failure +} { + + # Glossar Package is Singleton and is required to be installed + # , so just add the applet to dotlrn. And mount the + # Glossar Package under the dotlrn_url so users are able to + # to access Glossar from My Space. + + # Mount the Glossar Package under the Community Url + set package_id [apm_package_id_from_key glossar] + + if {![dotlrn::is_package_mounted -package_key glossar]} { + set com_url [dotlrn::get_url] + + array set node_info [site_node::get_from_url -url $com_url -exact] + set parent_id $node_info(node_id) + + db_transaction { + set node_id [site_node::new \ + -name glossar \ + -parent_id $parent_id \ + -directory_p "t" \ + -pattern_p "t" \ + ] + } + + site_node::mount -node_id $node_id -object_id $package_id + + } + + dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key] -package_key [my_package_key] + +} + +ad_proc -public dotlrn_glossar::remove_applet { +} { + One-time destroy for when the entire applet is removed from dotlrn. +} { + ad_return_complaint 1 "[applet_key] remove_applet not implimented!" +} + + +ad_proc -public dotlrn_glossar::add_applet_to_community { + community_id +} { + Add the glossar applet to a specific dotlrn community + + @params community_id +} { + + # Mount the Glossar Package under the Community Url + set package_id [apm_package_id_from_key glossar] + + set com_url [dotlrn_community::get_community_url $community_id] + + array set node_info [site_node::get_from_url -url $com_url -exact] + set parent_id $node_info(node_id) + + db_transaction { + set node_id [site_node::new \ + -name glossar \ + -parent_id $parent_id \ + -directory_p "t" \ + -pattern_p "t" \ + ] + } + + site_node::mount -node_id $node_id -object_id $package_id + + + + set portal_id [dotlrn_community::get_portal_id \ + -community_id $community_id \ + ] + + + + + + # Add the Portlet to this community + + + glossar_portlet::add_self_to_page -portal_id $portal_id -package_id $package_id + + + # this should return the package_id + return $package_id +} + +ad_proc -public dotlrn_glossar::remove_applet_from_community { + community_id +} { + remove the applet from the community +} { + ad_return_complaint 1 "[applet_key] remove_applet_from_community not implimented!" +} + +ad_proc -public dotlrn_glossar::add_user { + user_id +} { + Called once when a user is added as a dotlrn user. + Shall we have glossar inside the user space +} { +} + +ad_proc -public dotlrn_glossar::remove_user { + user_id +} { + Remove a user from dotlrn +} { + + # Not yet implemented. +} + +ad_proc -public dotlrn_glossar::add_user_to_community { + community_id + user_id +} { + Add a user to a community +} { + +# We don't need this portlet inside the user space +# set package_id [dotlrn_community::get_applet_package_id -community_id $community_id -applet_key [applet_key]] + # set portal_id [dotlrn::get_portal_id -user_id $user_id] + + + # glossar_portlet::add_self_to_page \ + -portal_id $portal_id \ + -package_id $package_id] \ + -param_action append + + +} + +ad_proc -public dotlrn_glossar::remove_user_from_community { + community_id + user_id +} { + Remove a user from a community +} { +} + +ad_proc -public dotlrn_glossar::add_portlet { + portal_id +} { + Add Portlet to the Portal + + @param portal_id +} { + + glossar_portlet::add_self_to_page -portal_id $portal_id -package_id 0 + +} + +ad_proc -public dotlrn_glossar::remove_portlet { + portal_id + args +} { + A helper proc to remove the underlying portlet from the given portal. + This is alot simpler than add_portlet. + + @param portal_id + @param args An ns_set with the project_manager_id. +} { + glossar_portlet::remove_self_from_page \ + -portal_id $portal_id +} + +ad_proc -public dotlrn_glossar::clone { + old_community_id + new_community_id +} { + Clone this applet's content from the old community to the new one +} { +} + +ad_proc -public dotlrn_glossar::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 dotlrn_glossar::handle_rename { + {-community_id:required} + {-old_value:required} + {-new_value:required} +} { + When a dotlrn community is renamed +} { + +} + + Index: openacs-4/packages/glossar/glossar.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/glossar.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/glossar.info 20 Aug 2005 09:37:50 -0000 1.1 @@ -0,0 +1,30 @@ + + + + + Glossar + Glossars + f + t + + + Bjoern Kiesbye + Malte Sussdorff + Glossars , translations for specific terms, and terms that shouldn't be used. + 2005-07-14 + Cognovis + Glossars , translations for specific terms, and terms that shouldn't be used. + 0 + + + + + + + + + + + + + Index: openacs-4/packages/glossar/catalog/glossar.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/catalog/glossar.de_DE.ISO-8859-1.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/catalog/glossar.de_DE.ISO-8859-1.xml 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,32 @@ + + + + Neuen Glossar hinzuf�gen + Neue �bersetzung hinzuf�gen + Kommentar + Erstellt von + Kommentar + Nicht verwenden + Bearbeiten + Glossar Nr. + Neu + Neu + Neues Lektorat + Neuer Ausdruck + Neue Uuml;bersetzung + Ausdruck + Sprache + Ausgangssprache + Sprache + Ausgangsausdruck + Zielsprache + Zielausdruck + Edit + Ausdruck Nr. + Titel + Neuer Glossar + Neues Glossar + Neue �bersetzung + Keine Glossare vorhanden! + Keine Ausdruuml;ke vorhanden! + Index: openacs-4/packages/glossar/catalog/glossar.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/catalog/glossar.en_US.ISO-8859-1.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/catalog/glossar.en_US.ISO-8859-1.xml 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,52 @@ + + + + Add New Glossar + Add new Glossar + Add New Translation + Add New Translation + Add new Translation + Comment + Delete selected + Edit Glossar + Files + Files + Comment + Creation User + Comment + Don't use + Edit + First Name + Get CSV + Normal View + Glossar Nr. + Last modified + Sir Name + New + New + New Lecture + New Term + New Translation + + Term + Language + Source Language + Language + Source Term + Target Language + Target Term + Edit + Term Nr. + Title + New Glossar + New Glossar + New Translation + No Glossars exist! + No Terms found! + Title + Type + Update selected + Updated by + Updated on + More Files + Index: openacs-4/packages/glossar/lib/bak.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/bak.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/bak.xql 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,26 @@ + + + + + + + + + + + + + SELECT glossar_id , title , comment , source_category_id , target_category_id + FROM gl_glossars g + WHERE g.owner_id = :owner_id + + + + + + + + postgresql + 7.2 + + Index: openacs-4/packages/glossar/lib/glossar-file-upload.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-file-upload.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-file-upload.adp 20 Aug 2005 09:37:50 -0000 1.1 @@ -0,0 +1,3 @@ + + + \ No newline at end of file Index: openacs-4/packages/glossar/lib/glossar-file-upload.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-file-upload.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-file-upload.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,192 @@ +# packages/glossar/lib/glossar-term-list.tcl +# +# Lists all Terms from one Glossar +# +# @author Bjoern Kiesbye (bjoern_kiesbye@web.de) +# @creation-date 2005-07-10 +# @arch-tag: beb88796-955e-4cbd-af5e-3919597c7ed1 +# @cvs-id $Id: glossar-file-upload.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ + +foreach required_param {glossar_id} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} +foreach optional_param {page orderby upload_count} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + +if {![info exists upload_count]} { + set upload_count "1" +} + +if {![info exists orderby]} { + set order_by "file,asc" +} + +if {$upload_count != 10} { + set upload_count 1 +} + +set folder_id [application_data_link::get_linked \ + -from_object_id $glossar_id \ + -to_object_type "content_folder"] + + + +set form_elements [list {glossar_id:integer(hidden)}] +lappend form_elements [list {upload_count:integer(hidden)}] +lappend form_elements [list {orderby:text(hidden),optional}] +set upload_number 1 + +while {$upload_number <= $upload_count} { + lappend form_elements [list "upload_file${upload_number}:file(file),optional" [list label ""] [list section "section$upload_number"]] + lappend form_elements [list "upload_title${upload_number}:text(text),optional" [list html "size 45 maxlength 100"] [list label ""]] + incr upload_number +} + +if {$upload_count == 1} {set upload_label "Upload" } else {set upload_label "[_ glossar.glossar_Done]" } + +lappend form_elements [list "upload:text(submit),optional" [list "label" $upload_label]] +lappend form_elements [list "upload_more:text(submit),optional" [list "label" "[_ glossar.Upload_More]"]] + +ad_form -name upload_files -html {enctype multipart/form-data} -form $form_elements -on_request { +} -on_submit { + set upload_number 1 + set message [list] + while {$upload_number <= $upload_count} { + set file [set "upload_file${upload_number}"] + set title [set "upload_title${upload_number}"] + set filename [template::util::file::get_property filename $file] + if {$filename != "" } { + set tmp_filename [template::util::file::get_property tmp_filename $file] + set mime_type [template::util::file::get_property mime_type $file] + set tmp_size [file size $tmp_filename] + set extension [contact::util::get_file_extension \ + -filename $filename] + if {![exists_and_not_null title]} { + regsub -all ".${extension}\$" $filename "" title + } + set filename "$filename" + + set revision_id [cr_import_content \ + -storage_type "file" -title $title $glossar_id $tmp_filename $tmp_size $mime_type $filename] + + content::item::set_live_revision -revision_id $revision_id + + # if the file is an image we need to create thumbnails + # #/sw/bin/convert -gravity Center -crop 75x75+0+0 fred.jpg fred.jpg + # #/sw/bin/convert -gravity Center -geometry 100x100+0+0 04055_7.jpg + # fred.jpg + + lappend message "$title" + } + incr upload_number + } + if {[llength $message] == 1} { + set message [lindex $message 1] + util_user_message -html -message "[_ glossar.lt_The_file_lindex_messa]" + } elseif {[llength $message] > 1} { + set message [join $message ", "] + util_user_message -html -message "[_ glossar.lt_The_files_join_messag]" + } +} -after_submit { + if {[exists_and_not_null upload_more]} { + ad_returnredirect [export_vars \ + -base "glossar-file-upload" -url {{upload_count 10 glossar_id}}] + } else { + ad_returnredirect "glossar-file-upload?glossar_id=$glossar_id" + } + ad_script_abort +} + +template::list::create \ + -html {width 100%} \ + -name "files" \ + -multirow "files" \ + -row_pretty_plural "[_ glossar.files]" \ + -checkbox_name checkbox \ + -bulk_action_export_vars [list glossar_id orderby] \ + -bulk_actions [list \ + "[_ glossar.Delete]" "glossar-file-delete" "[_ glossar.lt_Delete_the_selectted_]" \ + "[_ glossar.Update]" "glossar-file-update" "[_ glossar.Update_filenames]" \ + ] \ + -selected_format "normal" \ + -key item_id \ + -elements { + file { + label {File} + display_col title + link_url_eval $file_url + } + rename { + label {Rename} + display_template { + } + } + type { + label "[_ glossar.Type]" + display_col extension + } + creation_date { + label "[_ glossar.Updated_On]" + display_col creation_date_pretty + } + creation_user { + label "[_ glossar.Updated_By]" + display_col creation_user_pretty + } + } -filters { + } -orderby { + file { + label "[_ glossar.File]" + orderby_asc "upper(cr.title) asc, ao.creation_date desc" + orderby_desc "upper(cr.title) desc, ao.creation_date desc" + default_direction asc + } + creation_date { + label "[_ glossar.Updated_On]" + orderby_asc "ao.creation_date asc" + orderby_desc "ao.creation_date desc" + default_direction desc + } + creation_user { + label "[_ glossar.Updated_By]" + orderby_asc "upper(contact__name(ao.creation_user)) asc, upper(cr.title) asc" + orderby_desc "upper(contact__name(ao.creation_user)) desc, upper(cr.title) asc" + default_direction desc + } + default_value file,asc + } -formats { + normal { + label "[_ glossar.Table]" + layout table + row { + } + } + } + +set package_url [ad_conn package_url] +db_multirow -extend {file_url extension} -unclobber files select_files "select ci.item_id, + ci.name, + cr.title, + to_char(ao.creation_date,'FMMon DD FMHH12:MIam') as creation_date_pretty, + contact__name(ao.creation_user) as creation_user_pretty + from cr_items ci, cr_revisions cr, acs_objects ao + where ci.parent_id = :glossar_id + and ci.live_revision = cr.revision_id + and cr.revision_id = ao.object_id +[template::list::orderby_clause \ + -orderby \ + -name "files"]" { + set file_url "${package_url}${glossar_id}/files/${name}" + set extension [lindex [split $name "."] end] + } +if {![empty_string_p $folder_id]} { + set package_id [lindex [fs::get_folder_package_and_root $folder_id] 0] + set base_url [apm_package_url_from_id $package_id] +} + + Index: openacs-4/packages/glossar/lib/glossar-list-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-list-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-list-postgresql.xql 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,27 @@ + + + + + + + + + + + + + SELECT cr.item_id as glossar_id , crr.title , crr.description , gl.source_category_id , gl.target_category_id , gl.owner_id, +case when gl.target_category_id is null then 0 else 1 end as sort_key + FROM gl_glossars gl, cr_items cr, cr_revisions crr + WHERE cr.latest_revision = crr.revision_id + AND crr.revision_id = gl.glossar_id + AND gl.owner_id = :owner_id + [template::list::orderby_clause -orderby -name gl_glossar] + + + + + postgresql + 7.2 + + Index: openacs-4/packages/glossar/lib/glossar-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-list.adp 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,6 @@ + +

@no_perm@

+
+ + + Index: openacs-4/packages/glossar/lib/glossar-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-list.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,201 @@ +# packages/glossar/lib/glossar-list.tcl +# +# Creates a List of all glossars which belong to a given object_id. +# +# @author Bjoern Kiesbye (bjoern_kiesbye@web.de) +# @creation-date 2005-07-09 +# @arch-tag: 4760fbcd-c60f-45c9-9ac2-735f3ddae15d +# @cvs-id $Id: glossar-list.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ + +foreach required_param {owner_id} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} +foreach optional_param {format page_size orderby customer_id} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + + +#if {![exists_and_not_null base_url]} { + set base_url "/glossar" +#} + +if {![info exists format]} { + set format "normal" +} + +if {![info exists format]} { + set page_size "25" +} + +set glossar_id "0" + +set gl_translation_p 0 + +#if {![exists_and_not_null owner_id]} { +# set owner_id 499 +#} + +ns_log notice "OWNER_ID $owner_id" +if [empty_string_p "[ad_conn user_id]"] { + ad_redirect_for_registration +} + +# We check if the owner_id is an relation, if it is, the real_owner_id +# becomes the eta_id stored in gl_glossars, else it becomes the +# owner_id which can be a customer_id or a etat_id. +# We still pass on the owner_id to check permission. +# Only if the owner_id is an relation we have two id's an etat_id +# (glossar owner) and an extra custommer_id which is stored in +# gl_glossar_terms to indicate which terms of a glossar , owned by a +# etat, belong to a specific customer. +# This results into thre possible displays. +# 1. owner_id is a customer_id (all glossars , owned by customer_id, +# with all terms will be displayed) +# +# 2. owner_id is a etat_id (all glossars, owened by etat_id, with all +# terms will be displayed, while each term indicates to which +# customer(_id) it belongs (happens if the term was added by a +# relation), none if it belongs to the etat directly (happens if the +# term was added by a etat) ) +# +# 3. owner_id is a relation_id (all glossars, owned by the etat_id +# which is stored in the relations object_id_one column, with all +# terms having a customer_id, equal to the relations object_id_two. +# Question: Should it be possible to to display all glossars +# owned by the relations object_id_two (custommer_id) including all +# terms as well? + + + + +if {[db_0or1row owner_type_check {SELECT object_id_one , object_id_two FROM acs_rels WHERE rel_id = :owner_id}]} { + set customer_id $object_id_two + set owner_id $object_id_one +} else { + + if {![info exists customer_id]} { + set customer_id "" + } + + set owner_id $owner_id +} + +set actions [list "[_ glossar.New_Lecture]" [export_vars -base "${base_url}/glossar-add" {owner_id gl_translation_p customer_id }] "[_ glossar.New_Lecture]"] + +set gl_translation_p 1 + +lappend actions "[_ glossar.New_Translation]" [export_vars -base "${base_url}/glossar-add" {owner_id gl_translation_p customer_id}] "[_ glossar.Add_New_Translation]" + + +set row_list [list title description source_category target_category glossar_edit glossar_files] + +set no_perm_p 0 + +if [permission::permission_p -object_id $owner_id -privilege admin] { + +} elseif {[permission::permission_p -object_id $owner_id -privilege create]} { + + set user_perm create + +} elseif {[permission::permission_p -object_id $owner_id -privilege read]} { + + set actions "" + set row_list [list title description source_category target_category] + +} else { + + set no_perm "You don't have Permission to read Glossars !" + set no_perm_p 1 +} + +if { $no_perm_p == 0} { + +template::list::create \ + -name gl_glossar \ + -key glossar_id \ + -no_data "[_ glossar.None]" \ + -selected_format $format \ + -pass_properties {customer_id owner_id edit_link} \ + -elements { + title { + label {[_ glossar.glossar_title]} + display_template "@gl_glossar.title@" + } + description { + label {[_ glossar.glossar_description]} + } + source_category { + label {[_ glossar.glossar_source_category_header]} + } + target_category { + label {[_ glossar.glossar_target_category]} + } + glossar_edit { + display_template "[_ acs-kernel.common_Edit]" + } + glossar_files { + display_template "[_ glossar.Files]" + } + + } -actions $actions -sub_class narrow \ + -orderby { + default_value title + glossar_id { + label {[_ glossar.glossar_id]} + orderby_desc {sort_key asc , gl.glossar_id desc} + orderby_asc {sort_key asc , gl.glossar_id asc} + default_direction desc + } + title { + label {[_ glossar.glossar_title]} + orderby_desc {sort_key asc , crr.title desc} + orderby_asc {sort_key asc , crr.title asc} + default_direction asc + } + } -orderby_name orderby \ + -filters { + customer_id {} + edit_link {} + } \ + -page_size_variable_p 1 \ + -page_size $page_size \ + -page_flush_p 0 \ + -page_query_name gl_glossar \ + -formats { + normal { + label "[_ glossar.Table]" + layout table + elements $row_list + } + csv { + label "[_ glossar.CSV]" + output csv + page_size 0 + row + } + } + + + +db_multirow -extend {source_category target_category gl_translation_p glossar_edit glossar_files files_url edit_url title_url} gl_glossar gl_glossar {} { + if {![empty_string_p $target_category_id]} { + set gl_translation_p 1 + } else { + set gl_translation_p 0 + } + set glossar_edit "[_ glossar.glossar_Edit]" + set glossar_files "[_ glossar.files]" + set source_category "[category::get_name $source_category_id]" + set target_category "[category::get_name $target_category_id]" + set title_url "[export_vars -base "${base_url}/glossar-term-list" {glossar_id gl_translation_p customer_id owner_id}]" + set edit_url "[export_vars -base "${base_url}/glossar-add" {owner_id glossar_id gl_translation_p }]" + set files_url "[export_vars -base "${base_url}/glossar-file-upload" {glossar_id}]" +} if_no_rows { + + +} +} \ No newline at end of file Index: openacs-4/packages/glossar/lib/glossar-portlet-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-portlet-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-portlet-list.adp 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,6 @@ + +

@no_perm@

+
+ + + Index: openacs-4/packages/glossar/lib/glossar-portlet-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-portlet-list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-portlet-list.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,197 @@ +# packages/glossar/lib/glossar-portlet-list.tcl +# +# Creates a list of all glossars that belong to this Customer, direct and indirect (Etat) +# +# @author Bjoern Kiesbye (bjoern_kiesbye@web.de) +# @creation-date 2005-07-29 +# @arch-tag: 4324b14c-cb5d-4512-b56d-0e0ab10ff025 +# @cvs-id $Id: glossar-portlet-list.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ + +foreach required_param {owner_ids} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} +foreach optional_param {gl_format gl_customer_id gl_orderby} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + + +set base_url [dotlrn_community::get_community_url \ + [dotlrn_community::get_community_id_from_url] \ + ] + +set glossar_id "0" + +set gl_translation_p 0 +set page_size 100 +set base_url "glossar" + +if [empty_string_p "[ad_conn user_id]"] { + ad_redirect_for_registration +} + +set customer_id [lindex $owner_ids 0] +set where_etat_ids [join [lrange $owner_ids 1 [llength $owner_ids]] "','" ] +set actions "" +ns_log notice "WHERE $where_etat_ids , owner $customer_id " + +# We check if the owner_id is an relation, if it is, the real_owner_id +# becomes the eta_id stored in gl_glossars, else it becomes the +# owner_id which can be a customer_id or a etat_id. +# We still pass on the owner_id to check permission. +# Only if the owner_id is an relation we have two id's an etat_id +# (glossar owner) and an extra custommer_id which is stored in +# gl_glossar_terms to indicate which terms of a glossar , owned by a +# etat, belong to a specific customer. +# This results into thre possible displays. +# 1. owner_id is a customer_id (all glossars , owned by customer_id, +# with all terms will be displayed) +# +# 2. owner_id is a etat_id (all glossars, owened by etat_id, with all +# terms will be displayed, while each term indicates to which +# customer(_id) it belongs (happens if the term was added by a +# relation), none if it belongs to the etat directly (happens if the +# term was added by a etat) ) +# +# 3. owner_id is a relation_id (all glossars, owned by the etat_id +# which is stored in the relations object_id_one column, with all +# terms having a customer_id, equal to the relations object_id_two. +# Question: Should it be possible to to display all glossars +# owned by the relations object_id_two (custommer_id) including all +# terms as well? + + + +# This lib file deals with 1. and 2. only. + +# No actions just a list of glossars + +#set actions [list "[_ glossar.New_Lecture]" [export_vars -base "${base_url}/glossar-add" {owner_id gl_translation_p }] "[_ glossar.New_Lecture]"] + +set gl_translation_p 1 + +#lappend actions "[_ glossar.New_Translation]" [export_vars -base "${base_url}/glossar-add" {owner_id gl_translation_p }] "[_ glossar.Add_New_Translation]" + + +set row_list [list name title description source_category target_category glossar_edit glossar_files] + +# Just check permission on the first owner_id (the current customer) +set no_perm_p 0 + +if [permission::permission_p -object_id $customer_id -privilege admin] { + +} elseif {[permission::permission_p -object_id $customer_id -privilege create]} { + + set user_perm create + +} elseif {[permission::permission_p -object_id $customer_id -privilege read]} { + + set actions "" + set row_list [list name title description source_category target_category] + +} else { + + set no_perm_p 1 + set no_perm "You don't have Permission to read Glossars !" + + +} + +set owner_id 0 +if {$no_perm_p == 0} { + +template::list::create \ + -name gl_glossar_portlet \ + -key glossar_id \ + -no_data "[_ glossar.None]" \ + -selected_format $gl_format \ + -pass_properties {customer_id owner_ids edit_link } \ + -elements { + name { + label {[_ glossar.Organization_Name]} + display_template "@gl_glossar_portlet.name@" + } + title { + label {[_ glossar.Title]} + display_template "@gl_glossar_portlet.title@" + } + description { + label {[_ glossar.glossar_description]} + } + source_category { + label {[_ glossar.glossar_source_category_header]} + } + target_category { + label {[_ glossar.glossar_target_category]} + } + glossar_edit { + display_template "[_ acs-kernel.common_Edit]" + } + glossar_files { + display_template "[_ glossar.Files]" + } + + } -actions $actions -sub_class narrow \ + -orderby { + default_value title + glossar_id { + label {[_ glossar.glossar_id]} + orderby_desc {sort_key asc , glossar_id desc} + orderby_asc {sort_key asc , glossar_id asc} + default_direction desc + } + title { + label {[_ glossar.glossar_title]} + orderby_desc {sort_key asc , title desc} + orderby_asc {sort_key asc , title asc} + default_direction asc + } + } -orderby_name orderby \ + -filters { + customer_id {} + edit_link {} + } \ + -formats { + normal { + label "[_ glossar.Table]" + layout table + elements $row_list + } + csv { + label "[_ glossar.CSV]" + output csv + page_size 0 + row + } + } + + +set static_customer_id $customer_id + +db_multirow -extend {source_category target_category gl_translation_p glossar_edit glossar_files files_url edit_url title_url new_glossar} gl_glossar_portlet gl_glossar_portlet {} { + if {![empty_string_p $target_category_id]} { + set gl_translation_p 1 + } else { + set gl_translation_p 0 + } + set glossar_edit "[_ glossar.glossar_Edit]" + set glossar_files "[_ glossar.files]" + set source_category "[category::get_name $source_category_id]" + set target_category "[category::get_name $target_category_id]" + set title_url "[export_vars -base "${base_url}/glossar-term-list" {glossar_id gl_translation_p customer_id owner_id}]" + set edit_url "[export_vars -base "${base_url}/glossar-add" {owner_id glossar_id gl_translation_p }]" + set files_url "[export_vars -base "${base_url}/glossar-file-upload" {glossar_id}]" + if {$customer_id == $owner_id} { + set new_glossar "[export_vars -base "${base_url}/index" {owner_id}]" + } else { + set new_glossar "[export_vars -base "${base_url}/index" {owner_id customer_id}]" + } +} if_no_rows { + + +} + +} \ No newline at end of file Index: openacs-4/packages/glossar/lib/glossar-portlet-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-portlet-list.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-portlet-list.xql 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,33 @@ + + + + + + + + + + + + + SELECT cr.item_id as glossar_id , crr.title , crr.description , gl.source_category_id , gl.target_category_id , gl.owner_id, org.name , 1 as query_number , +case when gl.target_category_id is null then 0 else 1 end as sort_key + FROM gl_glossars gl, cr_items cr, cr_revisions crr , organizations org + WHERE cr.latest_revision = crr.revision_id + AND crr.revision_id = gl.glossar_id + AND gl.owner_id = org.organization_id + AND org.organization_id = :customer_id + UNION + SELECT cr.item_id as glossar_id , crr.title , crr.description , gl.source_category_id , gl.target_category_id , gl.owner_id, org.name , 2 as query_number , +case when gl.target_category_id is null then 0 else 1 end as sort_key + FROM gl_glossars gl, cr_items cr, cr_revisions crr, organizations org + WHERE cr.latest_revision = crr.revision_id + AND crr.revision_id = gl.glossar_id + AND gl.owner_id = org.organization_id + AND org.organization_id IN ('$where_etat_ids') + ORDER BY query_number asc , + [template::list::orderby_clause -name gl_glossar_portlet] + + + + \ No newline at end of file Index: openacs-4/packages/glossar/lib/glossar-term-list-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-term-list-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-term-list-postgresql.xql 20 Aug 2005 09:37:50 -0000 1.1 @@ -0,0 +1,45 @@ + + + + + + + + + + + + + SELECT crr.item_id as term_id, cr.parent_id as glossar_id , crr.description , glt.source_text , glt.target_text , glt.dont_text , aco.creation_user , to_char(aco.last_modified , 'DD.MM.YY HH24:MI') as last_modified , p.first_names , p.last_name + FROM gl_glossar_terms glt, cr_items cr, cr_revisions crr , acs_objects aco , persons p + WHERE cr.latest_revision = crr.revision_id + AND crr.revision_id = glt.term_id + AND crr.revision_id = aco.object_id + AND aco.creation_user = p.person_id + AND cr.parent_id = :glossar_id + $where_customer_id + [template::list::filter_where_clauses -and -name gl_term] + $where_format [template::list::page_where_clause -name gl_term] + [template::list::orderby_clause -orderby -name gl_term] + + + + + + SELECT crr.item_id + FROM cr_items cr, cr_revisions crr , gl_glossar_terms glt, acs_objects aco , persons p + WHERE cr.latest_revision = crr.revision_id + AND crr.revision_id = glt.term_id + AND crr.revision_id = aco.object_id + AND aco.creation_user = p.person_id + AND cr.parent_id = :glossar_id + [template::list::filter_where_clauses -and -name gl_term] + + + + + + postgresql + 7.2 + + Index: openacs-4/packages/glossar/lib/glossar-term-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-term-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-term-list.adp 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,10 @@ + +
+ Search:
+ + @hidden_vars;noquote@ + + +
+ + Index: openacs-4/packages/glossar/lib/glossar-term-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-term-list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-term-list.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,256 @@ +# packages/glossar/lib/glossar-term-list.tcl +# +# Lists all Terms from one Glossar +# +# @author Bjoern Kiesbye (bjoern_kiesbye@web.de) +# @creation-date 2005-07-10 +# @arch-tag: beb88796-955e-4cbd-af5e-3919597c7ed1 +# @cvs-id $Id: glossar-term-list.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ + +foreach required_param {glossar_id gl_translation_p searchterm customer_id owner_id} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} +foreach optional_param {page orderby format customer_id} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + + + +if {![info exists format]} { + set format "normal" +} + +if {![info exists page_size]} { + set page_size "25" +} + + + + +if [empty_string_p "[ad_conn user_id]"] { + ad_redirect_for_registration +} + + +if {$gl_translation_p == 1} { + + if {$format == "normal"} { + set row_list [list source_text target_text dont_text description last_modified first_names last_name term_id] + } else { + set row_list [list source_text {} target_text {} dont_text {} description {} last_modified {} first_names {} last_name {}] + } + + set source_text_lable [_ glossar.glossar_source_text] + set actions [list "[_ glossar.glossar_New_term]" [export_vars -base glossar-term-add {glossar_id gl_translation_p owner_id customer_id}] "[_ glossar.glossar_New_term]" ] + +} else { + + if {$format == "normal"} { + set row_list [list source_text dont_text description last_modified first_names last_name term_id] + } else { + set row_list [list source_text {} dont_text {} description {} last_modified {} first_names {} last_name {} ] + } + set source_text_lable [_ glossar.glossar_singel_text] + set actions [list "[_ glossar.glossar_New_term]" [export_vars -base glossar-term-add {glossar_id gl_translation_p owner_id customer_id}] "[_ glossar.glossar_New_term]"] + +} + + + +if [permission::permission_p -object_id $owner_id -privilege admin] { + + set cur_format $format + if {$format == "normal"} { + + set where_format " AND " + set format "csv" + lappend actions "[_ glossar.glossar_Format_CSV]" [export_vars -base glossar-term-list {glossar_id gl_translation_p format owner_id customer_id}] "[_ glossar.glossar_New2]" + + } else { + + set where_format " " + set format "normal" + lappend actions "[_ glossar.glossar_Format_Normal]" [export_vars -base glossar-term-list {glossar_id gl_translation_p format customer_id}] "[_ glossar.glossar_New2]" + + } + + + set format $cur_format + +} elseif {[permission::permission_p -object_id $owner_id -privilege create]} { + set actions $actions + set where_format " AND " + +} elseif {[permission::permission_p -object_id $owner_id -privilege read]} { + + set actions "" + set where_format " AND " + +} else { + ad_return_forbidden "No Permission!" "You don't have Permission to read Glossars !" + ad_script_abort +} + + + + + + +# Build search_clause + +set search_term_types [list source_text target_text dont_text p.first_names p.last_name] +if [exists_and_not_null searchterm] { + + # Split the search terms and connect them + foreach term [split $searchterm] { + foreach term_type $search_term_types { + lappend search_where_list "lower($term_type) like lower('%$term%')" + } + } + + set search_where_clause "([join $search_where_list " or "])" +} else { + set search_where_clause "" +} + + +if { [empty_string_p $customer_id] } { + + set where_customer_id " " + +} else { + + set where_customer_id " AND glt.owner_id = $customer_id " + +} + + + +ns_log notice "FORMAT 3: $format" + +template::list::create \ + -name gl_term \ + -multirow gl_term \ + -key crr.item_id \ + -no_data "[_ glossar.term_None]" \ + -selected_format $format \ + -pass_properties {glossar_id customer_id owner_id} \ + -elements { + source_text { + label {"$source_text_lable"} + display_template "@gl_term.source_text@" + } + target_text { + label {[_ glossar.glossar_target_text]} + display_template "@gl_term.target_text@" + } + dont_text { + label {[_ glossar.glossar_dont_text]} + display_template "@gl_term.dont_text@" + } + description { + label {[_ glossar.glossar_description]} + } + last_modified { + label {[_ glossar.glossar_last_modified]} + } + first_names { + label {[_ glossar.glossar_first_names]} + link_url_eval {[acs_community_member_url -user_id $creation_user]} + } + last_name { + label {[_ glossar.glossar_last_name]} + link_url_eval {[acs_community_member_url -user_id $creation_user]} + } + term_id { + label {[_ glossar.glossar_term_edit]} + display_template "[_ glossar.glossar_term_edit]" + } + } -actions $actions -sub_class narrow \ + -orderby_name orderby \ + -orderby { + default_value source_text + source_text { + label {$source_text_lable} + orderby_desc {glt.source_text desc} + orderby_asc {glt.source_text asc} + default_direction asc + } + target_text { + label {[_ glossar.glossar_target_text]} + orderby_desc {glt.target_text desc} + orderby_asc {glt.target_text asc} + default_direction asc + } + dont_text { + label {[_ glossar.glossar_dont_text]} + orderby_desc {glt.dont_text desc} + orderby_asc {glt.dont_text asc} + default_direction asc + } + last_modified { + label {[_ glossar.glossar_last_modified]} + orderby_desc {aco.last_modified desc} + orderby_asc {aco.last_modified asc} + default_direction asc + } + first_names { + label {[_ glossar.glossar_first_names]} + orderby_desc {p.first_names desc} + orderby_asc {p.first_names asc} + default_direction asc + } + last_name { + label {[_ glossar.glossar_last_name]} + orderby_desc {p.last_name desc} + orderby_asc {p.last_name asc} + default_direction asc + } + } -filters { + glossar_id {} + gl_translation_p {} + customer_id {} + searchterm { + label "[_ glossar.glossar_term_search]" + where_clause $search_where_clause + } + } -page_size_variable_p 0 \ + -page_size 10 \ + -page_flush_p t \ + -page_query_name gl_term_page \ + -formats { + normal { + label "[_ glossar.Table]" + layout table + elements $row_list + } + csv { + label "[_ glossar.CSV]" + output csv + page_size 0 + row $row_list + + } + } + + + +# This elements will be added at least + + +# May add extra order_by clause + +set hidden_vars [export_vars -form {glossar_id gl_translation_p orderby format page owner_id customer_id }] +db_multirow -extend {gl_translation_p} gl_term gl_term {} { + if {![empty_string_p $target_text]} { + set gl_translation_p 1 + } else { + set gl_translation_p 0 + } +} if_no_rows {} + +template::list::write_output -name gl_term \ No newline at end of file Index: openacs-4/packages/glossar/lib/glossar-term-rev-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-term-rev-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-term-rev-list.adp 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,10 @@ + +
+ Search:
+ + @hidden_vars;noquote@ + + +
+ + Index: openacs-4/packages/glossar/lib/glossar-term-rev-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-term-rev-list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-term-rev-list.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,183 @@ +# packages/glossar/lib/glossar-term-rev-list.tcl +# +# Lists all revisions of one Term +# +# @author Bjoern Kiesbye (bjoern_kiesbye@web.de) +# @creation-date 2005-07-15 +# @arch-tag: ebb70c9d-b79d-4db8-9a77-ad97244684fe +# @cvs-id $Id: glossar-term-rev-list.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ + + + +foreach required_param {glossar_id term_id gl_translation_p searchterm} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} +foreach optional_param {page orderby} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + + + +if {![info exists format]} { + set format "normal" +} + +if {![info exists page_size]} { + set page_size "25" +} + + + + + +if {$gl_translation_p == 1} { + + set row_list [list source_text target_text dont_text description last_modified first_names last_name ] + set source_text_lable [_ glossar.glossar_source_text] + set actions "" + +} else { + + set row_list [list source_text dont_text description last_modified first_names last_name ] + set source_text_lable [_ glossar.glossar_singel_text] + set actions "" + +} + + + +# Build search_clause + +set search_term_types [list source_text target_text dont_text p.first_names p.last_name] +if [exists_and_not_null searchterm] { + + # Split the search terms and connect them + foreach term [split $searchterm] { + foreach term_type $search_term_types { + lappend search_where_list "lower($term_type) like lower('%$term%')" + } + } + + set search_where_clause "([join $search_where_list " or "])" +} else { + set search_where_clause "" +} + + + + +template::list::create \ + -name gl_term_rev \ + -multirow gl_term_rev \ + -key crr.revision_id \ + -no_data "[_ glossar.term_None]" \ + -selected_format normal \ + -pass_properties {glossar_id} \ + -elements { + source_text { + label {"$source_text_lable"} + } + target_text { + label {[_ glossar.glossar_target_text]} + } + dont_text { + label {[_ glossar.glossar_dont_text]} + } + description { + label {[_ glossar.glossar_comment]} + } + last_modified { + label {[_ glossar.glossar_modified_at]} + } + first_names { + label {[_ glossar.glossar_first_names]} + link_url_eval {[acs_community_member_url -user_id $creation_user]} + } + last_name { + label {[_ glossar.glossar_last_name]} + link_url_eval {[acs_community_member_url -user_id $creation_user]} + } + } -actions $actions -sub_class narrow \ + -orderby_name orderby \ + -orderby { + default_value source_text + source_text { + label {$source_text_lable} + orderby_desc {glt.source_text desc} + orderby_asc {glt.source_text asc} + default_direction asc + } + target_text { + label {[_ glossar.glossar_target_text]} + orderby_desc {glt.target_text desc} + orderby_asc {glt.target_text asc} + default_direction asc + } + dont_text { + label {[_ glossar.glossar_dont_text]} + orderby_desc {glt.dont_text desc} + orderby_asc {glt.dont_text asc} + default_direction asc + } + last_modified { + label {[_ glossar.glossar_modified_at]} + orderby_desc {aco.last_modified desc} + orderby_asc {aco.last_modified asc} + default_direction asc + } + first_names { + label {[_ glossar.glossar_first_names]} + orderby_desc {p.first_names desc} + orderby_asc {p.first_names asc} + default_direction asc + } + last_name { + label {[_ glossar.glossar_last_name]} + orderby_desc {p.last_name desc} + orderby_asc {p.last_name asc} + default_direction asc + } + } -filters { + glossar_id {} + gl_translation_p {} + term_id {} + searchterm { + label "[_ glossar.glossar_term_search]" + where_clause $search_where_clause + } + } -page_size_variable_p 0 \ + -page_size 10 \ + -page_flush_p 1 \ + -page_query_name gl_term_rev_page \ + -formats { + normal { + label "[_ glossar.Table]" + layout table + elements $row_list + } + csv { + label "[_ glossar.CSV]" + output csv + page_size 2 + elements $row_list + } + } + + +# This elements will be added at least + + +# May add extra order_by clause + +set hidden_vars [export_vars -form {glossar_id gl_translation_p orderby format page term_id}] +db_multirow -extend {gl_translation_p} gl_term_rev gl_term_rev {} { + if {![empty_string_p $target_text]} { + set gl_translation_p 1 + } else { + set gl_translation_p 0 + } +} if_no_rows {} \ No newline at end of file Index: openacs-4/packages/glossar/lib/glossar-term-rev-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/lib/glossar-term-rev-list.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/lib/glossar-term-rev-list.xql 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + SELECT crr.item_id as term_id, crr.revision_id , crr.description , glt.source_text , glt.target_text , glt.dont_text, aco.creation_user , to_char(aco.last_modified , 'DD.MM.YY HH24:MI') as last_modified , p.first_names , p.last_name + FROM gl_glossar_terms glt, cr_revisions crr, cr_items cr, acs_objects aco, persons p + WHERE crr.item_id = :term_id + AND crr.revision_id = glt.term_id + AND crr.item_id = cr.item_id + AND aco.object_id = crr.revision_id + AND aco.creation_user = p.person_id + [template::list::filter_where_clauses -and -name gl_term_rev] + AND [template::list::page_where_clause -name gl_term_rev] + [template::list::orderby_clause -orderby -name gl_term_rev] + + + + + + SELECT crr.revision_id + FROM cr_revisions crr , gl_glossar_terms glt, acs_objects aco , persons p + WHERE crr.item_id = :term_id + AND crr.revision_id = glt.term_id + AND crr.revision_id = aco.object_id + AND aco.creation_user = p.person_id + [template::list::filter_where_clauses -and -name gl_term_rev] + + + + \ No newline at end of file Index: openacs-4/packages/glossar/sql/postgresql/glossar-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/sql/postgresql/glossar-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/sql/postgresql/glossar-create.sql 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,37 @@ +-- +-- packages/glossar/sql/postgresql/glossar-create.sql +-- +-- @author Bjoern Kiesbye (bjoern_kiesbye@web.de) +-- @creation-date 2005-07-06 +-- @arch-tag: 5c4aea57-93be-49c1-bb0e-97b9cc541ac0 +-- @cvs-id $Id: glossar-create.sql,v 1.1 2005/08/20 09:37:51 maltes Exp $ +-- + + + +-- Create both Tables gl_glossars and gl_glossar_terms + + + +create table gl_glossars ( + glossar_id integer primary key references acs_objects(object_id), + owner_id integer not null references acs_objects(object_id), + source_category_id integer not null references categories(category_id), + target_category_id integer default null references categories(category_id) + ); + + + + + +create table gl_glossar_terms ( + term_id integer primary key, + owner_id integer references acs_objects, + source_text varchar(4000) default null, + target_text varchar(4000) default null, + dont_text varchar(4000) default null + ); + + + + Index: openacs-4/packages/glossar/sql/postgresql/glossar-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/sql/postgresql/glossar-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/sql/postgresql/glossar-drop.sql 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,11 @@ +-- +-- packages/glossar/sql/postgresql/glossar-drop.sql +-- +-- @author Bjoern Kiesbye (bjoern_kiesbye@web.de) +-- @creation-date 2005-07-09 +-- @arch-tag: 209976a0-90db-4759-933c-b50559fd799e +-- @cvs-id $Id: glossar-drop.sql,v 1.1 2005/08/20 09:37:51 maltes Exp $ +-- + +drop table gl_glossar_terms; +drop table gl_glossars; Index: openacs-4/packages/glossar/tcl/glossar-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/tcl/glossar-install-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/tcl/glossar-install-procs.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,49 @@ +# packages/glossar/tcl/glossar-install-procs.tcl + +ad_library { + + + + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-07-13 + @arch-tag: 52912475-f200-4cac-a89f-c4db0e7df38c + @cvs-id $Id: glossar-install-procs.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ +} + + + +namespace eval gl_glossar::install {} + +ad_proc -public gl_glossar::install::create_install { +} { + Creates the content types and adds the attributes. +} { + content::type::new -content_type {gl_glossar} -supertype {content_revision} -pretty_name {[_ glossar.Glossar]} -pretty_plural {[_ glossar.Glossars]} -table_name {gl_glossars} -id_column {glossar_id} + content::type::new -content_type {gl_glossar_term} -supertype {content_revision} -pretty_name {[_ glossar.Glossar_Term]} -pretty_plural {[_ glossar.Glossar_Terms]} -table_name {gl_glossar_terms} -id_column {term_id} + + # Glossar attribs + content::type::attribute::new -content_type {gl_glossar} -attribute_name {owner_id} -datatype {number} -pretty_name {[_ glossar.glossar_owner]} -column_spec {interger} + content::type::attribute::new -content_type {gl_glossar} -attribute_name {source_category_id} -datatype {number} -pretty_name {[_ glossar.glossar_source_category]} -column_spec {interger} + content::type::attribute::new -content_type {gl_glossar} -attribute_name {target_category_id} -datatype {number} -pretty_name {[_ glossar.glossar_target_category]} -column_spec {interger} + +# Glossar Term Attribs. + + content::type::attribute::new -content_type {gl_glossar_term} -attribute_name {source_text} -datatype {string} -pretty_name {[_ glossar.glossar_source_text]} -column_spec {varchar(4000)} + content::type::attribute::new -content_type {gl_glossar_term} -attribute_name {target_text} -datatype {string} -pretty_name {[_ glossar.glossar_target_text]} -column_spec {varchar(4000)} + content::type::attribute::new -content_type {gl_glossar_term} -attribute_name {dont_text} -datatype {string} -pretty_name {[_ glossar.glossar_dont_text]} -column_spec {varchar(4000)} + content::type::attribute::new -content_type {gl_glossar_term} -attribute_name {owner_id} -datatype {number} -pretty_name {[_ glossar.glossar_customer_id]} -column_spec {integer} + +} + +ad_proc -public gl_glossar::install::package_instantiate { + -package_id:required +} { + Define folders +} { + # create a content folder + set folder_id [content::folder::new -name "glossar_$package_id" -package_id $package_id] + # register the allowed content types for a folder + content::folder::register_content_type -folder_id $folder_id -content_type {gl_glossar} -include_subtypes t + content::folder::register_content_type -folder_id $folder_id -content_type {gl_glossar_term} -include_subtypes t + +} \ No newline at end of file Index: openacs-4/packages/glossar/tcl/glossar-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/tcl/glossar-portlet-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/tcl/glossar-portlet-procs.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,124 @@ +# +# Copyright (C) 2005 Cognovis +# Author: Bjoern Kiesbye (kiesbye@theservice.de) + +# This file is part of dotLRN. +# +# dotLRN is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + +ad_library { + + Procedures to support the Glossar Package + + + @author kiesbye@theservice.de + @cvs-id $Id: glossar-portlet-procs.tcl + +} + +namespace eval glossar_portlet { + + ad_proc -private my_package_key { + } { + return "glossar-portlet" + } + + ad_proc -private get_my_name { + } { + return "glossar_portlet" + } + + ad_proc -public get_pretty_name { + } { + return "Glossar Portlet" + } + + ad_proc -public link { + } { + return [site_node::get_package_url -package_key glossar] + } + + ad_proc -public add_self_to_page { + {-portal_id:required} + {-package_id:required} + {-param_action "overwrite"} + {-page_name ""} + {-pretty_name ""} + {-force_region ""} + {-scoped_p ""} + + } { + Adds a Contact Portlet to the given page. + + @param portal_id The page to add self to + @return element_id The new element's id + + } { + + # allow overrides of pretty_name and force_region + if {[empty_string_p $pretty_name]} { + set pretty_name [get_pretty_name] + } + + if {[empty_string_p $force_region]} { + set force_region [parameter::get_from_package_key \ + -package_key [my_package_key] \ + -parameter "force_region" + ] + } + + set extra_params "" + + + return [portal::add_element_parameters \ + -portal_id $portal_id \ + -page_name $page_name \ + -portlet_name [get_my_name] \ + -value $package_id \ + -pretty_name $pretty_name \ + -force_region $force_region \ + -param_action $param_action + + ] + } + + + + + ad_proc -public remove_self_from_page { + {-portal_id:required} + + } { + Removes a Contacts Portlet from the given page. + + @param portal_id The page to remove self from + @param project_manager_id + } { + portal::remove_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + } + + + + ad_proc -public show { + cf + } { + } { + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src glossar-list + + } + +} Index: openacs-4/packages/glossar/tcl/glossar-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/tcl/glossar-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/tcl/glossar-procs-postgresql.xql 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,75 @@ + + + + + + + + + + + + SELECT gl_glossar__new( + null , + :owner_id , + :title , + :comment , + :source_category_id , + :target_category_id , + 'gl_glossar' , + current_timestamp , + :user_id , + '' , + null , + :package_id + ) as glossar_id + + + + + + UPDATE gl_glossars + SET + title = :title , + comment = :comment , + source_category_id = :source_category_id , + target_category_id = :target_category_id + WHERE glossar_id = :glossar_id + + + + + + SELECT gl_glossar_term__new(null, :glossar_id , :comment , :source_text , :target_text , :dont_text , null , current_timestamp , :user_id , :user_ip , null , :package_id ) as term_id + + + + + + UPDATE acs_objects + SET modifying_user = :user_id , + last_modified = current_timestamp + WHERE acs_object_id = :term_id + + + + + + UPDATE gl_glossar_terms + SET + source_text = :source_text , + target_text = :target_text , + dont_text = :dont_text , + comment = :comment + WHERE term_id = :term_id + + + + + + + + postgresql + 7.2 + + Index: openacs-4/packages/glossar/tcl/glossar-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/tcl/glossar-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/tcl/glossar-procs.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,175 @@ +# packages/glossar/tcl/glossar-procs.tcl + +ad_library { + + + + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-07-06 + @arch-tag: b4f83a02-5128-4d28-a681-b73b7ffdb205 + @cvs-id $Id: glossar-procs.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ +} + + +namespace eval gl_glossar {} + +ad_proc -public gl_glossar::new { + + -owner_id:required + -source_category_id:required + {-name ""} + {-package_id ""} + {-title ""} + {-description ""} + {-target_category_id [db_null]} + + +} { + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-07-13 + + New Glossar +} { + if {[empty_string_p $package_id]} { + set package_id [ad_conn package_id] + } + set folder_id [content::folder::get_folder_from_package -package_id $package_id] + + db_transaction { + set item_id [db_nextval acs_object_id_seq] + if {[empty_string_p $name]} { + set name "gl_glossar_$item_id" + } + set item_id [content::item::new -parent_id $folder_id -content_type {gl_glossar} -name $name -package_id $package_id -item_id $item_id] + + set new_id [content::revision::new \ + -item_id $item_id \ + -content_type {gl_glossar} \ + -title $title \ + -description $description \ + -attributes [list \ + [list owner_id $owner_id] \ + [list source_category_id $source_category_id] \ + [list target_category_id $target_category_id] \ + ] ] + } + + return $new_id +} + + +ad_proc -public gl_glossar::edit { + -glossar_item_id:required + -owner_id:required + -source_category_id:required + -target_category_id:required + {-title ""} + {-name ""} + {-description ""} +} { + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-13-07 + + Edit Glossar +} { + db_transaction { + set new_rev_id [content::revision::new \ + -item_id $glossar_item_id \ + -content_type {gl_glossar} \ + -title $title \ + -description $description \ + -attributes [list \ + [list owner_id $owner_id] \ + [list source_category_id $source_category_id] \ + [list target_category_id $target_category_id] \ + ] ] + } + + return $new_rev_id +} + + + + +ad_proc -public gl_glossar::term_new { + -glossar_id:required + {-term_id ""} + {-source_text ""} + {-target_text ""} + {-dont_text ""} + {-comment ""} + {-name ""} + {-package_id ""} + {-title ""} + {-description ""} + {-customer_id ""} + +} { + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-07-13 + + New Glossar Term +} { + if {[empty_string_p $package_id]} { + set package_id [ad_conn package_id] + } + + + db_transaction { + set item_id [db_nextval acs_object_id_seq] + if {[empty_string_p $name]} { + set name "gl_glossar_term_$item_id" + } + set item_id [content::item::new -parent_id $glossar_id -content_type {gl_glossar_term} -name $name -package_id $package_id -item_id $item_id] + + set new_id [content::revision::new \ + -item_id $item_id \ + -content_type {gl_glossar_term} \ + -title $title \ + -description $description \ + -attributes [list \ + [list source_text $source_text] \ + [list target_text $target_text] \ + [list dont_text $dont_text] \ + [list owner_id $customer_id] \ + ] ] + } + + return $new_id +} + + + +ad_proc -public gl_glossar::term_edit { + -term_id:required + {-source_text ""} + {-target_text ""} + {-dont_text ""} + {-title ""} + {-name ""} + {-description ""} + {-customer_id ""} + +} { + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-13-07 + + Edit Glossar Term +} { + db_transaction { + set new_rev_id [content::revision::new \ + -item_id $term_id \ + -content_type {gl_glossar_term} \ + -title $title \ + -description $description \ + -attributes [list \ + [list source_text $source_text] \ + [list target_text $target_text] \ + [list dont_text $dont_text] \ + [list owner_id $customer_id] + ] ] + } + + return $new_rev_id +} + Index: openacs-4/packages/glossar/tcl/term-list-notes.txt =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/tcl/term-list-notes.txt,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/tcl/term-list-notes.txt 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,25 @@ + + SELECT crr.revision_id as term_id, cr.parent_id as glossar_id , crr.description , glt.source_text , glt.target_text , glt.dont_text , aco.modifying_user , aco.last_modified , p.first_names , p.last_name + FROM gl_glossar_terms glt, cr_items cr, cr_revisions crr, acs_objects aco , persons p + WHERE cr.latest_revision = crr.revision_id + AND crr.revision_id = glt.term_id + AND glt.term_id = aco.object_id + AND aco.modifying_user = p.person_id + AND cr.parent_id = :glossar_id + [template::list::filter_where_clauses -and -name gl_term] + AND [template::list::page_where_clause -name gl_term] + [template::list::orderby_clause -orderby -name gl_term] + + + + first_names { + label {[_ glossar.glossar_creation_user_first_names]} + link_url_eval {[export_vars -base "/user" {glossar_id gl_translation_p modifying_user}]} + } + last_name { + label {[_ glossar.glossar_creation_user_last_name]} + link_url_eval {[export_vars -base "/user" {glossar_id gl_translation_p modifying_user}]} + } + last_modified { + label {[_ glossar.glossar_creation_date]} + } \ No newline at end of file Index: openacs-4/packages/glossar/www/glossar-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-add.adp 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,5 @@ + + @page_title@ + @context@ + + \ No newline at end of file Index: openacs-4/packages/glossar/www/glossar-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-add.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,116 @@ +# packages/glossar/www/glossar-add.tcl + +ad_page_contract { + + Adding a Glossar to a Eta/User + + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-07-09 + @arch-tag: 10d0e2ec-fadc-4495-9d10-faa00b8eb5d3 + @cvs-id $Id: glossar-add.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ +} { + owner_id:notnull + glossar_id:optional + gl_translation_p:notnull + {customer_id ""} +} -properties { +} -validate { +} -errors { +} + +if {$gl_translation_p == 1} { + if {[exists_and_not_null glossar_id]} { + set context "translation-edit" + set page_title "[_ glossar.Edit_Translation]" + } else { + set context "translation-add" + set page_title "[_ glossar.New_Translation]" + } +} else { + if {[exists_and_not_null glossar_id]} { + set context "glossar-edit" + set page_title "[_ glossar.Edit_Glossar]" + } else { + set context "glossar-add" + set page_title "[_ glossar.Add_new_Glossar]" + } +} +acs_object::get -object_id $owner_id -array owner +set package_id $owner(package_id) + + +set source_tree_id [category_tree::get_id "#acs-translations.cat_tree_wieners_from#"] +set target_tree_id [category_tree::get_id "#acs-translations.cat_tree_wieners_to#"] + + +ad_form -name glossar-add -export {owner_id package_id gl_translation_p customer_id} -form { + {glossar_id:key} + {title:text(text) {label "[_ glossar.Title]"} } + {description:text(textarea),optional {label "[_ glossar.Comment]"} {html{rows 4 cols 30} }} + + +} + + + + +if {$gl_translation_p == 1} { + + ad_form -extend -name glossar-add -form { + + {source_category_id:integer(category) {label "[_ glossar.glossar_source_category]"} {category_tree_id $source_tree_id} {assign_single_p t} {require_category_p t} {html {size 4}} } + + {target_category_id:integer(category) {label "[_ glossar.glossar_target_category]"} {category_tree_id $target_tree_id} {assign_single_p t} {require_category_p f}} + + } + + +} else { + + + ad_form -extend -name glossar-add -form { + + {source_category_id:integer(category) {label "[_ glossar.glossar_single_category]"} {category_tree_id $source_tree_id} {assign_single_p t} {require_category_p t} {html {size 4}} } + + {target_category_id:text(hidden) {value "[db_null]"}} + + } + +} + + + + +ad_form -extend -name glossar-add \ +-new_request { + set source_category_id "" + set target_category_id "" + set description "" + set title "" +} -edit_request { + + db_1row get_glossar { + SELECT crr.title , crr.description , gl.source_category_id , gl.target_category_id , gl.owner_id + FROM gl_glossars gl, cr_items cr, cr_revisions crr + WHERE cr.latest_revision = crr.revision_id + AND crr.revision_id = gl.glossar_id + AND cr.item_id = :glossar_id + } + + +} -new_data { + + if {![info exists target_category_id]} { + set target_category_id [db_null] + } + + gl_glossar::new -owner_id $owner_id -title "$title" -description "$description" -source_category_id $source_category_id -target_category_id $target_category_id -package_id $package_id + +} -edit_data { + + gl_glossar::edit -glossar_item_id $glossar_id -title "$title" -description "$description" -source_category_id $source_category_id -target_category_id $target_category_id -owner_id $owner_id + +} -after_submit { + ad_returnredirect [export_vars -base index {gl_translation_p glossar_id customer_id owner_id}] + ad_script_abort +} Index: openacs-4/packages/glossar/www/glossar-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-delete.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,19 @@ +ad_page_contract { + + Update sort order + + @author Matthew Geddert openacs@geddert.com + @creation-date 2005-05-24 + @cvs-id $Id: glossar-delete.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ + +} { + item_id:multiple,notnull + glossar_id +} + +db_transaction { + foreach item_id $item_id { + db_dml expire_item { update cr_items set publish_status = 'expired', live_revision = NULL where item_id = :item_id } + } +} +ad_returnredirect "glossar-file-upload?glossar_id=$glossar_id" Index: openacs-4/packages/glossar/www/glossar-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-edit.adp 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,5 @@ + + Change Glossar + + + \ No newline at end of file Index: openacs-4/packages/glossar/www/glossar-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-edit.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,46 @@ +# packages/glossar/www/glossar-edit.tcl + +ad_page_contract { + + Change a Glossar + + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-07-09 + @arch-tag: 5ca20456-b64a-46c0-8adf-f03a8b28a081 + @cvs-id $Id: glossar-edit.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ +} { + glossar_id:notnull + +} -properties { + +} -validate { +} -errors { +} + + +db_1row get_glossar "SELECT title as old_title, comment as old_comment , source_category_id , target_category_id , owner_id FROM gl_glossars WHERE glossar_id = :glossar_id" + + + + + +ad_form -name glossar-edit -form { + + {title:text(text) {lable "[_ glossar.glossar_title]"} {value "$old_title"} } + {comment:text(textarea),optional {lable "[_ glossar.glossar_comment]"} {value "$old_comment"} {html{rows 4 cols 30} }} + {glossar_id:integer(hidden) {value $glossar_id}} + + {source_category_id:text(hidden) {value "$source_category_id"}} + {target_category_id:text(hidden) {value "$target_category_id"}} + {owner_id:key} + +} -edit_data { + + gl_glossar::edit -glossar_id $glossar_id -title "$title" -comment "$comment" -source_category_id $source_category_id -target_category_id $target_category_id -owner_id $owner_id +} -edit_request {} + + + + + + Index: openacs-4/packages/glossar/www/glossar-file-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-file-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-file-delete.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,19 @@ +ad_page_contract { + + Update sort order + + @author Matthew Geddert openacs@geddert.com + @creation-date 2005-05-24 + @cvs-id $Id: glossar-file-delete.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ + +} { + item_id:multiple,notnull + glossar_id +} + +db_transaction { + foreach item_id $item_id { + db_dml expire_item { update cr_items set publish_status = 'expired', live_revision = NULL where item_id = :item_id } + } +} +ad_returnredirect "glossar-file-upload?glossar_id=$glossar_id" Index: openacs-4/packages/glossar/www/glossar-file-update.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-file-update.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-file-update.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,41 @@ +ad_page_contract { + + Update sort order + + @author Matthew Geddert openacs@geddert.com + @creation-date 2005-05-24 + @cvs-id $Id: glossar-file-update.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ + +} { + rename:array + glossar_id:integer,notnull +} + +set item_ids [db_list get_item_ids { select item_id from cr_items where parent_id = :glossar_id and publish_status = 'ready' } ] +db_transaction { + foreach item_id $item_ids { + set new_title [string trim $rename(${item_id})] + if { [exists_and_not_null new_title] } { + db_0or1row get_item_date { +select ci.name, + cr.title, + cr.mime_type, + cr.content, + cr.content_length + from cr_items ci, cr_revisions cr, acs_objects ao + where ci.parent_id = :glossar_id + and ci.live_revision = cr.revision_id + and cr.revision_id = ao.object_id + and ci.item_id = :item_id } + + if { $new_title != $title } { + set filename $name + set revision_id [content::revision::new -item_id $item_id -is_live "t" -title $new_title -mime_type $mime_type -description "jj" -creation_date now] + db_dml update_revision { update cr_revisions set content = :content, content_length = :content_length where revision_id = :revision_id } + db_dml update_item { update cr_items set name = :filename where item_id = :item_id } + } + } + + } +} +ad_returnredirect "${glossar_id}/files" Index: openacs-4/packages/glossar/www/glossar-file-upload.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-file-upload.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-file-upload.adp 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,7 @@ + + Glossar Files + glossar-file-upload + + + + Index: openacs-4/packages/glossar/www/glossar-file-upload.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-file-upload.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-file-upload.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,22 @@ +# packages/glossar/www/glossar-file-upload.tcl + +ad_page_contract { + + Uploding files for a Glossar into cr. + + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-07-21 + @arch-tag: ec515574-bf31-4d15-8a3f-536c4dca63a3 + @cvs-id $Id: glossar-file-upload.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ +} { + glossar_id:notnull + {upload_count "1"} + {order_by "file,asc"} +} -properties { + glossar_id + upload_count + order_by +} -validate { +} -errors { +} + Index: openacs-4/packages/glossar/www/glossar-term-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-term-add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-term-add.adp 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,6 @@ + + @title@ + @context@ + + + Index: openacs-4/packages/glossar/www/glossar-term-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-term-add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-term-add.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,92 @@ +# packages/glossar/www/glossar-term-add.tcl + +ad_page_contract { + + Create a new term + + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-07-09 + @arch-tag: 63950c73-d43a-4ed2-934c-46917d0798f8 + @cvs-id $Id: glossar-term-add.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ +} { + glossar_id:notnull + term_id:optional + gl_translation_p:notnull + owner_id:notnull + {customer_id ""} + {source_text ""} + {target_text ""} + {dont_text ""} + {description ""} +} -properties { +} -validate { +} -errors { +} + +set context "glossar term add" +set title "Add a Term to a Glossar" + +# Get customer_id if exist +if {[info exists term_id ]} { + db_0or1row get_customer_id {SELECT owner_id as customer_id FROM gl_glossar_terms gt , cr_items cr WHERE gt.term_id = cr.latest_revision AND cr.item_id = :term_id} +} + +ad_form -name glossar-term-add -export {glossar_id gl_translation_p owner_id customer_id} -form { + + {term_id:key} +} + +if {$gl_translation_p == 1} { + + ad_form -extend -name glossar-term-add -form { + {source_text:text(textarea),optional {label "[_ glossar.glossar_source_text]"} {html {rows 4 cols 60}}} + {target_text:text(textarea),optional {label "[_ glossar.glossar_target_text]"} {html {rows 4 cols 60}}} + + } +} else { + + ad_form -extend -name glossar-term-add -form { + {source_text:text(textarea),optional {label "[_ glossar.glossar_singel_text]"} {html {rows 4 cols 60}}} + + + } + +} + + +ad_form -extend -name glossar-term-add -form { + + {dont_text:text(textarea),optional {label "[_ glossar.glossar_dont_text]"} {html {rows 4 cols 50}}} + {description:text(textarea),optional {label "[_ glossar.glossar_description]"} {html {rows 4 cols 50}}} + +} -new_request { + + + set source_text "" + set target_text "" + set dont_text "" + set description "" + +} -edit_request { + + db_1row get_term { + SELECT crr.item_id as term_id, glt.source_text, glt.target_text, glt.dont_text, glt.owner_id as customer_id, crr.description + FROM gl_glossar_terms glt, cr_items cr , cr_revisions crr + WHERE cr.latest_revision = crr.revision_id + AND crr.revision_id = glt.term_id + AND crr.item_id = :term_id + } + +} -new_data { + + + set term_id [gl_glossar::term_new -term_id $term_id -glossar_id $glossar_id -source_text "$source_text" -target_text "$target_text" -dont_text "$dont_text" -description "$description" -customer_id "$customer_id"] + +} -edit_data { + gl_glossar::term_edit -term_id $term_id -source_text $source_text -target_text $target_text -dont_text $dont_text -description $description -customer_id $customer_id +} -after_submit { + + ad_returnredirect [export_vars -base glossar-term-list {gl_translation_p glossar_id customer_id owner_id}] + ad_script_abort +} + Index: openacs-4/packages/glossar/www/glossar-term-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-term-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-term-edit.adp 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,5 @@ + + @title@ + @context@ + + Index: openacs-4/packages/glossar/www/glossar-term-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-term-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-term-edit.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,60 @@ +# packages/glossar/www/glossar-term-edit.tcl + +ad_page_contract { + + Editing a Term + + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-07-09 + @arch-tag: eb1da800-8bcd-4f10-8ccc-12c31b902614 + @cvs-id $Id: glossar-term-edit.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ +} { + glossar_id:notnull + {source_text ""} + {target_text ""} + {dont_text ""} + {comment ""} +} -properties { +} -validate { +} -errors { +} + +set context "Edit Term" +set title "Edit Term" + +# create search clause +set where_clause "WHERE glossar_id = :glossar_id " + +if {![empty_string_p $source_text]} { + + append where_clause " AND source_text = :source_text" + +} + +if {![empty_string_p $target_text]} { + + append where_clause " AND target_text = :target_text" + +} + +if {![empty_string_p $dont_text]} { + + append where_clause " AND dont_text = :dont_text" + +} + +db_1row get_term "SELECT source_text , target_text , dont_text , comment FROM gl_glossar_terms $where_clause" + +ad_form -name edit-term -from { + + {source_text:text(textarea) {lable "[_ glossar.glossar_source_text]"} {value "$source_text" } {html {rows 4 cols 60}}} + {target_text:text(textarea) {lable "[_ glossar.glossar_target_text]"} {value "$target_text" } {html {rows 4 cols 60}}} + {dont_text:text(textarea) {lable "[_ glossar.glossar_dont_text]"} {value "$dont_text" } {html {rows 4 cols 60}}} + {comment:text(textarea) {lable "[_ glossar.glossar_comment]"} {value "$comment" } {html {rows 4 cols 60}}} + + {glossar_id:text(hidden) {value $glossar_id}} +} -edit_data { + + + gl_glossar::term_edit -glossar_id $glossar_id -source_text $source_text -target_text $target_text -dont_text $dont_text -comment $commnet +} Index: openacs-4/packages/glossar/www/glossar-term-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-term-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-term-list.adp 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,5 @@ + + Glossars + index + + \ No newline at end of file Index: openacs-4/packages/glossar/www/glossar-term-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-term-list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-term-list.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,36 @@ +# packages/glossar/www/glossar-term-list.tcl + +ad_page_contract { + + Lists all Terms from one Glossary, display differs in Common and Translation. + + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-07-10 + @arch-tag: d5403149-1be2-467e-b9f6-062dcff4a565 + @cvs-id $Id: glossar-term-list.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ +} { + glossar_id:notnull + gl_translation_p:notnull + owner_id:notnull + {page ""} + {orderby ""} + {searchterm ""} + {customer_id ""} + {format "normal"} +} -properties { + glossar_id + gl_translation_p + page + orderby + searchterm + customer_id + format + owner_id +} -validate { +} -errors { +} + +if {$customer_id == $owner_id} { + set customer_id "" +} + Index: openacs-4/packages/glossar/www/glossar-term-rev-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-term-rev-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-term-rev-list.adp 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,5 @@ + + Glossars + index + + \ No newline at end of file Index: openacs-4/packages/glossar/www/glossar-term-rev-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossar-term-rev-list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossar-term-rev-list.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,30 @@ +# packages/glossar/www/glossar-term-list.tcl + +ad_page_contract { + + Lists all revisions from one Term, display differs in Common and Translation. + + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-07-10 + @arch-tag: d5403149-1be2-467e-b9f6-062dcff4a565 + @cvs-id $Id: glossar-term-rev-list.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ +} { + glossar_id:notnull + gl_translation_p:notnull + term_id:notnull + {page ""} + {orderby ""} + {searchterm ""} +} -properties { + glossar_id + gl_translation_p + page + orderby + searchterm + term_id +} -validate { +} -errors { +} + + + Index: openacs-4/packages/glossar/www/glossary-term-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/glossary-term-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/glossary-term-list.adp 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,5 @@ + + Terms + glossar-term-list + + \ No newline at end of file Index: openacs-4/packages/glossar/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/index.adp 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,5 @@ + + Glossars + index + + \ No newline at end of file Index: openacs-4/packages/glossar/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar/www/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar/www/index.tcl 20 Aug 2005 09:37:51 -0000 1.1 @@ -0,0 +1,20 @@ +# packages/glossar/www/index.tcl + +ad_page_contract { + + Index page displays all existing glossars for agiven object_id (currently its the user_id in future it will be the eta_id ) + + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-07-09 + @arch-tag: 2581ef43-4729-4f1a-951a-8222894330e2 + @cvs-id $Id: index.tcl,v 1.1 2005/08/20 09:37:51 maltes Exp $ +} { + {owner_id ""} + {orderby ""} + {customer_id ""} + {format "normal"} +} + + + + Index: openacs-4/packages/glossar-portlet/glossar-portlet.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar-portlet/glossar-portlet.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar-portlet/glossar-portlet.info 20 Aug 2005 09:38:18 -0000 1.1 @@ -0,0 +1,28 @@ + + + + + Glossar Portlet + Glossar Portlets + f + f + + + bjoern kiesbye + Malte Sussdorff + Intigrates the Glossar Package into a Portal + Cognovis + Intigrates the Glossar Package into a Portal + 0 + + + + + + + + + + + + Index: openacs-4/packages/glossar-portlet/sql/postgresql/glossar-portlet-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar-portlet/sql/postgresql/glossar-portlet-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar-portlet/sql/postgresql/glossar-portlet-create.sql 20 Aug 2005 09:38:18 -0000 1.1 @@ -0,0 +1,220 @@ +-- +-- Copyright (C) 2001, 2002 MIT +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- /project-manager-portlet/sql/oracle/project-manager-portlet-create.sql +-- + +-- Creates Project Manager portlet + +-- Copyright (C) 2005 Cognovis +-- @author Bjoern Kiesbye (kiesbye@theservice.de) +-- @creation-date 2005-27-07 + + +-- This is free software distributed under the terms of the GNU Public +-- License version 2 or higher. Full text of the license is available +-- from the GNU Project: http://www.fsf.org/copyleft/gpl.html + +create function inline_0() +returns integer as ' +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + ds_id := portal_datasource__new( + ''glossar_portlet'', + ''Displays Glossar'' + ); + + + -- the standard 4 params + + -- shadeable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''shadeable_p'', + ''t'' +); + + + -- 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'', + ''t'' +); + + -- 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'' +); + + + perform portal_datasource__set_def_param( + ds_id, + ''t'', + ''f'', + ''scoped_p'', + ''t'' + ); + + + -- Project-Manager-specific params + + + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + -- create the implementation + foo := acs_sc_impl__new ( + ''portal_datasource'', + ''glossar_portlet'', + ''glossar_portlet'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- add all the hooks + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''glossar_portlet'', + ''GetMyName'', + ''glossar_portlet::get_my_name'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''glossar_portlet'', + ''GetPrettyName'', + ''glossar_portlet::get_pretty_name'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''glossar_portlet'', + ''Link'', + ''glossar_portlet::link'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''glossar_portlet'', + ''AddSelfToPage'', + ''glossar_portlet::add_self_to_page'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''glossar_portlet'', + ''Show'', + ''glossar_portlet::show'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''glossar_portlet'', + ''Edit'', + ''glossar_portlet::edit'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''glossar_portlet'', + ''RemoveSelfFromPage'', + ''glossar_portlet::remove_self_from_page'', + ''TCL'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- Add the binding + perform acs_sc_binding__new ( + ''portal_datasource'', + ''glossar_portlet'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + Index: openacs-4/packages/glossar-portlet/tcl/glossar-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar-portlet/tcl/glossar-portlet-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar-portlet/tcl/glossar-portlet-procs.tcl 20 Aug 2005 09:38:18 -0000 1.1 @@ -0,0 +1,124 @@ +# +# Copyright (C) 2005 Cognovis +# Author: Bjoern Kiesbye (kiesbye@theservice.de) + +# This file is part of dotLRN. +# +# dotLRN is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + +ad_library { + + Procedures to support the Glossar Package + + + @author kiesbye@theservice.de + @cvs-id $Id: glossar-portlet-procs.tcl + +} + +namespace eval glossar_portlet { + + ad_proc -private my_package_key { + } { + return "glossar-portlet" + } + + ad_proc -private get_my_name { + } { + return "glossar_portlet" + } + + ad_proc -public get_pretty_name { + } { + return "Glossar Portlet" + } + + ad_proc -public link { + } { + return [site_node::get_package_url -package_key glossar] + } + + ad_proc -public add_self_to_page { + {-portal_id:required} + {-package_id:required} + {-param_action "overwrite"} + {-page_name ""} + {-pretty_name ""} + {-force_region ""} + {-scoped_p ""} + + } { + Adds a Contact Portlet to the given page. + + @param portal_id The page to add self to + @return element_id The new element's id + + } { + + # allow overrides of pretty_name and force_region + if {[empty_string_p $pretty_name]} { + set pretty_name [get_pretty_name] + } + + if {[empty_string_p $force_region]} { + set force_region [parameter::get_from_package_key \ + -package_key [my_package_key] \ + -parameter "force_region" + ] + } + + set extra_params "" + + + return [portal::add_element_parameters \ + -portal_id $portal_id \ + -page_name $page_name \ + -portlet_name [get_my_name] \ + -value $package_id \ + -pretty_name $pretty_name \ + -force_region $force_region \ + -param_action $param_action + + ] + } + + + + + ad_proc -public remove_self_from_page { + {-portal_id:required} + + } { + Removes a Contacts Portlet from the given page. + + @param portal_id The page to remove self from + @param project_manager_id + } { + portal::remove_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + } + + + + ad_proc -public show { + cf + } { + } { + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src glossar-list + + } + +} Index: openacs-4/packages/glossar-portlet/www/glossar-list-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar-portlet/www/glossar-list-portlet.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar-portlet/www/glossar-list-portlet.adp 20 Aug 2005 09:38:18 -0000 1.1 @@ -0,0 +1,2 @@ + + \ No newline at end of file Index: openacs-4/packages/glossar-portlet/www/glossar-list-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar-portlet/www/glossar-list-portlet.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar-portlet/www/glossar-list-portlet.tcl 20 Aug 2005 09:38:18 -0000 1.1 @@ -0,0 +1,23 @@ +# packages/contacts-portlet/www/contacts-portlet.tcl + +ad_page_contract { + + + + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-06-13 + @arch-tag: 6d750604-b469-457c-bc2f-09ec8f0deb16 + @cvs-id $Id: glossar-list-portlet.tcl,v 1.1 2005/08/20 09:38:18 maltes Exp $ +} { + +} -properties { + + package_id +} + +#set user_id [ad_conn user_id] +#set package_id [apm_package_id_from_key glossar] +#set community_id [dotlrn_community::get_community_id_from_url] +#set organization_id [lindex [application_data_link::get_linked -from_object_id $community_id -to_object_type "organization"] 0] + +# Figure out owner_id may ID's ? \ No newline at end of file Index: openacs-4/packages/glossar-portlet/www/glossar-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar-portlet/www/glossar-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar-portlet/www/glossar-list.adp 20 Aug 2005 09:38:18 -0000 1.1 @@ -0,0 +1 @@ + \ No newline at end of file Index: openacs-4/packages/glossar-portlet/www/glossar-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossar-portlet/www/glossar-list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/glossar-portlet/www/glossar-list.tcl 20 Aug 2005 09:38:18 -0000 1.1 @@ -0,0 +1,39 @@ +# packages/glossar-portlet/www/glossar-list.tcl + +ad_page_contract { + + Creates a list with all Glossars for Customer, + direct and indirect ones from Etat + + + @author Bjoern Kiesbye (bjoern_kiesbye@web.de) + @creation-date 2005-07-29 + @arch-tag: a7a412af-2b23-46f6-9414-ca3c0b7df8b4 + @cvs-id $Id: glossar-list.tcl,v 1.1 2005/08/20 09:38:18 maltes Exp $ +} { + {gl_format "normal"} + {gl_orderby ""} + {gl_customer_id ""} +} -properties { + owner_ids + gl_format + gl_orderby + gl_customer_id +} -validate { +} -errors { +} + + +set owner_ids [list] +set community_id [dotlrn_community::get_community_id_from_url] +set customer_id [application_data_link::get_linked -from_object_id $community_id -to_object_type "organization" ] + +ns_log notice "custommer_id(s) $customer_id" +lappend owner_ids $customer_id + +db_foreach get_etat_ids {SELECT object_id_one FROM acs_rels WHERE rel_type = 'contact_rels_etat' AND object_id_two = :customer_id} { + + lappend owner_ids $object_id_one +} + +ns_log notice "owner_ids $owner_ids" \ No newline at end of file