Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/faq/tcl/faq-procs-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/faq/tcl/faq-procs-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/faq/tcl/faq-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/tcl/faq-procs.tcl,v diff -u -r1.5.2.1 -r1.5.2.2 --- openacs-4/packages/faq/tcl/faq-procs.tcl 23 Feb 2023 15:25:47 -0000 1.5.2.1 +++ openacs-4/packages/faq/tcl/faq-procs.tcl 20 Mar 2023 12:34:02 -0000 1.5.2.2 @@ -21,6 +21,39 @@ db_0or1row get_info "" -column_array faq_info } + ad_proc -public new { + -faq_id + -faq_name:required + -separate:boolean + {-package_id ""} + {-user_id ""} + {-creation_ip ""} + } { + Creates a new FAQ. + + @return integer faq_id + } { + if {![info exists faq_id]} { + set faq_id [db_nextval acs_object_id_seq] + } + + if {[ns_conn isconnected]} { + if {$package_id eq ""} { + set package_id [ad_conn package_id] + } + if {$user_id eq ""} { + set user_id [ad_conn user_id] + } + if {$creation_ip eq ""} { + set creation_ip [ad_conn host] + } + } + + db_exec_plsql create_faq {} + + return $faq_id + } + } namespace eval faq::notification { Index: openacs-4/packages/faq/tcl/test/faq-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/tcl/test/faq-procs.tcl,v diff -u -r1.5.2.1 -r1.5.2.2 --- openacs-4/packages/faq/tcl/test/faq-procs.tcl 9 Sep 2022 13:03:10 -0000 1.5.2.1 +++ openacs-4/packages/faq/tcl/test/faq-procs.tcl 20 Mar 2023 12:34:02 -0000 1.5.2.2 @@ -330,6 +330,29 @@ } } +aa_register_case \ + -cats {api smoke} \ + -procs { + faq::new + faq::get_instance_info + } \ + faq_create_and_retrieve { + + Create and retrieve an FAQ object via the api + + } { + aa_run_with_teardown -rollback -test_code { + set faq_id [faq::new -faq_name "__test_faq" -separate] + + faq::get_instance_info -arrayname __test_array -faq_id $faq_id + + aa_equals "FAQ name is expected" \ + $__test_array(faq_name) __test_faq + aa_true "FAQ separate_p is expected" \ + $__test_array(separate_p) + } + } + # Local variables: # mode: tcl # tcl-indent-level: 4 Fisheye: Tag 1.1.26.1 refers to a dead (removed) revision in file `openacs-4/packages/faq/www/admin/faq-new-2-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/faq/www/admin/faq-new-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/admin/faq-new-2.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/faq/www/admin/faq-new-2.tcl 8 Aug 2022 12:56:06 -0000 1.7.2.1 +++ openacs-4/packages/faq/www/admin/faq-new-2.tcl 20 Mar 2023 12:34:02 -0000 1.7.2.2 @@ -15,28 +15,13 @@ faq_name:notnull,trim separate_p:boolean,notnull } -set package_id [ad_conn package_id] -set user_id [ad_conn user_id] -set creation_ip [ad_conn host] - permission::require_permission -object_id $package_id -privilege faq_create_faq -db_transaction { - db_exec_plsql create_faq { - begin - :1 := faq.new_faq ( - faq_id => :faq_id, - faq_name => :faq_name, - separate_p => :separate_p, - creation_user => :user_id, - creation_ip => :creation_ip, - context_id => :package_id - ); - end; - } -} -# on error ... +faq::new \ + -faq_id $faq_id \ + -faq_name $faq_name \ + -separate=$separate_p ad_returnredirect "." ad_script_abort