Index: openacs-4/packages/evaluation/lib/tasks-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/Attic/tasks-chunk-postgresql.xql,v diff -u -r1.12 -r1.13 --- openacs-4/packages/evaluation/lib/tasks-chunk-postgresql.xql 10 Sep 2004 19:16:28 -0000 1.12 +++ openacs-4/packages/evaluation/lib/tasks-chunk-postgresql.xql 17 Dec 2004 18:11:00 -0000 1.13 @@ -22,12 +22,11 @@ evaluation_tasksi et, cr_items cri, cr_mime_types crmt - where cr.revision_id = et.revision_id - and et.grade_item_id = :grade_item_id + where cr.revision_id = et.revision_id + and et.grade_item_id = :grade_item_id and cri.live_revision = et.task_id and et.mime_type = crmt.mime_type $assignments_orderby - Index: openacs-4/packages/evaluation/sql/postgresql/evaluation-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/sql/postgresql/evaluation-create.sql,v diff -u -r1.16 -r1.17 --- openacs-4/packages/evaluation/sql/postgresql/evaluation-create.sql 10 Sep 2004 19:16:28 -0000 1.16 +++ openacs-4/packages/evaluation/sql/postgresql/evaluation-create.sql 17 Dec 2004 18:11:00 -0000 1.17 @@ -1,5 +1,5 @@ -- jopez@galileo.edu - +-- cesarhj@galileo.edu create table evaluation_grades ( grade_id integer constraint evaluation_grades_id_pk @@ -19,17 +19,6 @@ ); create index evalutaion_grades_giid_index on evaluation_grades(grade_item_id); - -select content_type__create_type ( - 'evaluation_grades', -- content_type - 'content_revision', -- super_type - 'Evaluation Grade', -- pretty_name - 'Evaluation Grades', -- pretty_plural - 'evaluation_grades', -- table_name - 'grade_id', -- id_column - null -- name_method -); - create table evaluation_tasks ( task_id integer constraint evaluation_tasks_pk @@ -70,16 +59,6 @@ create index evalutaion_tasks_gid_index on evaluation_tasks(grade_item_id); create index evalutaion_tasks_tiid_index on evaluation_tasks(task_item_id); -select content_type__create_type ( - 'evaluation_tasks', -- content_type - 'content_revision', -- super_type - 'Evaluation Task', -- pretty_name - 'Evaluation Tasks', -- pretty_plural - 'evaluation_tasks', -- table_name - 'task_id', -- id_column - null -- name_method -); - create table evaluation_tasks_sols ( solution_id integer primary key, @@ -94,16 +73,6 @@ -- create indexes create index evalutaion_tasks_sols_tid_index on evaluation_tasks_sols(task_item_id); -select content_type__create_type ( - 'evaluation_tasks_sols', -- content_type - 'content_revision', -- super_type - 'Evaluation Task Solution', -- pretty_name - 'Evaluation Tasks Solutions', -- pretty_plural - 'evaluation_tasks_sols', -- table_name - 'solution_id', -- id_column - null -- name_method -); - create table evaluation_answers ( answer_id integer primary key @@ -123,18 +92,6 @@ ); create index evaluation_answers_tid_index on evaluation_answers(party_id,task_item_id); - -select content_type__create_type ( - 'evaluation_answers', -- content_type - 'content_revision', -- super_type - 'Student Answer', -- pretty_name - 'Student Answers', -- pretty_plural - 'evaluation_answers', -- table_name - 'answer_id', -- id_column - null -- name_method -); - - create table evaluation_student_evals ( evaluation_id integer constraint evaluation_stu_evals_pk @@ -165,16 +122,6 @@ create index evaluation_student_evals_tid_index on evaluation_student_evals(task_item_id); create index evaluation_student_evals_pid_index on evaluation_student_evals(party_id); -select content_type__create_type ( - 'evaluation_student_evals', -- content_type - 'content_revision', -- super_type - 'Student Evaluation', -- pretty_name - 'Student Evaluations', -- pretty_plural - 'evaluation_student_evals', -- table_name - 'evaluation_id', -- id_column - null -- name_method -); - -- table to store the csv sheet grades associated with the evaluations create table evaluation_grades_sheets ( grades_sheet_id integer @@ -190,17 +137,6 @@ -- create indexes create index evalutaion_grades_sheets_tid_index on evaluation_grades_sheets(task_item_id); -select content_type__create_type ( - 'evaluation_grades_sheets', -- content_type - 'content_revision', -- super_type - 'Evaluation Grades Sheet', -- pretty_name - 'Evaluation Grades Sheets', -- pretty_plural - 'evaluation_grades_sheets', -- table_name - 'grades_sheet_id', -- id_column - null -- name_method -); - - select acs_object_type__create_type ( 'evaluation_task_groups', --object type 'Task Group', --pretty name @@ -254,157 +190,9 @@ 'f' --static_p ); -create function evaluation__new_item (integer,varchar,varchar,integer,integer,timestamptz,varchar,varchar,text,varchar,varchar,text,varchar,varchar,varchar) -returns integer as ' -declare - p_item_id alias for $1; - p_name alias for $2; - p_locale alias for $3; - p_creation_user alias for $4; - p_package_id alias for $5; - p_creation_date alias for $6; - p_creation_ip alias for $7; - p_title alias for $8; - p_description alias for $9; - p_mime_type alias for $10; - p_nls_language alias for $11; - p_text alias for $12; - p_storage_type alias for $13; - p_item_subtype alias for $14; - p_content_type alias for $15; - - v_item_id integer; - v_parent_id integer; - v_id integer; -begin - - select content_item__get_id(p_content_type||''_''||p_package_id,null,''f'') - into v_parent_id - from dual; - -- - -- this will be used for 2xClick protection - if p_item_id is null then - select acs_object_id_seq.nextval - into v_id - from dual; - else - v_id := p_item_id; - end if; - - select coalesce((select content_item__new( - p_name, -- name - v_parent_id, -- parent_id - v_id, -- item_id - p_locale, -- locale - p_creation_date, -- creation_date - p_creation_user, -- creation_user - p_package_id, -- context_id - p_creation_ip, -- creation_ip - p_item_subtype, -- item_subtype - p_content_type, -- content_type - p_title, -- title - p_description, -- description - p_mime_type, -- mime_type - p_nls_language, -- nls_language - p_text, -- text - p_storage_type -- storage_type - ) where not exists (select 1 from cr_items where item_id = v_id)),0) into v_item_id; - - return v_item_id; -end; -' language 'plpgsql'; - --------------------------------------- -- GRADES --------------------------------------- - -create function evaluation__new_grade (integer, integer, varchar, varchar, numeric, varchar, timestamptz, integer, varchar, varchar, varchar, timestamptz, varchar, varchar) -returns integer as ' -declare - p_item_id alias for $1; - p_revision_id alias for $2; - p_grade_name alias for $3; - p_grade_plural_name alias for $4; - p_weight alias for $5; - p_object_type alias for $6; - p_creation_date alias for $7; - p_creation_user alias for $8; - p_creation_ip alias for $9; - p_title alias for $10; -- default null - p_description alias for $11; -- default null - p_publish_date alias for $12; - p_nls_language alias for $13; -- default null - p_mime_type alias for $14; -- default null - - v_revision_id integer; - -begin - - v_revision_id := content_revision__new( - p_title, -- title - p_description, -- description - p_publish_date, -- publish_date - p_mime_type, -- mime_type - p_nls_language, -- nls_language - null, -- data - p_item_id, -- item_id - p_revision_id, -- revision_id - p_creation_date, -- creation_date - p_creation_user, -- creation_user - p_creation_ip, -- creation_ip - null -- content length - ); - - insert into evaluation_grades - (grade_id, - grade_item_id, - grade_name, - grade_plural_name, - comments, - weight) - values - (v_revision_id, - p_item_id, - p_grade_name, - p_grade_plural_name, - p_description, - p_weight); - - return v_revision_id; -end; -' language 'plpgsql'; - -create function evaluation__delete_grade (integer) -returns integer as ' -declare - p_grade_item_id alias for $1; - del_rec record; - -begin - - FOR del_rec IN - select task_item_id - from evaluation_tasks - where grade_item_id = p_grade_item_id - - LOOP - - PERFORM evaluation__delete_student_eval(evaluation_id) from evaluation_student_evals where task_item_id = del_rec.task_item_id; - PERFORM evaluation__delete_answer(answer_id) from evaluation_answers where task_item_id = del_rec.task_item_id; - PERFORM evaluation__delete_task_sol(solution_id) from evaluation_tasks_sols where task_item_id = del_rec.task_item_id; - PERFORM evaluation__delete_grades_sheet(grades_sheet_id) from evaluation_grades_sheets where task_item_id = del_rec.task_item_id; - - END LOOP; - - PERFORM evaluation__delete_task(task_id) from evaluation_tasks where grade_item_id = p_grade_item_id; - delete from evaluation_grades where grade_item_id = p_grade_item_id; - - PERFORM content_revision__delete(grade_id) from evaluation_grades where grade_item_id = p_grade_item_id; - - return 0; - -end;' language 'plpgsql'; - create function grade__name(integer) returns varchar as ' declare @@ -422,97 +210,6 @@ --------------------------------------- -- TASKS --------------------------------------- - -create function evaluation__new_task (integer, integer, varchar, integer, integer, varchar, numeric, timestamptz, char, char, char, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar) -returns integer as ' -declare - p_item_id alias for $1; - p_revision_id alias for $2; - p_task_name alias for $3; - p_number_of_members alias for $4; - p_grade_item_id alias for $5; - p_description alias for $6; - p_weight alias for $7; - p_due_date alias for $8; - p_late_submit_p alias for $9; - p_online_p alias for $10; - p_requires_grade_p alias for $11; - p_object_type alias for $12; - p_creation_date alias for $13; - p_creation_user alias for $14; - p_creation_ip alias for $15; - p_title alias for $16; -- default null - p_publish_date alias for $17; - p_nls_language alias for $18; -- default null - p_mime_type alias for $19; -- default null - - v_revision_id integer; - -begin - - v_revision_id := content_revision__new( - p_title, -- title - p_description, -- description - p_publish_date, -- publish_date - p_mime_type, -- mime_type - p_nls_language, -- nls_language - null, -- data - p_item_id, -- item_id - p_revision_id, -- revision_id - p_creation_date, -- creation_date - p_creation_user, -- creation_user - p_creation_ip, -- creation_ip - null -- content length - ); - - insert into evaluation_tasks - (task_id, - task_item_id, - task_name, - number_of_members, - due_date, - grade_item_id, - weight, - online_p, - late_submit_p, - requires_grade_p) - values - (v_revision_id, - p_item_id, - p_task_name, - p_number_of_members, - p_due_date, - p_grade_item_id, - p_weight, - p_online_p, - p_late_submit_p, - p_requires_grade_p); - - return v_revision_id; -end; -' language 'plpgsql'; - -create function evaluation__delete_task (integer) -returns integer as ' -declare - p_task_item_id alias for $1; - del_rec record; -begin - - - PERFORM evaluation__delete_student_eval(evaluation_id) from evaluation_student_evals where task_item_id = p_task_item_id; - PERFORM evaluation__delete_answer(answer_id) from evaluation_answers where task_item_id = p_task_item_id; - PERFORM evaluation__delete_task_sol(solution_id) from evaluation_tasks_sols where task_item_id = p_task_item_id; - PERFORM evaluation__delete_grades_sheet(grades_sheet_id) from evaluation_grades_sheets where task_item_id = p_task_item_id; - - delete from evaluation_tasks where task_id = p_task_item_id; - - PERFORM content_revision__delete(task_id) from evaluation_tasks where task_item_id = p_task_item_id; - - return 0; - -end;' language 'plpgsql'; - create function task__name(integer) returns varchar as ' declare @@ -528,284 +225,8 @@ ' language 'plpgsql'; --------------------------------------- --- TASKS SOLUTIONS ---------------------------------------- - -create function evaluation__new_task_sol (integer, integer, integer, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar) -returns integer as ' -declare - p_item_id alias for $1; - p_revision_id alias for $2; - p_task_item_id alias for $3; - p_object_type alias for $4; - p_creation_date alias for $5; - p_creation_user alias for $6; - p_creation_ip alias for $7; - p_title alias for $8; -- default null - p_publish_date alias for $9; - p_nls_language alias for $10; -- default null - p_mime_type alias for $11; -- default null - - v_revision_id integer; - -begin - - v_revision_id := content_revision__new( - p_title, -- title - ''task solution'', -- description - p_publish_date, -- publish_date - p_mime_type, -- mime_type - p_nls_language, -- nls_language - null, -- data - p_item_id, -- item_id - p_revision_id, -- revision_id - p_creation_date, -- creation_date - p_creation_user, -- creation_user - p_creation_ip, -- creation_ip - null -- content length - ); - - insert into evaluation_tasks_sols - (solution_id, - solution_item_id, - task_item_id) - values - (v_revision_id, - p_item_id, - p_task_item_id); - - return v_revision_id; -end; -' language 'plpgsql'; - -create function evaluation__delete_task_sol (integer) -returns integer as ' -declare - p_solution_id alias for $1; -begin - - delete from evaluation_tasks_sols where solution_id = p_solution_id; - - PERFORM content_revision__delete(p_solution_id); - - return 0; - -end;' language 'plpgsql'; - - ---------------------------------------- --- STUDENT ANSWERS ---------------------------------------- - - -create function evaluation__new_answer (integer, integer, integer, integer, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar) -returns integer as ' -declare - p_item_id alias for $1; - p_revision_id alias for $2; - p_task_item_id alias for $3; - p_party_id alias for $4; - p_object_type alias for $5; - p_creation_date alias for $6; - p_creation_user alias for $7; - p_creation_ip alias for $8; - p_title alias for $9; -- default null - p_publish_date alias for $10; - p_nls_language alias for $11; -- default null - p_mime_type alias for $12; -- default null - - v_revision_id integer; - -begin - - v_revision_id := content_revision__new( - p_title, -- title - ''evaluation answer'', -- description - p_publish_date, -- publish_date - p_mime_type, -- mime_type - p_nls_language, -- nls_language - null, -- data - p_item_id, -- item_id - p_revision_id, -- revision_id - p_creation_date, -- creation_date - p_creation_user, -- creation_user - p_creation_ip, -- creation_ip - null -- content length - ); - - insert into evaluation_answers - (answer_id, - answer_item_id, - task_item_id, - party_id) - values - (v_revision_id, - p_item_id, - p_task_item_id, - p_party_id); - - return v_revision_id; -end; -' language 'plpgsql'; - - -create function evaluation__delete_answer (integer) -returns integer as ' -declare - p_answer_id alias for $1; -begin - - delete from evaluation_answers where answer_id = p_answer_id; - - PERFORM content_revision__delete(p_answer_id); - - return 0; - -end;' language 'plpgsql'; - ---------------------------------------- --- GRADES SHEETS ---------------------------------------- - -create function evaluation__new_grades_sheet (integer, integer, integer, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar) -returns integer as ' -declare - p_item_id alias for $1; - p_revision_id alias for $2; - p_task_item_id alias for $3; - p_object_type alias for $4; - p_creation_date alias for $5; - p_creation_user alias for $6; - p_creation_ip alias for $7; - p_title alias for $8; -- default null - p_publish_date alias for $9; - p_nls_language alias for $10; -- default null - p_mime_type alias for $11; -- default null - - v_revision_id integer; - -begin - - v_revision_id := content_revision__new( - p_title, -- title - ''grades sheet'', -- description - p_publish_date, -- publish_date - p_mime_type, -- mime_type - p_nls_language, -- nls_language - null, -- data - p_item_id, -- item_id - p_revision_id, -- revision_id - current_timestamp, -- creation_date - p_creation_user, -- creation_user - p_creation_ip, -- creation_ip - null -- content length - ); - - insert into evaluation_grades_sheets - (grades_sheet_id, - grades_sheet_item_id, - task_item_id) - values - (v_revision_id, - p_item_id, - p_task_item_id); - - return v_revision_id; -end; -' language 'plpgsql'; - -create function evaluation__delete_grades_sheet (integer) -returns integer as ' -declare - p_grades_sheet_id alias for $1; -begin - - delete from evaluation_grades_sheets where grades_sheet_id = p_grades_sheet_id; - - PERFORM content_revision__delete(p_grades_sheet_id); - - return 0; - -end;' language 'plpgsql'; - ---------------------------------------- --- STUDENT EVALUATIONS ---------------------------------------- - -create function evaluation__new_student_eval (integer, integer, integer, integer, numeric, char, text, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar) -returns integer as ' -declare - p_item_id alias for $1; - p_revision_id alias for $2; - p_task_item_id alias for $3; - p_party_id alias for $4; - p_grade alias for $5; - p_show_student_p alias for $6; - p_description alias for $7; - p_object_type alias for $8; - p_creation_date alias for $9; - p_creation_user alias for $10; - p_creation_ip alias for $11; - p_title alias for $12; -- default null - p_publish_date alias for $13; - p_nls_language alias for $14; -- default null - p_mime_type alias for $15; -- default null - - v_revision_id integer; - -begin - - v_revision_id := content_revision__new( - p_title, -- title - p_description, -- description - p_publish_date, -- publish_date - p_mime_type, -- mime_type - p_nls_language, -- nls_language - null, -- data - p_item_id, -- item_id - p_revision_id, -- revision_id - current_timestamp, -- creation_date - p_creation_user, -- creation_user - p_creation_ip, -- creation_ip - null -- content length - ); - - insert into evaluation_student_evals - (evaluation_id, - evaluation_item_id, - task_item_id, - party_id, - grade, - show_student_p) - values - (v_revision_id, - p_item_id, - p_task_item_id, - p_party_id, - p_grade, - p_show_student_p); - - return v_revision_id; -end;' language 'plpgsql'; - -create function evaluation__delete_student_eval (integer) -returns integer as ' -declare - p_evaluation_id alias for $1; -begin - - delete from evaluation_student_evals where evaluation_id = p_evaluation_id; - - PERFORM content_revision__delete(p_evaluation_id); - - return 0; - -end;' language 'plpgsql'; - ---------------------------------------- -- EVALUATION TASK GROUPS --------------------------------------- - create function evaluation__new_evaluation_task_group(integer,varchar,varchar,timestamptz,integer,varchar,integer,integer) returns integer as ' declare @@ -1049,250 +470,6 @@ end;' language 'plpgsql'; -create function evaluation__new_folder (varchar,varchar,text,integer,varchar) -returns varchar as ' -declare - p_name alias for $1; - p_label alias for $2; - p_description alias for $3; - p_parent_id alias for $4; - p_content_type alias for $5; - - v_folder_id cr_folders.folder_id%TYPE; - -begin - - v_folder_id := content_folder__new( - p_name, -- name - p_label, -- label - p_description, -- description - p_parent_id -- parent_id - ); - -- associate content types witQh the folder - PERFORM content_folder__register_content_type ( - v_folder_id, -- folder_id - p_content_type, -- content_type - ''t'' -- include_subtypes - ); - - return v_folder_id; -end;' language 'plpgsql'; - -create function evaluation__delete_all_folders_and_contents () -returns integer as ' -declare - v_folder_id cr_folders.folder_id%TYPE; - v_item_id cr_items.item_id%TYPE; - v_item_cursor RECORD; - -begin - - select content_item__get_id(''evaluation_tasks_sols'', null, ''f'') into v_folder_id from dual; - - -- delete all contents of the folder - FOR v_item_cursor IN - select item_id - from cr_items - where parent_id = v_folder_id - LOOP - -- all attached types/item are deleted - PERFORM evaluation__delete_grade(v_item_cursor.item_id); - END LOOP; - - -- unregister_content_types - PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id - ''content_revision'', -- content_type - ''t'' -- include_subtypes - ); - PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id - ''evaluation_tasks_sols'', -- content_type - ''t'' -- include_subtypes - ); - - -- this table must not hold reference to ''evaluation_tasks_sols'' type - delete from cr_folder_type_map where content_type = ''evaluation_tasks_sols''; - - -- delete news folder - PERFORM content_folder__delete(v_folder_id); - ----------------- - - select content_item__get_id(''evaluation_answers'', null, ''f'') into v_folder_id from dual; - - -- delete all contents of the folder - FOR v_item_cursor IN - select item_id - from cr_items - where parent_id = v_folder_id - LOOP - -- all attached types/item are deleted - PERFORM evaluation__delete_grade(v_item_cursor.item_id); - END LOOP; - - -- unregister_content_types - PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id - ''content_revision'', -- content_type - ''t'' -- include_subtypes - ); - PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id - ''evaluation_answers'', -- content_type - ''t'' -- include_subtypes - ); - - -- this table must not hold reference to ''evaluation_answers'' type - delete from cr_folder_type_map where content_type = ''evaluation_answers''; - - -- delete news folder - PERFORM content_folder__delete(v_folder_id); - ----------------- - - select content_item__get_id(''evaluation_student_evals'', null, ''f'') into v_folder_id from dual; - - -- delete all contents of the folder - FOR v_item_cursor IN - select item_id - from cr_items - where parent_id = v_folder_id - LOOP - -- all attached types/item are deleted - PERFORM evaluation__delete_grade(v_item_cursor.item_id); - END LOOP; - - -- unregister_content_types - PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id - ''content_revision'', -- content_type - ''t'' -- include_subtypes - ); - PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id - ''evaluation_student_evals'', -- content_type - ''t'' -- include_subtypes - ); - - -- this table must not hold reference to ''evaluation_student_evals'' type - delete from cr_folder_type_map where content_type = ''evaluation_student_evals''; - - -- delete news folder - PERFORM content_folder__delete(v_folder_id); - ----------------- - - select content_item__get_id(''evaluation_grades_sheets'', null, ''f'') into v_folder_id from dual; - - -- delete all contents of the folder - FOR v_item_cursor IN - select item_id - from cr_items - where parent_id = v_folder_id - LOOP - -- all attached types/item are deleted - PERFORM evaluation__delete_grade(v_item_cursor.item_id); - END LOOP; - - -- unregister_content_types - PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id - ''content_revision'', -- content_type - ''t'' -- include_subtypes - ); - PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id - ''evaluation_grades_sheets'', -- content_type - ''t'' -- include_subtypes - ); - - -- this table must not hold reference to ''evaluation_grades_sheets'' type - delete from cr_folder_type_map where content_type = ''evaluation_grades_sheets''; - - -- delete news folder - PERFORM content_folder__delete(v_folder_id); - ----------------- - - -- delete all contents - FOR v_item_cursor IN - select etg.group_id - from evaluation_tasks et, evaluation_task_groups etg - where etg.task_item_id = et.task_item_id - LOOP - PERFORM evaluation__delete_evaluation_task_group(v_item_cursor.group_id); - END LOOP; - ----------------- - - select content_item__get_id(''evaluation_tasks'', null, ''f'') into v_folder_id from dual; - - -- delete all contents of the folder - FOR v_item_cursor IN - select item_id - from cr_items - where parent_id = v_folder_id - LOOP - -- all attached types/item are deleted - PERFORM evaluation__delete_grade(v_item_cursor.item_id); - END LOOP; - - -- unregister_content_types - PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id - ''content_revision'', -- content_type - ''t'' -- include_subtypes - ); - PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id - ''evaluation_tasks'', -- content_type - ''t'' -- include_subtypes - ); - - -- this table must not hold reference to ''evaluation_tasks'' type - delete from cr_folder_type_map where content_type = ''evaluation_tasks''; - - -- delete news folder - PERFORM content_folder__delete(v_folder_id); - ---------------- - - select content_item__get_id(''evaluation_grades'', null, ''f'') into v_folder_id from dual; - - -- delete all contents of the folder - FOR v_item_cursor IN - select item_id - from cr_items - where parent_id = v_folder_id - LOOP - -- all attached types/item are deleted - PERFORM evaluation__delete_grade(v_item_cursor.item_id); - END LOOP; - - -- unregister_content_types - PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id - ''content_revision'', -- content_type - ''t'' -- include_subtypes - ); - PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id - ''evaluation_grades'', -- content_type - ''t'' -- include_subtypes - ); - - -- this table must not hold reference to ''evaluation_grades'' type - delete from cr_folder_type_map where content_type = ''evaluation_grades''; - - -- delete news folder - PERFORM content_folder__delete(v_folder_id); - - - return 0; -end;' language 'plpgsql'; - - create function evaluation__delete_contents (integer) returns integer as ' declare @@ -1303,39 +480,7 @@ v_item_cursor RECORD; begin - - -- delete all contents FOR v_item_cursor IN - select ea.answer_id - from evaluation_answersi ea, acs_objects ao - where ea.item_id = ao.object_id - and ao.context_id = p_package_id - LOOP - PERFORM evaluation__delete_answer(v_item_cursor.answer_id); - END LOOP; - - -- delete all contents - FOR v_item_cursor IN - select ets.solution_id - from evaluation_tasks_solsi ets, acs_objects ao - where ets.item_id = ao.object_id - and ao.context_id = p_package_id - LOOP - PERFORM evaluation__delete_task_sol(v_item_cursor.solution_id); - END LOOP; - - -- delete all contents - FOR v_item_cursor IN - select egs.grades_sheet_id - from evaluation_grades_sheetsi egs, acs_objects ao - where egs.item_id = ao.object_id - and ao.context_id = p_package_id - LOOP - PERFORM evaluation__delete_grades_sheet(v_item_cursor.grades_sheet_id); - END LOOP; - - -- delete all contents - FOR v_item_cursor IN select etg.group_id from evaluation_tasksi et, acs_objects ao, evaluation_task_groups etg where et.item_id = ao.object_id @@ -1344,159 +489,6 @@ LOOP PERFORM evaluation__delete_evaluation_task_group(v_item_cursor.group_id); END LOOP; - - -- delete all contents - FOR v_item_cursor IN - select ese.evaluation_id - from evaluation_student_evalsi ese, acs_objects ao - where ese.item_id = ao.object_id - and ao.context_id = p_package_id - LOOP - PERFORM evaluation__delete_student_eval(v_item_cursor.evaluation_id); - END LOOP; - - -- delete all contents - FOR v_item_cursor IN - select et.task_id - from evaluation_tasksi et, acs_objects ao - where et.item_id = ao.object_id - and ao.context_id = p_package_id - LOOP - PERFORM evaluation__delete_task(v_item_cursor.task_id); - END LOOP; - - -- delete all contents - FOR v_item_cursor IN - select eg.grade_id - from evaluation_gradesi eg, acs_objects ao - where eg.item_id = ao.object_id - and ao.context_id = p_package_id - LOOP - PERFORM evaluation__delete_grade(v_item_cursor.grade_id); - END LOOP; - - return 0; +return 0; end;' language 'plpgsql'; - -create function evaluation__delete_folder (integer,varchar) -returns integer as ' -declare - p_folder_id alias for $1; - p_content_type alias for $2; - - v_item_cursor RECORD; -begin - - FOR v_item_cursor IN - select item_id - from cr_items - where parent_id = p_folder_id - LOOP - PERFORM content_item__delete(v_item_cursor.item_id); - END LOOP; - - -- unregister_content_types - PERFORM content_folder__unregister_content_type ( - p_folder_id, -- folder_id - ''content_revision'', -- content_type - ''t'' -- include_subtypes - ); - PERFORM content_folder__unregister_content_type ( - p_folder_id, -- folder_id - p_content_type, -- content_type - ''t'' -- include_subtypes - ); - - delete from cr_folder_type_map where content_type = p_content_type; - - -- delete folder - PERFORM content_folder__delete(p_folder_id); - - return 0; -end;' language 'plpgsql'; - ---------------------------------------- --- TEMPLATES ---------------------------------------- - -create or replace function inline_0 () -returns integer as' -declare - template_id integer; -begin - - -- Create the (default) content type template - - template_id := content_template__new( - ''evaluation-tasks-default'', -- name - ''@text;noquote@'', -- text - true -- is_live - ); - - -- Register the template for the content type - - perform content_type__register_template( - ''evaluation_tasks'', -- content_type - template_id, -- template_id - ''public'', -- use_context - ''t'' -- is_default - ); - - -- Create the (default) content type template - - template_id := content_template__new( - ''evaluation-tasks-sols-default'', -- name - ''@text;noquote@'', -- text - true -- is_live - ); - - -- Register the template for the content type - - perform content_type__register_template( - ''evaluation_tasks_sols'', -- content_type - template_id, -- template_id - ''public'', -- use_context - ''t'' -- is_default - ); - - -- Create the (default) content type template - - template_id := content_template__new( - ''evaluation-answers-default'', -- name - ''@text;noquote@'', -- text - true -- is_live - ); - - -- Register the template for the content type - - perform content_type__register_template( - ''evaluation_answers'', -- content_type - template_id, -- template_id - ''public'', -- use_context - ''t'' -- is_default - ); - - -- Create the (default) content type template - - template_id := content_template__new( - ''evaluation-grades-sheets-default'', -- name - ''@text;noquote@'', -- text - true -- is_live - ); - - -- Register the template for the content type - - perform content_type__register_template( - ''evaluation_grades_sheets'', -- content_type - template_id, -- template_id - ''public'', -- use_context - ''t'' -- is_default - ); - - return null; -end;' language 'plpgsql'; - -select inline_0(); -drop function inline_0(); - \i evaluation-calendar-create.sql Index: openacs-4/packages/evaluation/sql/postgresql/evaluation-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/sql/postgresql/evaluation-drop.sql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/evaluation/sql/postgresql/evaluation-drop.sql 10 Sep 2004 19:16:29 -0000 1.9 +++ openacs-4/packages/evaluation/sql/postgresql/evaluation-drop.sql 17 Dec 2004 18:11:00 -0000 1.10 @@ -1,75 +1,6 @@ -- jopez@galileo.edu - \i evaluation-calendar-drop.sql - --- Unregister the content template -select content_type__unregister_template ( - 'evaluation_tasks', - content_type__get_template('evaluation_tasks','public'), - 'public' -); --- Unregister the content template -select content_type__unregister_template ( - 'evaluation_tasks_sols', - content_type__get_template('evaluation_tasks_sols','public'), - 'public' -); --- Unregister the content template -select content_type__unregister_template ( - 'evaluation_answers', - content_type__get_template('evaluation_answers','public'), - 'public' -); --- Unregister the content template -select content_type__unregister_template ( - 'evaluation_grades_sheets', - content_type__get_template('evaluation_grades_sheets','public'), - 'public' -); - --- deleting templates create function inline_0 () -returns integer as ' -declare - v_template_id cr_templates.template_id%TYPE; - v_item_cursor RECORD; - -begin - - FOR v_item_cursor IN - select template_id - from cr_templates, cr_items - where name=''evaluation-tasks-default'' - LOOP - PERFORM content_template__delete(v_item_cursor.template_id); - END LOOP; - - FOR v_item_cursor IN - select template_id - from cr_templates, cr_items - where name=''evaluation-tasks-sols-default'' - LOOP - PERFORM content_template__delete(v_item_cursor.template_id); - END LOOP; - - FOR v_item_cursor IN - select template_id - from cr_templates, cr_items - where name=''evaluation-answers-default'' - LOOP - PERFORM content_template__delete(v_item_cursor.template_id); - END LOOP; - - return 0; -end; -' language 'plpgsql'; - -select inline_0 (); -drop function inline_0 (); - -select evaluation__delete_all_folders_and_contents (); - -create function inline_0 () returns integer as' declare del_rec record; @@ -99,6 +30,7 @@ select inline_0 (); drop function inline_0 (); + delete from acs_objects where object_type = 'evaluation_grades'; delete from acs_objects where object_type = 'evaluation_tasks'; delete from acs_objects where object_type = 'evaluation_tasks_sols'; @@ -107,7 +39,6 @@ delete from acs_objects where object_type = 'evaluation_student_evals'; delete from acs_objects where object_type = 'evaluation_task_groups'; delete from acs_objects where object_type = 'evaluation_task_group_rel'; - delete from acs_attributes where object_type = 'evaluation_task_groups'; delete from acs_object_type_tables where object_type = 'evaluation_task_groups'; delete from group_types where group_type = 'evaluation_task_groups'; @@ -161,64 +92,18 @@ drop view evaluation_gradesx; drop table evaluation_grades; -drop function evaluation__new_item (integer,varchar,varchar,integer,integer,timestamptz,varchar,varchar,text,varchar,varchar,text,varchar,varchar,varchar); - --------------------------------------- -- GRADES --------------------------------------- -drop function evaluation__new_grade (integer, integer, varchar, varchar, numeric, varchar, timestamptz, integer, varchar, varchar, varchar, timestamptz, varchar, varchar); - -drop function evaluation__delete_grade (integer); - drop function grade__name(integer); --------------------------------------- -- TASKS --------------------------------------- -drop function evaluation__new_task (integer, integer, varchar, integer, integer, varchar, numeric, timestamptz, char, char, char, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar); - -drop function evaluation__delete_task (integer); - drop function task__name(integer); ---------------------------------------- --- TASKS SOLUTIONS ---------------------------------------- - -drop function evaluation__new_task_sol (integer, integer, integer, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar); - -drop function evaluation__delete_task_sol (integer); - ---------------------------------------- --- STUDENT ANSWERS ---------------------------------------- - -drop function evaluation__new_answer (integer, integer, integer, integer, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar); - -drop function evaluation__delete_answer (integer); - ---------------------------------------- --- GRADES SHEETS ---------------------------------------- - -drop function evaluation__new_grades_sheet (integer, integer, integer, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar); - -drop function evaluation__delete_grades_sheet (integer); - ---------------------------------------- --- STUDENT EVALUATIONS ---------------------------------------- - -drop function evaluation__new_student_eval (integer, integer, integer, integer, numeric, char, text, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar); - -drop function evaluation__delete_student_eval (integer); - ---------------------------------------- --- EVALUATION TASK GROUPS ---------------------------------------- - drop function evaluation__new_evaluation_task_group(integer,varchar,varchar,timestamptz,integer,varchar,integer,integer); drop function evaluation__delete_evaluation_task_group(integer); @@ -249,12 +134,5 @@ drop function evaluation__party_id (integer,integer); -drop function evaluation__new_folder (varchar,varchar,text,integer,varchar); - drop function evaluation__delete_contents (integer); -drop function evaluation__delete_folder (integer,varchar); - -drop function evaluation__delete_all_folders_and_contents (); - - Index: openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl 10 Sep 2004 19:16:29 -0000 1.8 +++ openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl 17 Dec 2004 18:11:00 -0000 1.9 @@ -16,9 +16,10 @@ ad_proc -public evaluation::apm::package_install { -} { +} { + Does the integration whith the notifications package. -} { +} { db_transaction { # Create the impl and aliases for one assignment @@ -38,9 +39,66 @@ # Enable the delivery intervals and delivery methods for a specific evaluation enable_intervals_and_methods -type_id $type_id - - } +#Create the conten_type +ns_log notice "Crea los Content Type" +content::type::create_type -content_type {evaluation_grades} -supertype {content_revision} -pretty_name {Evaluation Grade} -pretty_plural {Evaluation Grades} -table_name {evaluation_grades} -id_column {grade_id} +content::type::create_type -content_type {evaluation_tasks} -supertype {content_revision} -pretty_name {Evaluation Task} -pretty_plural {Evaluation Tasks} -table_name {evaluation_tasks} -id_column {task_id} +content::type::create_type -content_type {evaluation_tasks_sols} -supertype {content_revision} -pretty_name {Evaluation Task Solution} -pretty_plural {Evaluation Tasks Solutions} -table_name {evaluation_tasks_sols} -id_column {solution_id} +content::type::create_type -content_type {evaluation_answers} -supertype {content_revision} -pretty_name {Student Answer} -pretty_plural {Student Answers} -table_name {evaluation_answers} -id_column {answer_id} +content::type::create_type -content_type {evaluation_student_evals} -supertype {content_revision} -pretty_name {Student Evaluation} -pretty_plural {Student Evaluations} -table_name {evaluation_student_evals} -id_column {evaluation_id} +content::type::create_type -content_type {evaluation_grades_sheets} -supertype {content_revision} -pretty_name {Evaluation Grades Sheet} -pretty_plural {Evaluation Grades Sheets} -table_name {evaluation_grades_sheets} -id_column {grades_sheet_id} + +#Create the new and register template +ns_log notice "Crea y Registra los Template" +set template_id [content::template::new -name {evaluation-tasks-default}] +content::type::register_template -content_type {evaluation_tasks} -template_id $template_id -use_context {public} -is_default {t} +set template_id [content::template::new -name {evaluation-tasks-sols-default}] +content::type::register_template -content_type {evaluation_tasks_sols} -template_id $template_id -use_context {public} -is_default {t} +set template_id [content::template::new -name {evaluation-answers-default}] +content::type::register_template -content_type {evaluation_answers} -template_id $template_id -use_context {public} -is_default {t} +set template_id [content::template::new -name {evaluation-grades-sheets-default}] +content::type::register_template -content_type {evaluation_grades_sheets} -template_id $template_id -use_context {public} -is_default {t} + +#evaluation_grades +ns_log notice "Crea los Atributos de Evaluation Grades" +content::type::create_attribute -content_type {evaluation_grades} -attribute_name {grade_item_id} -datatype {number} -pretty_name {grade_item_id} -column_spec {integer} +content::type::create_attribute -content_type {evaluation_grades} -attribute_name {grade_name} -datatype {string} -pretty_name {grade_name} -column_spec {varchar(100)} +content::type::create_attribute -content_type {evaluation_grades} -attribute_name {grade_plural_name} -datatype {string} -pretty_name {grade_plural_name} -column_spec {varchar(100)} +content::type::create_attribute -content_type {evaluation_grades} -attribute_name {comments} -datatype {string} -pretty_name {HTML display Options} -column_spec {varchar(500)} +content::type::create_attribute -content_type {evaluation_grades} -attribute_name {weight} -datatype {number} -pretty_name { weight} -column_spec {numeric} +#evaluation_tasks +ns_log notice "Crea los Atributos de Evaluation tasks" +content::type::create_attribute -content_type {evaluation_tasks} -attribute_name {task_item_id} -datatype {number} -pretty_name {task_item_id} -column_spec {integer} +content::type::create_attribute -content_type {evaluation_tasks} -attribute_name {task_name} -datatype {number} -pretty_name {task_name} -column_spec {integer} +content::type::create_attribute -content_type {evaluation_tasks} -attribute_name {number_of_members} -datatype {string} -pretty_name {number_of_members} -column_spec {varchar} +content::type::create_attribute -content_type {evaluation_tasks} -attribute_name {due_date} -datatype {number} -pretty_name {due_date} -column_spec {timestamptz} +content::type::create_attribute -content_type {evaluation_tasks} -attribute_name {grade_item_id} -datatype {number} -pretty_name {grade_item_id} -column_spec {integer} +content::type::create_attribute -content_type {evaluation_tasks} -attribute_name {weight} -datatype {number} -pretty_name {weight} -column_spec {numeric} +content::type::create_attribute -content_type {evaluation_tasks} -attribute_name {online_p} -datatype {string} -pretty_name {online_p} -column_spec {varchar(1)} +content::type::create_attribute -content_type {evaluation_tasks} -attribute_name {late_submit_p} -datatype {string} -pretty_name {late_submit_p} -column_spec {varchar(1)} +content::type::create_attribute -content_type {evaluation_tasks} -attribute_name {requires_grade_p} -datatype {string} -pretty_name {requires_grade_p} -column_spec {varchar(1)} +#evaluation_tasks_sols +ns_log notice "Crea los Atributos de Evluation Tasks Sols" +content::type::create_attribute -content_type {evaluation_tasks_sols} -attribute_name {solution_item_id} -datatype {number} -pretty_name {solution_item_id} -column_spec {integer} +content::type::create_attribute -content_type {evaluation_tasks_sols} -attribute_name {task_item_id} -datatype {number} -pretty_name {task_item_id} -column_spec {integer} +#evaluation_answers +ns_log notice "Crea los Atributos de Evaluation Answers" +content::type::create_attribute -content_type {evaluation_answers} -attribute_name {answer_item_id} -datatype {number} -pretty_name {answer_item_id} -column_spec {integer} +content::type::create_attribute -content_type {evaluation_answers} -attribute_name {party_id} -datatype {number} -pretty_name {party_id} -column_spec {integer} +content::type::create_attribute -content_type {evaluation_answers} -attribute_name {task_item_id} -datatype {number} -pretty_name {task_item_id} -column_spec {integer} +#evaluation_student_evals +ns_log notice "Crea los Atributos de Evaluation Student Evals" +content::type::create_attribute -content_type {evaluation_student_evals} -attribute_name {evaluation_item_id} -datatype {number} -pretty_name {evaluation_item_id} -column_spec {integer} +content::type::create_attribute -content_type {evaluation_student_evals} -attribute_name {task_item_id} -datatype {number} -pretty_name {task_item_id} -column_spec {integer} +content::type::create_attribute -content_type {evaluation_student_evals} -attribute_name {party_id} -datatype {number} -pretty_name {party_id} -column_spec {integer} +content::type::create_attribute -content_type {evaluation_student_evals} -attribute_name {grade} -datatype {number} -pretty_name {grade} -column_spec {numeric} +content::type::create_attribute -content_type {evaluation_student_evals} -attribute_name {show_student_p} -datatype {string} -pretty_name {show_student_p} -column_spec {varchar(1)} +#evaluation_grades_sheets +ns_log notice "Crea los Atributos de Evaluation Grades Sheets" +content::type::create_attribute -content_type {evaluation_grades_sheets} -attribute_name {grades_sheet_item_id} -datatype {number} -pretty_name {grades_sheet_item_id} -column_spec {integer} +content::type::create_attribute -content_type {evaluation_grades_sheets} -attribute_name {task_item_id} -datatype {number} -pretty_name {task_item_id} -column_spec {integer} } +} ad_proc -public evaluation::apm::package_uninstall { } { @@ -49,7 +107,7 @@ } { db_transaction { - +ns_log notice "Eliminado Notification" # Delete the type_id for a specific assignment notification::type::delete -short_name one_assignment_notif @@ -61,8 +119,57 @@ # Delete the implementation for the notification of an evaluation delete_one_evaluation_impl - - } + +#Delete content type template +ns_log notice "Eliminado Template" +set template_id [content::type::get_template -content_type {evaluation_tasks} -use_context {public}] +content::type::unregister_template -content_type {evaluation_tasks} -template_id $template_id -use_context {public} +content::template::delete -template_id $template_id +set template_id [content::type::get_template -content_type {evaluation_tasks_sols} -use_context {public}] +content::type::unregister_template -content_type {evaluation_tasks_sols} -template_id $template_id -use_context {public} +content::template::delete -template_id $template_id +set template_id [content::type::get_template -content_type {evaluation_answers} -use_context {public}] +content::type::unregister_template -content_type {evaluation_answers} -template_id $template_id -use_context {public} +content::template::delete -template_id $template_id +set template_id [content::type::get_template -content_type {evaluation_grades_sheets} -use_context {public}] +content::type::unregister_template -content_type {evaluation_grades_sheets} -template_id $template_id -use_context {public} +content::template::delete -template_id $template_id +#Delete content type attribute +ns_log notice "Eliminando los Atributos de las Tablas" +content::type::drop_attribute -content_type {evaluation_grades} -attribute_name {grade_item_id} +content::type::drop_attribute -content_type {evaluation_grades} -attribute_name {grade_name} +content::type::drop_attribute -content_type {evaluation_grades} -attribute_name {grade_plural_name} +content::type::drop_attribute -content_type {evaluation_grades} -attribute_name {comments} +content::type::drop_attribute -content_type {evaluation_grades} -attribute_name {weight} +content::type::drop_attribute -content_type {evaluation_tasks} -attribute_name {task_item_id} +content::type::drop_attribute -content_type {evaluation_tasks} -attribute_name {task_name} +content::type::drop_attribute -content_type {evaluation_tasks} -attribute_name {number_of_members} +content::type::drop_attribute -content_type {evaluation_tasks} -attribute_name {due_date} +content::type::drop_attribute -content_type {evaluation_tasks} -attribute_name {grade_item_id} +content::type::drop_attribute -content_type {evaluation_tasks} -attribute_name {weight} +content::type::drop_attribute -content_type {evaluation_tasks} -attribute_name {online_p} +content::type::drop_attribute -content_type {evaluation_tasks} -attribute_name {late_submit_p} +content::type::drop_attribute -content_type {evaluation_tasks} -attribute_name {requires_grade_p} +content::type::drop_attribute -content_type {evaluation_tasks_sols} -attribute_name {solution_item_id} +content::type::drop_attribute -content_type {evaluation_tasks_sols} -attribute_name {task_item_id} +content::type::drop_attribute -content_type {evaluation_answers} -attribute_name {answer_item_id} +content::type::drop_attribute -content_type {evaluation_answers} -attribute_name {party_id} +content::type::drop_attribute -content_type {evaluation_answers} -attribute_name {task_item_id} +content::type::drop_attribute -content_type {evaluation_student_evals} -attribute_name {evaluation_item_id} +content::type::drop_attribute -content_type {evaluation_student_evals} -attribute_name {task_item_id} +content::type::drop_attribute -content_type {evaluation_student_evals} -attribute_name {party_id} +content::type::drop_attribute -content_type {evaluation_student_evals} -attribute_name {grade} +content::type::drop_attribute -content_type {evaluation_student_evals} -attribute_name {show_student_p} +content::type::drop_attribute -content_type {evaluation_grades_sheets} -attribute_name {grades_sheet_item_id} +content::type::drop_attribute -content_type {evaluation_grades_sheets} -attribute_name {task_item_id} +#Delete Content type +ns_log notice "Eliminando los Content_Type" +content::type::drop_type -content_type {evaluation_grades} +content::type::drop_type -content_type {evaluation_tasks} +content::type::drop_type -content_type {evaluation_tasks_sols} +content::type::drop_type -content_type {evaluation_answers} +content::type::drop_type -content_type {evaluation_student_evals} +content::type::drop_type -content_type {evaluation_grades_sheets} } } ad_proc -public evaluation::apm::package_instantiate { @@ -87,7 +194,6 @@ Delete Evaluation stuff } { - - delete_contents -package_id $package_id - + + delete_contents -packagell folder and contents } Index: openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql,v diff -u -r1.17 -r1.18 --- openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql 27 Oct 2004 00:49:02 -0000 1.17 +++ openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql 17 Dec 2004 18:11:00 -0000 1.18 @@ -2,54 +2,6 @@ postgresql7.3 - - - - - select evaluation__new_item ( - :item_id, --item_id - :item_name, - null, - :creation_user, - :package_id, - now(), - :creation_ip, - :name, - :description, - 'text/plain', - null, - null, - 'text', - 'content_item', -- item_subtype - 'evaluation_grades' -- content_type - ); - - - - - - - - select evaluation__new_grade ( - :item_id, - :revision_id, - :name, - :plural_name, - :weight, - 'evaluation_grades', - now(), --creation date - :creation_user, - :creation_ip, - :revision_name, - :description, - now(), --publish date - null, --nls_language - 'text/plain' --mime_type - ); - - - - @@ -150,59 +102,6 @@ - - - - select evaluation__new_item ( - :item_id, --item_id - :item_name, - null, --locale - :creation_user, - :package_id, - current_timestamp, - :creation_ip, - :name, - :description, - :mime_type, --mime_type - null, --nls_language - null, --text - :storage_type, --storage_type - 'content_item', -- item_subtype - 'evaluation_tasks' -- content_type - ); - - - - - - - - select evaluation__new_task ( - :item_id, - :revision_id, - :name, - :number_of_members, - :grade_item_id, - :description, - :weight, - :due_date, - :late_submit_p, - :online_p, - :requires_grade_p, - :estimated_time, - 'evaluation_tasks', - now(), --creation date - :creation_user, - :creation_ip, - :title, - now(), --publish date - null, -- nls_language - :mime_type --mime_type - ); - - - - @@ -214,50 +113,6 @@ - - - - select evaluation__new_item ( - :item_id, --item_id - :item_name, - null, --locale - :creation_user, - :package_id, - current_timestamp, - :creation_ip, - :title, - 'task solution', - :mime_type, --mime_type - null, --nls_language - null, --text - :storage_type, --storage_type - 'content_item', -- item_subtype - 'evaluation_tasks_sols' -- content_type - ); - - - - - - - - select evaluation__new_task_sol ( - :item_id, - :revision_id, - :task_item_id, - 'evaluation_tasks_sols', - :creation_date, --creation date - :creation_user, - :creation_ip, - :title, - :publish_date, --publish date - null, -- nls_language - :mime_type --mime_type - ); - - - - @@ -269,51 +124,6 @@ - - - - select evaluation__new_item ( - :item_id, --item_id - :item_name, - null, --locale - :creation_user, - :package_id, - current_timestamp, - :creation_ip, - :title, - 'evaluation answer', - :mime_type, --mime_type - null, --nls_language - null, --text - :storage_type, --storage_type - 'content_item', -- item_subtype - 'evaluation_answers' -- content_type - ); - - - - - - - - select evaluation__new_answer ( - :item_id, - :revision_id, - :task_item_id, - :party_id, - 'evaluation_answers', - :creation_date, --creation date - :creation_user, - :creation_ip, - :title, - :publish_date, --publish date - null, -- nls_language - :mime_type --mime_type - ); - - - - @@ -398,50 +208,6 @@ - - - - select evaluation__new_item ( - :item_id, --item_id - :item_name, - null, --locale - :creation_user, - :package_id, - current_timestamp, - :creation_ip, - :title, - 'grades sheet', - :mime_type, --mime_type - null, --nls_language - null, --text - :storage_type, --storage_type - 'content_item', -- item_subtype - 'evaluation_grades_sheets' -- content_type - ); - - - - - - - - select evaluation__new_grades_sheet ( - :item_id, - :revision_id, - :task_item_id, - 'evaluation_grades_sheets', - :creation_date, --creation date - :creation_user, - :creation_ip, - :title, - :publish_date, --publish date - null, -- nls_language - :mime_type --mime_type - ); - - - - @@ -548,116 +314,6 @@ - - - - select evaluation__new_folder ( - 'evaluation_grades_'||:package_id, - 'evaluation_grades_'||:package_id, - 'Evaluation grades folder', - null, - 'evaluation_grades' - ); - - select evaluation__new_folder ( - 'evaluation_tasks_'||:package_id, - 'evaluation_tasks_'||:package_id, - 'Evaluation tasks folder', - null, - 'evaluation_tasks' - ); - - select evaluation__new_folder ( - 'evaluation_tasks_sols_'||:package_id, - 'evaluation_tasks_sols_'||:package_id, - 'Evaluation tasks solutions folder', - null, - 'evaluation_tasks_sols' - ); - - select evaluation__new_folder ( - 'evaluation_answers_'||:package_id, - 'evaluation_answers_'||:package_id, - 'Evaluation answers folder', - null, - 'evaluation_answers' - ); - - select evaluation__new_folder ( - 'evaluation_grades_sheets_'||:package_id, - 'evaluation_grades_sheets_'||:package_id, - 'Grades sheets folder', - null, - 'evaluation_grades_sheets' - ); - - select evaluation__new_folder ( - 'evaluation_student_evals_'||:package_id, - 'evaluation_student_evals_'||:package_id, - 'Evaluation student evaluations folder', - null, - 'evaluation_student_evals' - ); - - - - - - - - select evaluation__new_item ( - :exams_item_id, --item_id - :exams_item_name, - null, - :creation_user, - :package_id, - current_timestamp, - :creation_ip, - :exams_name, - :exams_desc, - 'text/plain', - null, - null, - 'text', - 'content_item', -- item_subtype - 'evaluation_grades' -- content_type - ); - - - - - - - - select evaluation__new_grade ( - :exams_item_id, - :exams_revision_id, - :exams_singular_name, - :exams_name, - 40, - 'evaluation_grades', - now(), --creation date - :creation_user, - :creation_ip, - :exams_revision_name, - :exams_desc, - now(), --publish date - null, --nls_language - 'text/plain' --mime_type - ); - - - - - - - - select content_item__set_live_revision ( - :exams_revision_id - ); - - - @@ -781,72 +437,6 @@ - - - - select evaluation__delete_folder ( - :ev_grades_sheets_fid, - 'evaluation_grades_sheets' - ); - - - - - - - - select evaluation__delete_folder ( - :ev_grades_fid, - 'evaluation_grades' - ); - - - - - - - - select evaluation__delete_folder ( - :ev_tasks_fid, - 'evaluation_tasks' - ); - - - - - - - - select evaluation__delete_folder ( - :ev_tasks_sols_fid, - 'evaluation_tasks_sols' - ); - - - - - - - - select evaluation__delete_folder ( - :ev_answers_fid, - 'evaluation_answers' - ); - - - - - - - - select evaluation__delete_folder ( - :ev_student_evals_fid, - 'evaluation_student_evals' - ); - - - - Index: openacs-4/packages/evaluation/tcl/evaluation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/evaluation-procs.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 8 Dec 2004 19:28:12 -0000 1.18 +++ openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 17 Dec 2004 18:11:00 -0000 1.19 @@ -83,6 +83,63 @@ } + +ad_proc -public evaluation::delete_grade { + -grade_id:required +} { + delete all grades +} { + db_1row get_grade_id { select grade_item_id from evaluation_grades where grade_id = :grade_id} + db_foreach del_rec { select task_item_id from evaluation_tasks where grade_item_id = :grade_item_id } { + db_foreach evaluation_delete_student_eval { select evaluation_id from evaluation_student_evals where task_item_id = :task_item_id } { + content::revision::delete -revision_id $evaluation_id + } + db_foreach evaluation_delete_answer { select answer_id from evaluation_answers where task_item_id = :task_item_id } { + content::revision::delete -revision_id $answer_id + } + db_foreach evaluation_delete_task_sol { select solution_id from evaluation_tasks_sols where task_item_id = :task_item_id } { + content::revision::delete -revision_id $solution_id + } + db_foreach evaluation_delete_grades_sheet { select grades_sheet_id from evaluation_grades_sheets where task_item_id = :task_item_id } { + content::revision::delete -revision_id $grades_sheet_id + } + db_foreach evaluation_delete_task { select task_id from evaluation_tasks where task_item_id = :task_item_id } { + content::revision::delete -revision_id $task_id } + } +# db_1row get_grade_id { select grade_id as grade_task_id from evaluation_grades where grade_item_id = :grade_item_id} + content::revision::delete -revision_id $grade_id +} + +ad_proc -public evaluation::delete_task { + -task_id:required +} { + delete all tasks +} { + db_1row get_grade_id { select task_item_id from evaluation_tasks where task_id = :task_id} + db_foreach evaluation_delete_student_eval { select evaluation_id from evaluation_student_evals where task_item_id = :task_item_id } { + content::revision::delete -revision_id $evaluation_id + } + db_foreach evaluation_delete_answer { select answer_id from evaluation_answers where task_item_id = :task_item_id } { + content::revision::delete -revision_id $answer_id + } + db_foreach evaluation_delete_task_sol { select solution_id from evaluation_tasks_sols where task_item_id = :task_item_id } { + content::revision::delete -revision_id $solution_id + } + db_foreach evaluation_delete_grades_sheet { select grades_sheet_id from evaluation_grades_sheets where task_item_id = :task_item_id } { + content::revision::delete -revision_id $grades_sheet_id + } +# db_1row get_task_id { select task_id as tasks_task_id from evaluation_tasks where task_item_id = :task_item_id } + content::revision::delete -revision_id $task_id +} + +ad_proc -public evaluation::delete_student_eval1 { + -evaluation_id:required +} { + delete all tasks +} { + content::revision::delete -revision_id $evaluation_id +} + ad_proc -public evaluation::notification::do_notification { -task_id:required -package_id:required @@ -151,17 +208,15 @@ -weight:required -name:required -plural_name:required -} { - +} { Build a new content revision of a evaluation subtype. If new_item_p is set true then a new item is first created, otherwise a new revision is created for the item indicated by item_id. @param item_id The item to update or create. @param content_type The type to make @param content_table - @param new_item_p If true make a new item using item_id - + @param new_item_p If true make a new item using item_id } { set package_id [ad_conn package_id] @@ -172,14 +227,19 @@ set revision_id [db_nextval acs_object_id_seq] set revision_name "${content_type}_${revision_id}" - +# set folder_id [content::folder::new -name "$content_type_$package_id" -label "$content_type_$package_id" -package_id $package_id ] + set folder_id [db_exec_plsql get_folder_id {select content_item__get_id(:content_type||'_'||:package_id,null,'f')}] if { $new_item_p } { - db_exec_plsql content_item_new { *SQL* } - + set item_id [content::item::new -item_id $item_id -parent_id $folder_id -content_type $content_type -name $item_name -context_id $package_id] } - - db_exec_plsql content_revision_new { *SQL* } - + set revision_id [content::revision::new \ + -item_id $item_id \ + -content_type $content_type \ + -description $description \ + -attributes [list [list weight $weight] \ + [list grade_name $name] \ + [list comments $description] \ [list grade_item_id $item_id] \ + [list grade_plural_name $plural_name]] ] return $revision_id } @@ -211,25 +271,19 @@ set day [lindex $now 2] set month [lindex $now 1] - set year [lindex $now 0] set interval_def [template::util::date::defaultInterval day] - for { set i [lindex $interval_def 0] } { $i <= $ndays } { incr i 1 } { + for { set i [lindex $interval_def 0] } { $i <= 15 } { incr i 1 } { incr day - if { [expr $day + 1] >= [lindex $interval_def 1] } { + if { [expr $day + $i] >= [lindex $interval_def 1] } { incr month 1 set day 1 - if { $month > 12 } { - incr year 1 - set month 1 - } } } # replace the hour and minute values in the now list with new values set now [lreplace $now 2 2 $day] set now [lreplace $now 1 1 $month] - set now [lreplace $now 0 0 $year] - + # set default time set now [lreplace $now 3 3 23] set now [lreplace $now 4 4 59] @@ -289,11 +343,9 @@ {-mime_type "text/plain"} {-item_name ""} } { - Build a new content revision of a task. If new_item_p is set true then a new item is first created, otherwise a new revision is created for the item indicated by item_id. - @param item_id The item to update or create. @param content_type The type to make @param content_table @@ -307,25 +359,29 @@ @late_submit_p If the students will be able to submit the task after due date @description Description of the task @storage_type File or text, depending on what are we going to store - } { - set package_id [ad_conn package_id] set creation_user [ad_conn user_id] set creation_ip [ad_conn peeraddr] - +# set folder_id [content::folder::new -name "$content_type_$package_id" -label "$content_type_$package_id" -package_id $package_id ] + set folder_id [db_exec_plsql get_folder_id {select content_item__get_id(:content_type||'_'||:package_id,null,'f')}] if { [empty_string_p $item_name] } { set item_name "${item_id}_${title}" } - set revision_id [db_nextval acs_object_id_seq] - if { $new_item_p } { - db_exec_plsql content_item_new { *SQL* } +# db_exec_plsql content_item_new { *SQL* } + set item_id [content::item::new -item_id $item_id -parent_id $folder_id -content_type {evaluation_tasks} -name $item_name -context_id $package_id -mime_type $mime_type -title $title -storage_type $storage_type] } - - db_exec_plsql content_revision_new { *SQL* } + set revision_id [content::revision::new \ + -item_id $item_id \ + -content_type {evaluation_tasks} \ + -mime_type $mime_type \ + -title $title \ + -description $description \ + -attributes [list [list weight $weight] \ [list task_name $name] \ [list task_item_id $item_id] \ [list online_p $online_p] \ [list grade_item_id $grade_item_id] \ [list due_date $due_date] \ [list late_submit_p $late_submit_p] \ [list requires_grade_p $requires_grade_p] \ [list number_of_members $number_of_members]] ] + # db_exec_plsql content_revision_new { *SQL* } # in order to find the file we have to set the name in cr_items the same that in cr_revisions db_dml update_item_name { *SQL* } return $revision_id @@ -362,7 +418,8 @@ set package_id [ad_conn package_id] set creation_user [ad_verify_and_get_user_id] set creation_ip [ad_conn peeraddr] - + #set folder_id [content::folder::new -name "$content_type_$package_id" -label "$content_type_$package_id" -package_id $package_id ] + set folder_id [db_exec_plsql get_folder_id {select content_item__get_id(:content_type||'_'||:package_id,null,'f')}] set item_name "${item_id}_${title}" set revision_id [db_nextval acs_object_id_seq] @@ -376,11 +433,19 @@ } if { $new_item_p } { - db_exec_plsql content_item_new { *SQL* } +# db_exec_plsql content_item_new { *SQL* } + set item_id [content::item::new -item_id $item_id -parent_id $folder_id -content_type $content_type -name $item_name -context_id $package_id -mime_type $mime_type -storage_type $storage_type -title $title] } - - db_exec_plsql content_revision_new { *SQL* } + set revision_id [content::revision::new \ + -item_id $item_id \ + -content_type $content_type \ + -mime_type $mime_type \ + -title $title \ + -attributes [list [list task_item_id $task_item_id] \ + [list solution_item_id $item_id]] ] +# db_exec_plsql content_revision_new { *SQL* } + # in order to find the file we have to set the name in cr_items the same that in cr_revisions db_dml update_item_name { *SQL* } return $revision_id @@ -419,7 +484,8 @@ set package_id [ad_conn package_id] set creation_user [ad_verify_and_get_user_id] set creation_ip [ad_conn peeraddr] - + #set folder_id [content::folder::new -name "$content_type_$package_id" -label "$content_type_$package_id" -package_id $package_id ] + set folder_id [db_exec_plsql get_folder_id {select content_item__get_id(:content_type||'_'||:package_id,null,'f')}] set item_name "${item_id}_${title}" set revision_id [db_nextval acs_object_id_seq] @@ -433,11 +499,19 @@ } if { $new_item_p } { - db_exec_plsql content_item_new { *SQL* } - } - - db_exec_plsql content_revision_new { *SQL* } +# db_exec_plsql content_item_new { *SQL* } + set item_id [content::item::new -item_id $item_id -parent_id $folder_id -content_type $content_type -name $item_name -context_id $package_id -mime_type $mime_type -title $title -storage_type $storage_type] + } +# db_exec_plsql content_revision_new { *SQL* } + set revision_id [content::revision::new \ + -item_id $item_id \ + -content_type $content_type \ + -mime_type $mime_type \ + -title $title\ + -attributes [list [list answer_item_id $item_id] \ + [list party_id $party_id] \ + [list task_item_id $task_item_id]] ] # in order to find the file we have to set the name in cr_items the same that in cr_revisions db_dml update_item_name { *SQL* } return $revision_id @@ -481,7 +555,8 @@ set package_id [ad_conn package_id] set creation_user [ad_verify_and_get_user_id] set creation_ip [ad_conn peeraddr] - + #set folder_id [content::folder::new -name "$content_type_$package_id" -label "$content_type_$package_id" -package_id $package_id ] + set folder_id [db_exec_plsql get_folder_id {select content_item__get_id(:content_type||'_'||:package_id,null,'f')}] set item_name "${item_id}_${title}" set revision_id [db_nextval acs_object_id_seq] @@ -495,13 +570,22 @@ } if { $new_item_p } { - db_exec_plsql content_item_new { *SQL* } - } - - db_exec_plsql content_revision_new { *SQL* } +# db_exec_plsql content_item_new { *SQL* } + set item_id [content::item::new -item_id $item_id -parent_id $folder_id -content_type $content_type -name $item_name -context_id $package_id -mime_type $mime_type -title $title -storage_type $storage_type] + } +# db_exec_plsql content_revision_new { *SQL* } + set revision_id [content::revision::new \ + -item_id $item_id \ + -content_type $content_type \ + -mime_type $mime_type \ + -title $title\ + -attributes [list [list evaluation_item_id $item_id] \ + [list party_id $party_id] \ + [list grade $grade] \ + [list show_student_p $show_student_p] \ + [list task_item_id $task_item_id]] ] } - ad_proc -public evaluation::new_evaluation_group { -group_id:required -group_name:required @@ -581,7 +665,8 @@ set package_id [ad_conn package_id] set creation_user [ad_verify_and_get_user_id] set creation_ip [ad_conn peeraddr] - + #set folder_id [content::folder::new -name "$content_type_$package_id" -label "$content_type_$package_id" -package_id $package_id ] + set folder_id [db_exec_plsql get_folder_id {select content_item__get_id(:content_type||'_'||:package_id,null,'f')}] set item_name "${item_id}_${title}" set revision_id [db_nextval acs_object_id_seq] @@ -595,11 +680,18 @@ } if { $new_item_p } { - db_exec_plsql content_item_new { *SQL* } - } - - db_exec_plsql content_revision_new { *SQL* } +#db_exec_plsql content_item_new { *SQL* } + set item_id [content::item::new -item_id $item_id -parent_id $folder_id -content_type $content_type -name $item_name -context_id $package_id -mime_type $mime_type -title $title -storage_type $storage_type] + } +#db_exec_plsql content_revision_new { *SQL* } + set revision_id [content::revision::new \ + -item_id $item_id \ + -content_type $content_type \ + -title $title \ + -mime_type $mime_type \ + -attributes [list [list grades_sheet_item_id $item_id] \ + [list task_item_id $task_item_id]] ] return $revision_id } @@ -776,44 +868,23 @@ set projects_name "[_ evaluation.Projects_]" set projects_singular_name "[_ evaluation.Project]" set projects_desc "[_ evaluation.lt_Projects_for_students]" - db_exec_plsql create_evaluation_folders { *SQL* } + set folder_id [content::folder::new -name "evaluation_grades_$package_id" -label "evaluation_grades_$package_id" -package_id $package_id ] + content::folder::register_content_type -folder_id $folder_id -content_type {evaluation_grades} -include_subtypes t - set creation_user [ad_verify_and_get_user_id] - set creation_ip [ad_conn peeraddr] - - set exams_item_id [db_nextval acs_object_id_seq] - set exams_item_name "evaluation_grades_${exams_item_id}" - set exams_revision_id [db_nextval acs_object_id_seq] - set exams_revision_name "evaluation_grades_${exams_revision_id}" - - db_exec_plsql exams_item_new { *SQL* } - - db_exec_plsql exams_revision_new { *SQL* } - - db_exec_plsql exams_live_revision { *SQL* } - - set projects_item_id [db_nextval acs_object_id_seq] - set projects_item_name "evaluation_grades_${projects_item_id}" - set projects_revision_id [db_nextval acs_object_id_seq] - set projects_revision_name "evaluation_grades_${projects_revision_id}" - - db_exec_plsql projects_item_new { *SQL* } - - db_exec_plsql projects_revision_new { *SQL* } + set folder_id [content::folder::new -name "evaluation_tasks_$package_id" -label "evaluation_tasks_$package_id" -package_id $package_id ] + content::folder::register_content_type -folder_id $folder_id -content_type {evaluation_tasks} -include_subtypes t - db_exec_plsql projects_live_revision { *SQL* } - - set tasks_item_id [db_nextval acs_object_id_seq] - set tasks_item_name "evaluation_grades_${tasks_item_id}" - set tasks_revision_id [db_nextval acs_object_id_seq] - set tasks_revision_name "evaluation_grades_${tasks_revision_id}" - - db_exec_plsql tasks_item_new { *SQL* } - - db_exec_plsql tasks_revision_new { *SQL* } - - db_exec_plsql tasks_live_revision { *SQL* } + set folder_id [content::folder::new -name "evaluation_tasks_sols_$package_id" -label "evaluation_tasks_sols_$package_id" -package_id $package_id ] + content::folder::register_content_type -folder_id $folder_id -content_type {evaluation_tasks_sols} -include_subtypes t + set folder_id [content::folder::new -name "evaluation_answers_$package_id" -label "evaluation_answers_$package_id" -package_id $package_id ] + content::folder::register_content_type -folder_id $folder_id -content_type {evaluation_answers} -include_subtypes t + + set folder_id [content::folder::new -name "evaluation_grades_sheets_$package_id" -label "evaluation_grades_sheets_$package_id" -package_id $package_id ] + content::folder::register_content_type -folder_id $folder_id -content_type {evaluation_grades_sheets} -include_subtypes t + + set folder_id [content::folder::new -name "evaluation_student_evals_$package_id" -label "evaluation_student_evals_$package_id" -package_id $package_id ] + content::folder::register_content_type -folder_id $folder_id -content_type {evaluation_student_evals} -include_subtypes t } } @@ -822,28 +893,110 @@ } { Helper for the apm_proc } { +#Delete all content templates +ns_log notice "Por Aqui paso esto" +db_foreach v1 { select ea.answer_id from evaluation_answersi ea, acs_objects ao where ea.item_id = ao.object_id and ao.context_id = p_package_id } { +content::revision::delete -revision_id $answer_id +} +db_foreach v2 { select ets.solution_id from evaluation_tasks_solsi ets, acs_objects ao where ets.item_id = ao.object_id and ao.context_id = p_package_id } { content::revision::delete -revision_id $solution_id } +db_foreach v3 { select egs.grades_sheet_id from evaluation_grades_sheetsi egs, acs_objects ao where egs.item_id = ao.object_id and ao.context_id = p_package_id } { +content::revision::delete -revision_id $grades_sheet_id } +db_foreach v4 { select ese.evaluation_id from evaluation_student_evalsi ese, acs_objects ao where ese.item_id = ao.object_id and ao.context_id = p_package_id } { +content::revision::delete -revision_id $evaluation_id } +db_foreach v5 { select et.task_id from evaluation_tasksi et, acs_objects ao where et.item_id = ao.object_id and ao.context_id = p_package_id } { +content::revision::delete -revision_id $task_id } +db_foreach v6 { select eg.grade_id from evaluation_gradesi eg, acs_objects ao where eg.item_id = ao.object_id and ao.context_id = p_package_id } { +content::revision::delete -revision_id $grade_id} - set ev_grades_fid [db_string get_f_id "select content_item__get_id('evaluation_grades_'||:package_id,null,'f')"] - set ev_grades_sheets_fid [db_string get_f_id "select content_item__get_id('evaluation_grades_sheets_'||:package_id,null,'f')"] - set ev_tasks_fid [db_string get_f_id "select content_item__get_id('evaluation_tasks_'||:package_id,null,'f')"] - set ev_tasks_sols_fid [db_string get_f_id "select content_item__get_id('evaluation_tasks_sols_'||:package_id,null,'f')"] - set ev_answers_fid [db_string get_f_id "select content_item__get_id('evaluation_answers_'||:package_id,null,'f')"] - set ev_student_evals_fid [db_string get_f_id "select content_item__get_id('evaluation_student_evals_'||:package_id,null,'f')"] +#Evaluation_Task_Sols +ns_log notice "Eliminado folder de Evaluation_Task_Sols" +set v_folder_id [content::item::get_id -item_path "evaluation_tasks_sols_$package_id" -resolve_index {f}] +ns_log notice "Numero de Folder $v_folder_id este es el numero" +db_foreach v11 { select item_id from cr_items where parent_id = :v_folder_id } { + evaluation::delete_grade -grade_item_id $item_id +} +content::folder::unregister_content_type -folder_id $v_folder_id -content_type {content_revision} -include_subtypes {t} +content::folder::unregister_content_type -folder_id $v_folder_id -content_type {evaluation_tasks_sols} -include_subtypes {t} +db_dml delete_v11 "delete from cr_folder_type_map where content_type = 'evaluation_tasks_sols'" +content::folder::delete -folder_id $v_folder_id + +#evaluation_answers +ns_log notice "Eliminando folder de evaluation_answer" +set v_folder_id [content::item::get_id -item_path "evaluation_answers_$package_id" -resolve_index {f}] +ns_log notice "Numero de Folder $v_folder_id este es el numero" +db_foreach v12 {select item_id from cr_items where parent_id = :v_folder_id } { + evaluation::delete_grade -grade_item_id $item_id } +content::folder::unregister_content_type -folder_id $v_folder_id -content_type {content_revision} -include_subtypes {t} +content::folder::unregister_content_type -folder_id $v_folder_id -content_type {evaluation_answers} -include_subtypes {t} +db_dml delete_v12 "delete from cr_folder_type_map where content_type = 'evaluation_answers'" +content::folder::delete -folder_id $v_folder_id + +#evaluation_students_eval +ns_log notice "Eliminando folder de evaluation_students_eval" +set v_folder_id [content::item::get_id -item_path "evaluation_student_evals_$package_id" -resolve_index {f}] +ns_log notice "Numero de Folder $v_folder_id este es el numero" +db_foreach v13 { select item_id from cr_items where parent_id = :v_folder_id } { + evaluation::delete_grade -grade_item_id $item_id } +content::folder::unregister_content_type -folder_id $v_folder_id -content_type {content_revision} -include_subtypes {t} +content::folder::unregister_content_type -folder_id $v_folder_id -content_type {evaluation_student_evals} -include_subtypes {t} +db_dml delete_v13 "delete from cr_folder_type_map where content_type = 'evaluation_student_evals'" +content::folder::delete -folder_id $v_folder_id + +#evaluation_grades_sheets +ns_log notice "Elimiando folder de evaluation_grades_sheets" +set v_folder_id [content::item::get_id -item_path "evaluation_grades_sheets_$package_id" -resolve_index {f}] +ns_log notice "Numero de Folder $v_folder_id este es el numero" +db_foreach v14 { select item_id from cr_items where parent_id = :v_folder_id } { + evaluation::delete_grade -grade_item_id $item_id } +content::folder::unregister_content_type -folder_id $v_folder_id -content_type {content_revision} -include_subtypes {t} +content::folder::unregister_content_type -folder_id $v_folder_id -content_type {evaluation_grades_sheets} -include_subtypes {t} +db_dml delete_v14 "delete from cr_folder_type_map where content_type = 'evaluation_grades_sheets'" +content::folder::delete -folder_id $v_folder_id - db_transaction { - db_exec_plsql delte_evaluation_contents { *SQL* } +#evaluation_tasks +ns_log notice "Elimando folder de evaluation_tasks" +set v_folder_id [content::item::get_id -item_path "evaluation_tasks_$package_id" -resolve_index {f}] +ns_log notice "Numero de Folder $v_folder_id este es el numero" +db_foreach v15 { select etg.group_id from evaluation_tasks et, evaluation_task_groups etg where etg.task_item_id = et.task_item_id } { + evaluation::delete_grade -grade_item_id $item_id } +content::folder::unregister_content_type -folder_id $v_folder_id -content_type {content_revision} -include_subtypes {t} +content::folder::unregister_content_type -folder_id $v_folder_id -content_type {evaluation_tasks} -include_subtypes {t} +db_dml delete_v15 "delete from cr_folder_type_map where content_type = 'evaluation_tasks'" +content::folder::delete -folder_id $v_folder_id + +#evaluation_grades +ns_log notice "Elimando folder de evaluation_grades" +set v_folder_id [content::item::get_id -item_path "evaluation_grades_$package_id" -resolve_index {f}] +ns_log notice "Numero de Folder $v_folder_id este es el numero" +db_foreach v16 { select item_id from cr_items where parent_id = :v_folder_id } { + evaluation::delete_grade -grade_item_id $item_id } +content::folder::unregister_content_type -folder_id $v_folder_id -content_type {content_revision} -include_subtypes {t} +content::folder::unregister_content_type -folder_id $v_folder_id -content_type {evaluation_grades} -include_subtypes {t} +db_dml delete_v16 "delete from cr_folder_type_map where content_type = 'evaluation_grades'" +content::folder::delete -folder_id $v_folder_id + + +# set ev_grades_fid [db_string get_f_id "select content_item__get_id('evaluation_grades_'||:package_id,null,'f')"] +# set ev_grades_sheets_fid [db_string get_f_id "select content_item__get_id('evaluation_grades_sheets_'||:package_id,null,'f')"] +# set ev_tasks_fid [db_string get_f_id "select content_item__get_id('evaluation_tasks_'||:package_id,null,'f')"] +# set ev_tasks_sols_fid [db_string get_f_id "select content_item__get_id('evaluation_tasks_sols_'||:package_id,null,'f')"] +# set ev_answers_fid [db_string get_f_id "select content_item__get_id('evaluation_answers_'||:package_id,null,'f')"] +# set ev_student_evals_fid [db_string get_f_id "select content_item__get_id('evaluation_student_evals_'||:package_id,null,'f')"] + +# db_transaction { +# db_exec_plsql delte_evaluation_contents { *SQL* } - db_exec_plsql delte_grades_sheets_folder { *SQL* } +# db_exec_plsql delte_grades_sheets_folder { *SQL* } - db_exec_plsql delte_grades_folder { *SQL* } +# db_exec_plsql delte_grades_folder { *SQL* } - db_exec_plsql delte_task_folder { *SQL* } +# db_exec_plsql delte_task_folder { *SQL* } - db_exec_plsql delte_task_sols_folder { *SQL* } +# db_exec_plsql delte_task_sols_folder { *SQL* } - db_exec_plsql delte_answers_folder { *SQL* } +# db_exec_plsql delte_answers_folder { *SQL* } - db_exec_plsql delte_evals_folder { *SQL* } +# db_exec_plsql delte_evals_folder { *SQL* } } } @@ -914,7 +1067,7 @@ } return $dir -} +db_foreach get_answers_for_task} ad_proc -public evaluation::get_archive_extension {} { return the archive extension that should be added to the output file of Index: openacs-4/packages/evaluation/www/answer-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/answer-add-edit.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/evaluation/www/answer-add-edit.tcl 9 Oct 2004 01:09:55 -0000 1.12 +++ openacs-4/packages/evaluation/www/answer-add-edit.tcl 17 Dec 2004 18:11:00 -0000 1.13 @@ -113,7 +113,7 @@ -content_table evaluation_answers -content_id answer_id -storage_type $storage_type -task_item_id $task_item_id \ -title $title -mime_type $mime_type -party_id $party_id] - evaluation::set_live -revision_id $revision_id + content::item::set_live_revision -revision_id $revision_id if { ![empty_string_p $upload_file] } { Index: openacs-4/packages/evaluation/www/admin/evaluations/audit-info.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/audit-info.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/evaluation/www/admin/evaluations/audit-info.adp 6 Dec 2004 16:57:41 -0000 1.6 +++ openacs-4/packages/evaluation/www/admin/evaluations/audit-info.adp 17 Dec 2004 18:11:01 -0000 1.7 @@ -2,6 +2,8 @@ @page_title;noquote@ @context;noquote@ +

#evaluation.lt_Audit_info_for_task_t#

+
    Index: openacs-4/packages/evaluation/www/admin/evaluations/audit-info.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/audit-info.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/evaluation/www/admin/evaluations/audit-info.tcl 6 Dec 2004 16:57:41 -0000 1.5 +++ openacs-4/packages/evaluation/www/admin/evaluations/audit-info.tcl 17 Dec 2004 18:11:01 -0000 1.6 @@ -14,7 +14,7 @@ } db_1row get_task_info { *SQL* } -set page_title "[_ evaluation.lt_Audit_info_for_task_t]" +set page_title "[_ evaluation.Audit_info_for_task_]" set context [list "[_ evaluation.Audit_Info__1]"] db_multirow parties get_parties { *SQL* } { Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-2.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-2.tcl 23 Nov 2004 23:13:52 -0000 1.11 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-2.tcl 17 Dec 2004 18:11:01 -0000 1.12 @@ -157,14 +157,12 @@ } else { set storage_type lob } - set revision_id [evaluation::new_grades_sheet -new_item_p 1 -item_id $grades_sheet_item_id -content_type evaluation_grades_sheets \ -content_table evaluation_grades_sheets -content_id grades_sheet_id -storage_type $storage_type -task_item_id $task_item_id \ -title $title -mime_type $mime_type] - evaluation::set_live -revision_id $revision_id - set content_length [file size $tmp_filename] - + content::item::set_live_revision -revision_id $revision_id + set content_length [file size $tmp_filename] if { [parameter::get -parameter "StoreFilesInDatabaseP" -package_id [ad_conn package_id]] } { # create the new item @@ -176,6 +174,7 @@ # create the new item db_dml lob_content { *SQL* } -blob_files [list $tmp_filename] + # Unfortunately, we can only calculate the file size after the lob is uploaded db_dml lob_size { *SQL* } } @@ -225,7 +224,7 @@ -content_table evaluation_student_evals -content_id evaluation_id -description $comments_wa($party_id) \ -show_student_p $show_student_wa($party_id) -grade $grades_wa($party_id) -task_item_id $task_item_id -party_id $party_id] - evaluation::set_live -revision_id $revision_id + content::item::set_live_revision -revision_id $revision_id } } } @@ -249,7 +248,7 @@ -content_table evaluation_student_evals -content_id evaluation_id -description $comments_na($party_id) \ -show_student_p $show_student_na($party_id) -grade $grades_na($party_id) -task_item_id $task_item_id -party_id $party_id] - evaluation::set_live -revision_id $revision_id + content::item::set_live_revision -revision_id $revision_id } } } @@ -262,7 +261,7 @@ -content_table evaluation_student_evals -content_id evaluation_id -description $reasons_to_edit($party_id) \ -show_student_p $show_student_to_edit($party_id) -grade $grades_to_edit($party_id) -task_item_id $task_item_id -party_id $party_id] - evaluation::set_live -revision_id $revision_id + content::item::set_live_revision -revision_id $revision_id # send the notification to everyone suscribed evaluation::notification::do_notification -task_id $task_id -evaluation_id $revision_id -package_id [ad_conn package_id] -notif_type one_evaluation_notif Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-2.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-2.tcl 10 Sep 2004 19:16:31 -0000 1.5 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-2.tcl 17 Dec 2004 18:11:01 -0000 1.6 @@ -14,8 +14,8 @@ if { [string eq $operation [_ evaluation.lt_Yes_I_really_want_to_]] } { db_transaction { - db_exec_plsql delete_evaluation { *SQL* } - +# db_exec_plsql delete_evaluation { *SQL* } + evaluation::delete_student_eval1 -evaluation_id $evaluation_id } on_error { ad_return_error "[_ evaluation.lt_Error_deleting_the_ev]" "[_ evaluation.lt_We_got_the_following_]" ad_script_abort Index: openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.xql 30 Jul 2004 22:50:10 -0000 1.3 +++ openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.xql 17 Dec 2004 18:11:01 -0000 1.4 @@ -33,7 +33,7 @@ - select coun(*) from cc_users where person_id = :party_id + select count(*) from cc_users where person_id = :party_id Index: openacs-4/packages/evaluation/www/admin/evaluations/student-list-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/student-list-postgresql.xql,v diff -u -r1.12 -r1.13 --- openacs-4/packages/evaluation/www/admin/evaluations/student-list-postgresql.xql 9 Dec 2004 17:28:15 -0000 1.12 +++ openacs-4/packages/evaluation/www/admin/evaluations/student-list-postgresql.xql 17 Dec 2004 18:11:01 -0000 1.13 @@ -139,4 +139,4 @@ - \ No newline at end of file + Index: openacs-4/packages/evaluation/www/admin/evaluations/student-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/student-list.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/evaluation/www/admin/evaluations/student-list.tcl 6 Dec 2004 16:44:24 -0000 1.18 +++ openacs-4/packages/evaluation/www/admin/evaluations/student-list.tcl 17 Dec 2004 18:11:01 -0000 1.19 @@ -19,10 +19,10 @@ set user_id [ad_conn user_id] db_1row get_task_info { *SQL* } -set community_id [dotlrn_community::get_community_id] set page_title "[_ evaluation.lt_Students_List_for_tas]" set context [list "[_ evaluation.lt_Students_List_for_tas]"] +set community_id [dotlrn_community::get_community_id] if { [string eq $show_portrait_p "t"] } { set this_url "student-list?[export_vars -entire_form -url { { show_portrait_p f } }]" Index: openacs-4/packages/evaluation/www/admin/grades/grades-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-add-edit.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/evaluation/www/admin/grades/grades-add-edit.tcl 24 Sep 2004 21:23:14 -0000 1.7 +++ openacs-4/packages/evaluation/www/admin/grades/grades-add-edit.tcl 17 Dec 2004 18:11:01 -0000 1.8 @@ -63,10 +63,8 @@ db_transaction { set revision_id [evaluation::new_grade -new_item_p [ad_form_new_p -key grade_id] -item_id $grade_id -content_type evaluation_grades \ - -content_table evaluation_grades -content_id grade_id -name $grade_name -plural_name $grade_plural_name -description $comments -weight $weight] - - evaluation::set_live -revision_id $revision_id - + -content_table evaluation_grades -content_id grade_id -name $grade_name -plural_name $grade_plural_name -description $comments -weight $weight] + content::item::set_live_revision -revision_id $revision_id } ad_returnredirect "grades" Index: openacs-4/packages/evaluation/www/admin/grades/grades-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-delete-2.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/evaluation/www/admin/grades/grades-delete-2.tcl 11 Sep 2004 00:49:21 -0000 1.4 +++ openacs-4/packages/evaluation/www/admin/grades/grades-delete-2.tcl 17 Dec 2004 18:11:01 -0000 1.5 @@ -21,8 +21,9 @@ calendar::item::delete -cal_item_id $cal_item_id } # calendar integration (end) - - db_exec_plsql delete_grade { *SQL* } + #db_1row get_grade_id { select grade_item_id from evaluation_grades where grade_id = :grade_id} + evaluation::delete_grade -grade_id $grade_id + #db_exec_plsql delete_grade { *SQL* } } on_error { ad_return_error "[_ evaluation.lt_Error_deleting_the_gr]" "[_ evaluation.lt_We_got_the_following__1]" Index: openacs-4/packages/evaluation/www/admin/grades/grades-reports-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-reports-postgresql.xql,v diff -u -r1.10 -r1.11 --- openacs-4/packages/evaluation/www/admin/grades/grades-reports-postgresql.xql 26 Nov 2004 02:47:00 -0000 1.10 +++ openacs-4/packages/evaluation/www/admin/grades/grades-reports-postgresql.xql 17 Dec 2004 18:11:01 -0000 1.11 @@ -101,7 +101,7 @@ - select cu.last_name||', '||cu.first_names as student_name, + select cu.first_names||', '||cu.last_name as student_name, cu.user_id $sql_query from cc_users cu @@ -113,7 +113,7 @@ - select cu.last_name||', '||cu.first_names as student_name, + select cu.first_names||', '||cu.last_name as student_name, cu.user_id $sql_query from cc_users cu, Index: openacs-4/packages/evaluation/www/admin/grades/grades-type-reports-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-type-reports-postgresql.xql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/evaluation/www/admin/grades/grades-type-reports-postgresql.xql 26 Nov 2004 02:47:00 -0000 1.9 +++ openacs-4/packages/evaluation/www/admin/grades/grades-type-reports-postgresql.xql 17 Dec 2004 18:11:01 -0000 1.10 @@ -19,7 +19,7 @@ - select cu.last_name||', '||cu.first_names as student_name, + select cu.first_names||', '||cu.last_name as student_name, cu.user_id $sql_query from cc_users cu @@ -31,7 +31,7 @@ - select cu.last_name||', '||cu.first_names as student_name, + select cu.first_names||', '||cu.last_name as student_name, cu.user_id $sql_query from cc_users cu, Index: openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl 10 Sep 2004 19:16:33 -0000 1.10 +++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl 17 Dec 2004 18:11:01 -0000 1.11 @@ -60,7 +60,7 @@ } {url:text(text),optional {label "[_ evaluation.URL__1]"} - {value "http://"} + {value "htp://"} } } } else { @@ -210,7 +210,7 @@ -content_table evaluation_tasks_sols -content_id solution_id -storage_type $storage_type -task_item_id $task_item_id \ -title $title -mime_type $mime_type] - evaluation::set_live -revision_id $revision_id + content::item::set_live_revision -revision_id $revision_id if { ![empty_string_p $upload_file] } { Index: openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 27 Oct 2004 19:07:54 -0000 1.20 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 17 Dec 2004 18:11:01 -0000 1.21 @@ -341,7 +341,7 @@ -due_date $due_date -late_submit_p $late_submit_p -requires_grade_p $requires_grade_p -title $title \ -mime_type $mime_type -estimated_time $estimated_time] - evaluation::set_live -revision_id $revision_id + content::item::set_live_revision -revision_id $revision_id if { ![empty_string_p $upload_file] } { Index: openacs-4/packages/evaluation/www/admin/tasks/task-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-delete-2.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/evaluation/www/admin/tasks/task-delete-2.tcl 10 Sep 2004 19:16:33 -0000 1.4 +++ openacs-4/packages/evaluation/www/admin/tasks/task-delete-2.tcl 17 Dec 2004 18:11:01 -0000 1.5 @@ -24,8 +24,9 @@ calendar::item::delete -cal_item_id $cal_item_id } # calendar integration (end) - - db_exec_plsql delete_task { *SQL* } + # db_1row get_grade_id { select task_item_id from evaluation_tasks where task_id = :task_id} + evaluation::delete_task -task_id $task_id + #db_exec_plsql delete_task { *SQL* } } on_error { ad_return_error "[_ evaluation.lt_Error_deleting_the_ta]" "[_ evaluation.lt_We_got_the_following__2]"