Index: openacs-4/contrib/obsolete-packages/wf-ticket-tracker/sql/postgresql/ticket-workflow-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/wf-ticket-tracker/sql/postgresql/ticket-workflow-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/wf-ticket-tracker/sql/postgresql/ticket-workflow-create.sql 4 May 2001 21:41:11 -0000 1.1 @@ -0,0 +1,149 @@ +/* This table will hold one row for each case using this workflow. */ + +begin; + +create table wf_ticket_cases ( + case_id integer primary key + constraint wf_ticket_cases_case_fk + references wf_cases +); + + +select workflow__create_workflow( + 'ticket_wf', -- workflow_key => 'ticket_wf', + 'Ticket Tracker Process', -- pretty_name => 'Ticket Tracker Process', + 'Ticket Tracker Process', -- pretty_plural => 'Ticket Tracker Process', + 'Workflow for processing a ticket in the ticket-tracker', + -- description => 'Workflow for processing a ticket in the ticket-tracker', + 'wf_ticket_cases', -- table_name => 'wf_ticket_cases' + 'case_id' -- default value + ); + + + + +insert into wf_places(place_key, workflow_key, place_name, sort_order) + values ('start', 'ticket_wf', 'Needs to be fixed', 1); +insert into wf_places(place_key, workflow_key, place_name, sort_order) + values ('to_be_acknowledged', 'ticket_wf', 'Needs to be acknowledged', 2); +insert into wf_places(place_key, workflow_key, place_name, sort_order) + values ('to_be_clarified', 'ticket_wf', 'Needs to be clarified', 3); +insert into wf_places(place_key, workflow_key, place_name, sort_order) + values ('end', 'ticket_wf', 'End state', 4); + + +insert into wf_transitions(transition_key, transition_name, workflow_key, sort_order, trigger_type) + values ('fix', 'Fix problem', 'ticket_wf', 1, 'user'); +insert into wf_transitions(transition_key, transition_name, workflow_key, sort_order, trigger_type) + values ('acknowledge', 'Acknowledge fix', 'ticket_wf', 2, 'user'); +insert into wf_transitions(transition_key, transition_name, workflow_key, sort_order, trigger_type) + values ('clarify', 'Clarify problem', 'ticket_wf', 3, 'user'); + + +-- fix -- +-- in +insert into wf_arcs(workflow_key, transition_key, place_key, direction) + values ('ticket_wf', 'fix', 'start', 'in'); +-- out +insert into wf_arcs(workflow_key, transition_key, place_key, direction, guard_callback, guard_custom_arg, guard_description) + values ('ticket_wf', 'fix', 'to_be_acknowledged', 'out', 'wf_callback.guard_attribute_true', 'clear', 'Problem clear and fixed'); +insert into wf_arcs(workflow_key, transition_key, place_key, direction, guard_callback, guard_custom_arg, guard_description) + values ('ticket_wf', 'fix', 'to_be_clarified', 'out', '#', '', 'Problem not clear'); + + +-- acknowledge +-- in +insert into wf_arcs(workflow_key, transition_key, place_key, direction) + values ('ticket_wf', 'acknowledge', 'to_be_acknowledged', 'in'); +-- out +insert into wf_arcs(workflow_key, transition_key, place_key, direction, guard_callback, guard_custom_arg, guard_description) + values ('ticket_wf', 'acknowledge', 'end', 'out', 'wf_callback.guard_attribute_true', 'acknowledged', 'Fix okay'); +insert into wf_arcs(workflow_key, transition_key, place_key, direction, guard_callback, guard_custom_arg, guard_description) + values ('ticket_wf', 'acknowledge', 'start', 'out', '#', '', 'Fix not okay'); + + +-- clarify +-- in +insert into wf_arcs(workflow_key, transition_key, place_key, direction) + values ('ticket_wf', 'clarify', 'to_be_clarified', 'in'); +-- out +insert into wf_arcs(workflow_key, transition_key, place_key, direction) + values ('ticket_wf', 'clarify', 'start', 'out'); + + + +create function inline_0 () +returns integer as ' +declare + v_attribute_id acs_attributes.attribute_id%TYPE; +begin + v_attribute_id := workflow__create_attribute( + ''ticket_wf'', -- workflow_key => ''ticket_wf'', + ''clear'', -- attribute_name => ''clear'', + ''boolean'', -- datatype => ''boolean'', + ''Problem is clear'', -- pretty_name => ''Problem is clear'', + null, -- pretty_plural + null, -- table_name + null, -- column_name + ''t'', -- default_value => ''t'' + 1, -- min_n_values + 1, -- max_n_values + null, -- sort_order + ''generic'', -- storage + ''none'' -- wf_datatype + ); + + insert into wf_transition_attribute_map + (workflow_key, transition_key, attribute_id, sort_order) + values + (''ticket_wf'', ''fix'', v_attribute_id, 1); + + v_attribute_id := workflow__create_attribute( + ''ticket_wf'', -- workflow_key => ''ticket_wf'', + ''acknowledged'', -- attribute_name => ''acknowledged'', + ''boolean'', -- datatype => ''boolean'', + ''Fix is okay'', -- pretty_name => ''Fix is okay'', + null, -- pretty_plural + null, -- table_name + null, -- column_name + ''t'', -- default_value => ''t'' + 1, -- min_n_values + 1, -- max_n_values + null, -- sort_order + ''generic'', -- storage + ''none'' -- wf_datatype + ); + + insert into wf_transition_attribute_map + (workflow_key, transition_key, attribute_id, sort_order) + values + (''ticket_wf'', ''acknowledge'', v_attribute_id, 1); + + return 0; +end;' language 'plpgsql'; + +select inline_0 (); + +drop function inline_0 (); + + +insert into wf_context_task_panels(context_key, workflow_key, transition_key, sort_key, header, template_url) +values ('default', 'ticket_wf', 'fix', 1, 'Ticket', '/wf-ticket-tracker/panel-ticket'); + +insert into wf_context_task_panels(context_key, workflow_key, transition_key, sort_key, header, template_url) +values ('default', 'ticket_wf', 'fix', 2, 'What To Do', '/wf-ticket-tracker/panel-fix-to-do'); + +insert into wf_context_task_panels(context_key, workflow_key, transition_key, sort_key, header, template_url) +values ('default', 'ticket_wf', 'clarify', 1, 'Ticket', '/wf-ticket-tracker/panel-ticket'); + +insert into wf_context_task_panels(context_key, workflow_key, transition_key, sort_key, header, template_url) +values ('default', 'ticket_wf', 'clarify', 2, 'What To Do', '/wf-ticket-tracker/panel-clarify-to-do'); + +insert into wf_context_task_panels(context_key, workflow_key, transition_key, sort_key, header, template_url) +values ('default', 'ticket_wf', 'acknowledge', 1, 'Ticket', '/wf-ticket-tracker/panel-ticket'); + +insert into wf_context_task_panels(context_key, workflow_key, transition_key, sort_key, header, template_url) +values ('default', 'ticket_wf', 'acknowledge', 2, 'What To Do', '/wf-ticket-tracker/panel-acknowledge-to-do'); + + +end; Index: openacs-4/contrib/obsolete-packages/wf-ticket-tracker/sql/postgresql/wf-ticket-tracker-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/wf-ticket-tracker/sql/postgresql/wf-ticket-tracker-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/wf-ticket-tracker/sql/postgresql/wf-ticket-tracker-create.sql 4 May 2001 21:41:11 -0000 1.1 @@ -0,0 +1,103 @@ + +select acs_object_type__create_type( + 'wf_ticket', -- object_type => 'wf_ticket', + 'Ticket', -- pretty_name => 'Ticket', + 'Tickets', -- pretty_plural => 'Tickets', + null, -- supertype + 'wf_tickets', -- table_name => 'wf_tickets', + 'ticket_id', -- id_column => 'ticket_id', + 'wf_ticket', -- package_name => 'wf_ticket', + 'f', -- abstract_p + null, -- type_extension_table + 'wf_ticket.name' -- name_method => 'wf_ticket.name' + ); + + -- XXX fill in all the attributes in later. + +create table wf_tickets ( + ticket_id integer + constraint wf_tickets_pk + primary key + constraint wf_tickets_acs_object_fk + references acs_objects on delete cascade, + subject varchar(400), + description varchar(4000), + severity integer, + priority integer +); + +create function wf_ticket__new ( + integer, -- ticket_id in wf_tickets.ticket_id%TYPE default null, + varchar, -- subject in wf_tickets.subject%TYPE, + varchar, -- description in wf_tickets.description%TYPE, + integer, -- severity in wf_tickets.severity%TYPE default 3, + integer, -- priority in wf_tickets.priority%TYPE default 3, + timestamp, -- creation_date in acs_objects.creation_date%TYPE default sysdate, + integer, -- creation_user in acs_objects.creation_user%TYPE default null, + varchar -- creation_ip in acs_objects.creation_ip%TYPE default null + ) returns integer as ' + declare + new__ticket_id alias for $1; + new__subject alias for $2; + new__description alias for $3; + new__severity alias for $4; + new__priority alias for $5; + new__creation_date alias for $6; + new__creation_user alias for $7; + new__creation_ip alias for $8; + v_ticket_id number; + v_case_id number; + begin + v_ticket_id := acs_object__new( + new__ticket_id, -- object_id => ticket_id, + ''wf_ticket'', -- object_type => ''wf_ticket'', + new__creation_date, -- creation_date => new__creation_date, + new__creation_user, -- creation_user => new__creation_user, + new__creation_ip, -- creation_ip => new__creation_ip + null -- context_id + ); + + insert into wf_tickets (ticket_id, subject, description, severity, priority) + values (v_ticket_id, new__subject, new__description, new__severity, new__priority); + + v_case_id := workflow_case__new( + null, -- case_id + ''ticket_wf'', -- workflow_key => ''ticket_wf'', + null, -- context_key + v_ticket_id, -- object_id => v_ticket_id, + new__creation_date, -- creation_date => new__creation_date, + new__creation_user, -- creation_user => new__creation_user, + new__creation_ip -- creation_ip => new__creation_ip + ); + + workflow_case__start_case( + v_case_id, -- case_id => v_case_id, + new__creation_user, -- creation_user => new__creation_user, + new__creation_ip, -- creation_ip => new__creation_ip + null -- start_case__msg + ); + + return v_ticket_id; + end;' language 'plpgsql'; + +create function wf_ticket__delete(integer) + returns integer as ' + declare + delete__ticket_id alias for $1; + begin + delete from wf_tickets where ticket_id = delete__ticket_id; + acs_object__delete(delete__ticket_id); + return 0; + end;' language 'plpgsql'; + +create function wf_ticket__name (integer) + returns varchar as ' + declare + name__ticket_id alias for $1; + v_subject wf_tickets.subject%TYPE; + begin + select subject into v_subject + from wf_tickets + where ticket_id = name__ticket_id; + return v_subject; + end;' language 'plpgsql'; \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/wf-ticket-tracker/sql/postgresql/wf-ticket-tracker-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/wf-ticket-tracker/sql/postgresql/wf-ticket-tracker-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/wf-ticket-tracker/sql/postgresql/wf-ticket-tracker-drop.sql 4 May 2001 21:41:11 -0000 1.1 @@ -0,0 +1,9 @@ +delete from wf_tickets; + +select acs_object_type__drop_type( + 'wf_ticket', -- object_type => 'wf_ticket' + 'f' -- cascade_p + ); + +drop package wf_ticket; +drop table wf_tickets;