Forum OpenACS Development: Assessment Package: File Upload Support

Hi everyone,

I'm not really sure if file upload question type is going to be implemented for assessment soon. I'm currently working on this functionality and I want to tell you a little about what I've done:

1. Add file_id field to the asm_item_data table.
2. Run insert into as_item_types_map (item_type, display_type) values ('fu', 'f') to be able to have a file upload ('fu') item_type and a file ('f') display type .
3. Add tables :
-- File Upload Item
create table as_item_type_fu (
as_item_type_id integer
constraint as_item_type_fu_as_item_type_id_pk
primary key
constraint as_item_type_fu_as_item_type_id_fk
references cr_revisions(revision_id)
);

-- File Upload Display Type
create table as_item_display_f (
as_item_display_id integer
constraint as_item_display_f_as_item_display_id_pk
primary key
constraint as_item_display_f_as_item_display_id_fk
references cr_revisions(revision_id),
-- field to specify other stuff like textarea dimensions
html_display_options varchar(50),
-- an abstraction of the real size value in "small","medium","large"
abs_size varchar(10),
-- the orientation between the "question part" of the Item (the title/subtext) and the "answer part" (beside-left,beside-right, bellow, above)
item_answer_alignment varchar(20)
);

to handle all the information needed for the form display.

4. Register content types
#File Upload Ansers
content::type::new -content_type {as_item_type_fu} -supertype {content_revision} -pretty_name {Assessment Item Type File Upload} -pretty_plural {Assessment Item Type File Upload} -table_name {as_item_type_fu} -id_column {as_item_type_id}

content::type::new -content_type {as_item_display_f} -supertype {content_revision} -pretty_name {Assessment Item Display File} -pretty_plural {Assessment Item Display File} -table_name {as_item_display_f} -id_column {as_item_display_id}

# File Upload display type
content::type::attribute::new -content_type {as_item_display_f} -attribute_name {html_display_options} -datatype {string} -pretty_name {HTML display Options} -column_spec {varchar(50)}
content::type::attribute::new -content_type {as_item_display_f} -attribute_name {abs_size} -datatype {string} -pretty_name {Abstraction Real Size} -column_spec {varchar(20)}
content::type::attribute::new -content_type {as_item_display_f} -attribute_name {box_orientation} -datatype {string} -pretty_name {Box Orientation} -column_spec {varchar(20)}

5. Add all needed pages to support this new question type and display type:

www/asm-admin/item-add-display-f.adp
www/asm-admin/item-add-display-f.tcl
www/asm-admin/item-add-display-f.xql
www/asm-admin/item-edit-display-f.adp
www/asm-admin/item-edit-display-f.tcl
www/asm-admin/item-edit-display-f.tcl
www/asm-admin/item-add-fu.adp
www/asm-admin/item-add-fu.tcl
www/asm-admin/item-add-fu.xql
www/asm-admin/item-edit-fu.adp
www/asm-admin/item-edit-fu.tcl
www/asm-admin/item-edit-fu.xql

tcl/as-item-display-fu-procs.tcl
tcl/as-item-display-fu-procs.xql
tcl/as-item-type-fu-procs.tcl
tcl/as-item-type-fu-procs.xql

any suggestion, idea or comment?

This code hasn't been commited yet, and I would like to know what you think before.

Thanks

Anny Flores