Index: openacs-4/contrib/obsolete-packages/ticket-tracker-lite/ticket-tracker-lite.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/ticket-tracker-lite/ticket-tracker-lite.info,v
diff -u -r1.4 -r1.5
--- openacs-4/contrib/obsolete-packages/ticket-tracker-lite/ticket-tracker-lite.info 26 Feb 2002 15:51:17 -0000 1.4
+++ openacs-4/contrib/obsolete-packages/ticket-tracker-lite/ticket-tracker-lite.info 19 Mar 2002 06:49:29 -0000 1.5
@@ -55,6 +55,7 @@
+
@@ -66,6 +67,10 @@
+
+
+
+
@@ -76,6 +81,9 @@
+
+
+
@@ -85,11 +93,21 @@
+
+
+
+
+
+
+
+
+
+
@@ -108,6 +126,7 @@
+
Index: openacs-4/contrib/obsolete-packages/ticket-tracker-lite/sql/oracle/views-and-plsql.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/ticket-tracker-lite/sql/oracle/views-and-plsql.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/obsolete-packages/ticket-tracker-lite/sql/oracle/views-and-plsql.sql 20 Apr 2001 20:51:23 -0000 1.1
+++ openacs-4/contrib/obsolete-packages/ticket-tracker-lite/sql/oracle/views-and-plsql.sql 19 Mar 2002 06:49:29 -0000 1.2
@@ -106,3 +106,76 @@
end;
/
+show errors;
+
+create or replace function ttl__create_file (
+ p_package_id in apm_packages.package_id%TYPE,
+ p_user_id in users.user_id%TYPE,
+ p_name in cr_items.name%TYPE,
+ p_parent_id in cr_items.parent_id%TYPE,
+ p_mime_type in cr_mime_types.mime_type%TYPE,
+ p_file_extension in cr_mime_types.file_extension%TYPE
+) return cr_revisions.revision_id%TYPE
+as
+ v_item_id cr_items.item_id%TYPE;
+ v_revision_id cr_revisions.revision_id%TYPE;
+ v_mime_type cr_mime_types.mime_type%TYPE;
+begin
+
+ begin
+ -- detect mime type if mime is not yet in cr_mime_type and add it
+ select mime_type into v_mime_type from cr_mime_types
+ where mime_type = p_mime_type;
+
+ exception
+ when NO_DATA_FOUND then
+ insert into cr_mime_types
+ (mime_type, file_extension)
+ values
+ (p_mime_type, p_file_extension);
+ end;
+
+ -- if the file already exists then nuke it. this become essentially write
+ select max(item_id) into v_item_id from cr_items where name = p_name;
+
+ if v_item_id is not null then
+ content_item.delete(v_item_id);
+ end if;
+
+ -- vinodk: this needs to be rewritten to use CR API
+ -- oracle - use lob instead of file
+
+ -- create a new cr_item
+ v_item_id := acs_object.new (
+ null,
+ 'content_item',
+ sysdate,
+ p_user_id,
+ null,
+ p_package_id
+ );
+
+ insert into cr_items
+ (item_id, parent_id, name, content_type, storage_type)
+ values
+ (v_item_id, p_parent_id, p_name, 'content_revision', 'lob');
+
+ -- create a new cr_revision
+ v_revision_id := acs_object.new (
+ null,
+ 'content_revision',
+ sysdate,
+ p_user_id,
+ null,
+ null
+ );
+
+ insert into cr_revisions
+ (revision_id, item_id, mime_type)
+ values
+ (v_revision_id, v_item_id, p_mime_type);
+
+ return v_revision_id;
+end;
+/
+show errors;
Index: openacs-4/contrib/obsolete-packages/ticket-tracker-lite/sql/postgresql/views-and-plsql.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/ticket-tracker-lite/sql/postgresql/views-and-plsql.sql,v
diff -u -r1.5 -r1.6
--- openacs-4/contrib/obsolete-packages/ticket-tracker-lite/sql/postgresql/views-and-plsql.sql 13 Aug 2001 21:32:05 -0000 1.5
+++ openacs-4/contrib/obsolete-packages/ticket-tracker-lite/sql/postgresql/views-and-plsql.sql 19 Mar 2002 06:49:29 -0000 1.6
@@ -96,3 +96,47 @@
return v_privilege;
end;' language 'plpgsql';
+create function ttl__create_file(integer, integer, varchar, integer, varchar, varchar)
+returns integer as '
+declare
+ p_package_id alias for $1;
+ p_user_id alias for $2;
+ p_name alias for $3;
+ p_parent_id alias for $4;
+ p_mime_type alias for $5;
+ p_file_extension alias for $6;
+ v_item_id integer;
+ v_revision_id integer;
+ v_mime_type varchar;
+begin
+
+-- detect mime type if mime is not yet in cr_mime_type and add it
+ select mime_type into v_mime_type from cr_mime_types
+ where mime_type = p_mime_type;
+
+ if not found then
+ insert into cr_mime_types (mime_type, file_extension) values (p_mime_type, p_file_extension);
+ end if;
+
+-- if the file already exists then nuke it. this become essentially write
+ select item_id into v_item_id from cr_items where name = p_name;
+ if found then
+ perform content_item__delete(v_item_id);
+ end if;
+
+-- create a new cr_item
+ v_item_id := acs_object__new(null, ''content_item'', now(), p_user_id, null, p_package_id);
+ insert into cr_items (
+ item_id, parent_id, name, content_type, storage_type
+ ) values (
+ v_item_id, p_parent_id, p_name, ''content_revision'', ''file''
+ );
+
+-- create a new cr_revision
+ v_revision_id := acs_object__new(null, ''content_revision'', now(), p_user_id, null, null);
+ insert into cr_revisions (revision_id, item_id, mime_type)
+ values (v_revision_id, v_item_id, p_mime_type);
+
+ return v_revision_id;
+end;
+' language 'plpgsql';
Index: openacs-4/contrib/obsolete-packages/ticket-tracker-lite/tcl/ticket-tracker-lite-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/ticket-tracker-lite/tcl/ticket-tracker-lite-procs.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/contrib/obsolete-packages/ticket-tracker-lite/tcl/ticket-tracker-lite-procs.tcl 28 May 2001 20:43:37 -0000 1.2
+++ openacs-4/contrib/obsolete-packages/ticket-tracker-lite/tcl/ticket-tracker-lite-procs.tcl 19 Mar 2002 06:49:29 -0000 1.3
@@ -208,7 +208,7 @@
if {[info exists pref_key] && [string equal $var_value $pref_key]} {
lappend list_of_links "$linktitle"
} else {
- lappend list_of_links "$linktitle"
+ lappend list_of_links "$linktitle"
}
}
Index: openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/attach-file-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/attach-file-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/attach-file-oracle.xql 19 Mar 2002 06:49:29 -0000 1.1
@@ -0,0 +1,31 @@
+
+
+
+ oracle8.1.6
+
+
+
+
+ begin
+ :1 := ttl__create_file(:package_id, :caller_id, :upload_file, :ticket_id, :mime_type, :file_extension);
+ end;
+
+
+
+
+
+
+
+
+ update cr_revisions
+ set content_length = :tmp_size,
+ content = empty_blob()
+ where revision_id = :revision_id
+ returning content into :1
+
+
+
+
+
+
+
Index: openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/attach-file-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/attach-file-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/attach-file-postgresql.xql 19 Mar 2002 06:49:29 -0000 1.1
@@ -0,0 +1,28 @@
+
+
+
+ postgresql7.1
+
+
+
+
+ select ttl__create_file(:package_id, :caller_id, :upload_file, :ticket_id, :mime_type, :file_extension)
+
+
+
+
+
+
+
+
+
+ update cr_revisions
+ set content_length = :tmp_size,
+ content = :tmp_filename
+ where revision_id = :revision_id
+
+
+
+
+
+
Index: openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/attach-file.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/attach-file.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/attach-file.tcl 19 Mar 2002 06:49:29 -0000 1.1
@@ -0,0 +1,35 @@
+ad_page_contract {
+
+ A page to attach files
+
+} {
+ ticket_id:integer,notnull
+ upload_file:trim,notnull
+ upload_file.tmpfile:tmpfile
+ {return_url "ticket"}
+}
+
+ttl_restrict_to_ttl_users
+
+set caller_id [ad_conn user_id]
+set caller_ip [ns_conn peeraddr]
+set package_id [ad_conn package_id]
+
+ns_log notice "vinodk-upload_file=$upload_file"
+
+db_transaction {
+
+ if {![empty_string_p $upload_file]} {
+ set mime_type [ns_guesstype $upload_file]
+ set file_extension [string trimleft [file extension $upload_file] "."]
+ set revision_id [db_exec_plsql create_new_file "select ttl__create_file(:package_id, :caller_id, :upload_file, :ticket_id, :mime_type, :file_extension);"]
+ db_1row get_item_id "select item_id from cr_revisions where revision_id = :revision_id"
+ set tmp_filename [cr_create_content_file $item_id $revision_id ${upload_file.tmpfile}]
+ set tmp_size [cr_file_size $tmp_filename]
+ db_dml file_size_mime_type "update cr_revisions set content_length = :tmp_size, content = :tmp_filename where revision_id = :revision_id" -blob_files [list ${upload_file.tmpfile}]
+ }
+
+}
+
+
+ad_returnredirect "$return_url"
Index: openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/attach-file.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/attach-file.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/attach-file.xql 19 Mar 2002 06:49:29 -0000 1.1
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+ select item_id from cr_revisions where revision_id = :revision_id
+
+
+
+
+
+
Index: openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/comment-ae.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/comment-ae.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/comment-ae.adp 20 Apr 2001 20:51:23 -0000 1.1
+++ openacs-4/contrib/obsolete-packages/ticket-tracker-lite/www/comment-ae.adp 19 Mar 2002 06:49:29 -0000 1.2
@@ -5,16 +5,19 @@