Index: openacs-4/packages/acs-content-repository/acs-content-repository.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/acs-content-repository.info,v
diff -u -r1.53 -r1.54
--- openacs-4/packages/acs-content-repository/acs-content-repository.info 18 Mar 2005 13:44:56 -0000 1.53
+++ openacs-4/packages/acs-content-repository/acs-content-repository.info 20 Mar 2005 13:41:51 -0000 1.54
@@ -7,7 +7,7 @@
t
t
-
+
OpenACS
The canonical repository for OpenACS content.
@@ -21,7 +21,7 @@
other CMS backing functionality. Utilized by Bug Tracker, File Storage, and other packages.
-
+
Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-keyword.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-keyword.sql,v
diff -u -r1.21 -r1.22
--- openacs-4/packages/acs-content-repository/sql/postgresql/content-keyword.sql 12 Mar 2004 18:48:47 -0000 1.21
+++ openacs-4/packages/acs-content-repository/sql/postgresql/content-keyword.sql 20 Mar 2005 13:41:51 -0000 1.22
@@ -8,6 +8,7 @@
-- License. Full text of the license is available from the GNU Project:
-- http://www.fsf.org/copyleft/gpl.html
+select define_function_args ('content_keyword__get_heading','keyword_id');
create or replace function content_keyword__get_heading (integer)
returns text as '
declare
@@ -24,6 +25,7 @@
-- function get_description
+select define_function_args ('content_keyword__get_description','keyword_id');
create or replace function content_keyword__get_description (integer)
returns text as '
declare
@@ -40,6 +42,7 @@
-- procedure set_heading
+select define_function_args ('content_keyword__set_heading','keyword_id,heading');
create or replace function content_keyword__set_heading (integer,varchar)
returns integer as '
declare
@@ -61,6 +64,7 @@
-- procedure set_description
+select define_function_args ('content_keyword__set_description','keyword_id,description');
create or replace function content_keyword__set_description (integer,varchar)
returns integer as '
declare
@@ -78,6 +82,7 @@
-- function is_leaf
+select define_function_args ('content_keyword__is_leaf','keyword_id');
create or replace function content_keyword__is_leaf (integer)
returns boolean as '
declare
@@ -166,7 +171,8 @@
end;' language 'plpgsql';
-- procedure delete
-create or replace function content_keyword__delete (integer)
+select define_function_args ('content_keyword__del','keyword_id');
+create or replace function content_keyword__del (integer)
returns integer as '
declare
delete__keyword_id alias for $1;
@@ -183,8 +189,19 @@
return 0;
end;' language 'plpgsql';
+create or replace function content_keyword__delete (integer)
+returns integer as '
+declare
+ delete__keyword_id alias for $1;
+ v_rec record;
+begin
+ perform content_keyword__del(delete__keyword_id);
+ return 0;
+end;' language 'plpgsql';
+
-- procedure item_assign
+select define_function_args ('content_keyword__item_assign','item_id,keyword_id,context_id;null,creation_user;null,creation_ip;null');
create or replace function content_keyword__item_assign (integer,integer,integer,integer,varchar)
returns integer as '
declare
@@ -216,6 +233,7 @@
-- procedure item_unassign
+select define_function_args ('content_keyword__item_unassign','item_id,keyword_id');
create or replace function content_keyword__item_unassign (integer,integer)
returns integer as '
declare
@@ -232,6 +250,7 @@
-- function is_assigned
+select define_function_args ('content_keyword__is_assigned','item_id,keyword_id,recurse;none');
create or replace function content_keyword__is_assigned (integer,integer,varchar)
returns boolean as '
declare
@@ -287,6 +306,7 @@
-- function get_path
+select define_function_args ('content_keyword__get_path','keyword_id');
create or replace function content_keyword__get_path (integer)
returns text as '
declare
@@ -325,47 +345,6 @@
return v_path;
end if;
-end;' language 'plpgsql';
-
-
-create or replace function content_keyword__get_path (integer)
-returns text as '
-declare
- get_path__keyword_id alias for $1;
- v_path text default '''';
- v_is_found boolean default ''f'';
- v_heading cr_keywords.heading%TYPE;
- v_rec record;
-begin
--- select
--- heading
--- from (
--- select
--- heading, level as tree_level
--- from cr_keywords
--- connect by prior parent_id = keyword_id
--- start with keyword_id = get_path.keyword_id) k
--- order by
--- tree_level desc
-
- for v_rec in select heading
- from (select k2.heading, tree_level(k2.tree_sortkey) as tree_level
- from cr_keywords k1, cr_keywords k2
- where k1.keyword_id = get_path__keyword_id
- and k1.tree_sortkey between k2.tree_sortkey and tree_right(k2.tree_sortkey)) k
- order by tree_level desc
- LOOP
- v_heading := v_rec.heading;
- v_is_found := ''t'';
- v_path := v_path || ''/'' || v_heading;
- end LOOP;
-
- if v_is_found = ''f'' then
- return null;
- else
- return v_path;
- end if;
-
end;' language 'plpgsql' stable strict;
Index: openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.2.0d13-5.2.0d14.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.2.0d13-5.2.0d14.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.2.0d13-5.2.0d14.sql 20 Mar 2005 13:41:51 -0000 1.1
@@ -0,0 +1,49 @@
+--
+--
+--
+-- @author Dave Bauer (dave@thedesignexperience.org)
+-- @creation-date 2005-03-20
+-- @arch-tag: 8694a7de-393a-4d70-a3ce-36019afdf05c
+-- @cvs-id $Id: upgrade-5.2.0d13-5.2.0d14.sql,v 1.1 2005/03/20 13:41:51 daveb Exp $
+--
+
+-- add define function args calls for content_keyword
+-- add content_keyword__del to coincide with oracle
+
+select define_function_args ('content_keyword__get_heading','keyword_id');
+select define_function_args ('content_keyword__get_description','keyword_id');
+select define_function_args ('content_keyword__set_heading','keyword_id,heading');
+select define_function_args ('content_keyword__set_description','keyword_id,description');
+select define_function_args ('content_keyword__is_leaf','keyword_id');
+select define_function_args ('content_keyword__del','keyword_id');
+select define_function_args ('content_keyword__item_assign','item_id,keyword_id,context_id;null,creation_user;null,creation_ip;null');
+select define_function_args ('content_keyword__item_unassign','item_id,keyword_id');
+select define_function_args ('content_keyword__is_assigned','item_id,keyword_id,recurse;none');
+select define_function_args ('content_keyword__get_path','keyword_id');
+
+create or replace function content_keyword__del (integer)
+returns integer as '
+declare
+ delete__keyword_id alias for $1;
+ v_rec record;
+begin
+
+ for v_rec in select item_id from cr_item_keyword_map
+ where keyword_id = delete__keyword_id LOOP
+ PERFORM content_keyword__item_unassign(v_rec.item_id, delete__keyword_id);
+ end LOOP;
+
+ PERFORM acs_object__delete(delete__keyword_id);
+
+ return 0;
+end;' language 'plpgsql';
+
+create or replace function content_keyword__delete (integer)
+returns integer as '
+declare
+ delete__keyword_id alias for $1;
+ v_rec record;
+begin
+ perform content_keyword__del(delete__keyword_id);
+ return 0;
+end;' language 'plpgsql';
Index: openacs-4/packages/acs-content-repository/tcl/test/content-keyword-test-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/test/content-keyword-test-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-content-repository/tcl/test/content-keyword-test-procs.tcl 20 Mar 2005 13:41:50 -0000 1.1
@@ -0,0 +1,39 @@
+#
+
+ad_library {
+
+ Tests for content keyword APIs
+
+ @author Dave Bauer (dave@thedesignexperience.org)
+ @creation-date 2005-03-20
+ @arch-tag: b66524da-fe12-4bd9-ae32-f635b0b3949b
+ @cvs-id $Id: content-keyword-test-procs.tcl,v 1.1 2005/03/20 13:41:50 daveb Exp $
+}
+
+aa_register_case content_keyword {
+ content_keyword test
+} {
+ aa_run_with_teardown \
+ -rollback \
+ -test_code {
+
+ # create a keyword
+ set assigned_keyword_id [db_nextval "acs_object_id_seq"]
+ set keyword_id [content::keyword::new \
+ -heading "--test_keyword" \
+ -description "--test_description" \
+ -keyword_id $assigned_keyword_id]
+ # check that keyword_id, heading, description
+ # are set correctly
+ aa_true "Keyword_id assigned" \
+ [expr $assigned_keyword_id == $keyword_id]
+ aa_true "Keyword heading set" \
+ [string equal "--test_keyword" [content::keyword::get_heading -keyword_id $keyword_id]]
+ aa_true "Keyword description set" \
+ [string equal "--test_description" [content::keyword::get_description -keyword_id $keyword_id]]
+ # delete it
+ content::keyword::delete -keyword_id $keyword_id
+ aa_true "Keyword deleted" \
+ [string equal [db_string confirm_delete "" -default ""] ""]
+ }
+}
\ No newline at end of file
Index: openacs-4/packages/acs-content-repository/tcl/test/content-keyword-test-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/test/content-keyword-test-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-content-repository/tcl/test/content-keyword-test-procs.xql 20 Mar 2005 13:41:50 -0000 1.1
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+ select keyword_id from cr_keywords where keyword_id=:keyword_id
+
+
+
\ No newline at end of file