Index: openacs-4/packages/evaluation/lib/tasks-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/Attic/tasks-chunk-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/lib/tasks-chunk-oracle.xql 31 Mar 2005 11:09:27 -0000 1.1 +++ openacs-4/packages/evaluation/lib/tasks-chunk-oracle.xql 4 Apr 2005 18:22:35 -0000 1.2 @@ -13,7 +13,7 @@ et.item_id, et.requires_grade_p, et.description, et.grade_item_id, nvl(round(cr.content_length/1024,0),0) as content_length, - et.data as task_data, + cr.filename as task_data, crmt.label as pretty_mime_type, cr.title as task_title, et.task_id as revision_id @@ -40,7 +40,7 @@ et.due_date, et.requires_grade_p, et.description, et.grade_item_id, cr.title as task_title, - et.data as task_data, + cr.filename task_data, et.task_id as revision_id, nvl(round(cr.content_length/1024,0),0) as content_length, et.late_submit_p, 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.22 -r1.23 --- openacs-4/packages/evaluation/sql/postgresql/evaluation-create.sql 31 Mar 2005 11:09:27 -0000 1.22 +++ openacs-4/packages/evaluation/sql/postgresql/evaluation-create.sql 4 Apr 2005 18:22:36 -0000 1.23 @@ -192,399 +192,5 @@ 'f' --static_p ); ---------------------------------------- --- GRADES ---------------------------------------- -create function grade__name(integer) -returns varchar as ' -declare - p_grade_id alias for $1; - v_grade_name evaluation_grades.grade_name%TYPE; -begin - select grade_name into v_grade_name - from evaluation_grades - where grade_id = p_grade_id; - - return v_grade_name; -end; -' language 'plpgsql'; - ---------------------------------------- --- TASKS ---------------------------------------- - -create function evaluation__new_task (integer, integer, varchar, integer, integer, varchar, numeric, timestamptz, char, char, char, decimal, 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; - estimated_time alias for $12; - p_object_type alias for $13; - p_creation_date alias for $14; - p_creation_user alias for $15; - p_creation_ip alias for $16; - p_title alias for $17; -- default null - p_publish_date alias for $18; - p_nls_language alias for $19; -- default null - p_mime_type alias for $20; -- 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 - p_task_id alias for $1; - v_task_name evaluation_tasks.task_name%TYPE; -begin - select task_name into v_task_name - from evaluation_tasks - where task_id = p_task_id; - - return v_task_name; -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 - p_task_group_id alias for $1; - p_task_group_name alias for $2; - p_join_policy alias for $3; - p_creation_date alias for $4; - p_creation_user alias for $5; - p_creation_ip alias for $6; - p_context_id alias for $7; - p_task_item_id alias for $8; - - v_group_id integer; - -begin - - v_group_id := acs_group__new ( - p_task_group_id, - ''evaluation_task_groups'', - p_creation_date, - p_creation_user, - p_creation_ip, - null, - null, - p_task_group_name, - p_join_policy, - p_context_id - ); - - insert into evaluation_task_groups - (group_id, - task_item_id) - values - (v_group_id, - p_task_item_id); - - return v_group_id; -end; -' language 'plpgsql'; - - -create function evaluation__delete_evaluation_task_group(integer) -returns integer as ' -declare - p_task_group_id alias for $1; - del_rec record; -begin - - for del_rec in select evaluation_id from evaluation_student_evals where party_id = p_task_group_id - loop - PERFORM content_revision__delete(del_rec.evaluation_id); - end loop; - - for del_rec in select answer_id from evaluation_answers where party_id = p_task_group_id - loop - PERFORM content_revision__delete(del_rec.answer_id); - end loop; - - for del_rec in select rel_id from acs_rels where object_id_one = p_task_group_id - loop - PERFORM acs_rel__delete(del_rec.rel_id); - end loop; - - delete from evaluation_task_groups - where group_id = p_task_group_id; - - delete from groups where group_id = p_task_group_id; - - delete from parties where party_id = p_task_group_id; - - PERFORM acs_group__delete(p_task_group_id); - - return 0; -end; -' language 'plpgsql'; - -create table evaluation_user_profile_rels ( - rel_id integer - constraint evaluation_user_profile_rels_pk - primary key -); - -select acs_rel_type__create_type( - 'evaluation_task_group_rel', - 'Evaluation Task Group Member', - 'Evaluation Task Group Members', - 'membership_rel', - 'evaluation_user_profile_rels', - 'rel_id', - 'evaluations', - 'evaluation_task_groups', - null, - 0, - null, - 'user', - null, - 0, - 1 - ); - ---------------------------------------- --- GRADE FUNCTIONS ---------------------------------------- - -create function evaluation__task_grade (integer, integer) -returns numeric as ' -declare - - p_user_id alias for $1; - p_task_id alias for $2; - - v_grade evaluation_student_evals.grade%TYPE; - -begin - - select (ese.grade*et.weight*eg.weight)/10000 into v_grade - from evaluation_student_evals ese, evaluation_tasks et, evaluation_grades eg - where party_id = evaluation__party_id(p_user_id, et.task_id) - and et.task_id = p_task_id - and ese.task_item_id = et.task_item_id - and et.grade_item_id = eg.grade_item_id - and content_revision__is_live(eg.grade_id) = true - and content_revision__is_live(et.task_id) = true; - - if v_grade is null then - return 0.00; - else - return v_grade; - end if; -end;' language 'plpgsql'; - -create function evaluation__grade_total_grade (integer, integer) -returns numeric as ' -declare - - p_user_id alias for $1; - p_grade_id alias for $2; - - v_grade evaluation_student_evals.grade%TYPE; - v_grades_cursor RECORD; - -begin - - v_grade := 0; - FOR v_grades_cursor IN - select (ese.grade*et.weight*eg.weight)/10000 as grade - from evaluation_grades eg, evaluation_tasks et, evaluation_student_evalsi ese - where et.task_item_id = ese.task_item_id - and et.grade_item_id = eg.grade_item_id - and eg.grade_id = p_grade_id - and ese.party_id = evaluation__party_id(p_user_id,et.task_id) - and content_revision__is_live(ese.evaluation_id) = true - and content_revision__is_live(et.task_id) = true - LOOP - v_grade := v_grade + v_grades_cursor.grade; - END LOOP; - - return v_grade; -end;' language 'plpgsql'; - -create function evaluation__class_total_grade (integer, integer) -returns numeric as ' -declare - - p_user_id alias for $1; - p_package_id alias for $2; - - v_grade evaluation_student_evals.grade%TYPE; - v_grades_cursor RECORD; - -begin - - v_grade := 0; - FOR v_grades_cursor IN - select (ese.grade*et.weight*eg.weight)/10000 as grade - from evaluation_gradesx eg, evaluation_tasks et, evaluation_student_evalsi ese, acs_objects ao - where et.task_item_id = ese.task_item_id - and et.grade_item_id = eg.grade_item_id - and eg.item_id = ao.object_id - and ao.context_id = p_package_id - and ese.party_id = evaluation__party_id(p_user_id,et.task_id) - and content_revision__is_live(ese.evaluation_id) = true - and content_revision__is_live(eg.grade_id) = true - and content_revision__is_live(et.task_id) = true - LOOP - v_grade := v_grade + v_grades_cursor.grade; - END LOOP; - - return v_grade; -end;' language 'plpgsql'; - ---------------------------------------- --- OTHER FUNCTIONS ---------------------------------------- - -create function evaluation__party_name (integer,integer) -returns varchar as ' -declare - p_party_id alias for $1; - p_task_id alias for $2; - - v_number_of_members evaluation_tasks.number_of_members%TYPE; -begin - - select number_of_members into v_number_of_members - from evaluation_tasks - where task_id = p_task_id; - - if v_number_of_members = 1 then - return person__last_name(p_party_id)||'', ''||person__first_names(p_party_id); - else - return acs_group__name(p_party_id); - end if; - -end;' language 'plpgsql'; - -create function evaluation__party_id (integer,integer) -returns varchar as ' -declare - p_user_id alias for $1; - p_task_id alias for $2; - - v_number_of_members evaluation_tasks.number_of_members%TYPE; -begin - - select number_of_members into v_number_of_members - from evaluation_tasks - where task_id = p_task_id; - - if v_number_of_members = 1 then - return p_user_id; - else - return coalesce((select etg.group_id from evaluation_task_groups etg, - evaluation_tasks et, - acs_rels map - where map.object_id_one = etg.group_id - and map.object_id_two = p_user_id - and etg.task_item_id = et.task_item_id - and et.task_id = p_task_id),0); - end if; - -end;' language 'plpgsql'; - -create function evaluation__delete_contents (integer) -returns integer as ' -declare - - p_package_id alias for $1; - - v_item_id cr_items.item_id%TYPE; - v_item_cursor RECORD; - -begin - 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 - and etg.task_item_id = et.task_item_id - and ao.context_id = p_package_id - LOOP - PERFORM evaluation__delete_evaluation_task_group(v_item_cursor.group_id); - END LOOP; -return 0; -end;' language 'plpgsql'; - \i evaluation-package-create.sql \i evaluation-calendar-create.sql Index: openacs-4/packages/evaluation/sql/postgresql/evaluation-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/sql/postgresql/evaluation-package-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/sql/postgresql/evaluation-package-create.sql 31 Mar 2005 11:09:27 -0000 1.1 +++ openacs-4/packages/evaluation/sql/postgresql/evaluation-package-create.sql 4 Apr 2005 18:22:36 -0000 1.2 @@ -21,97 +21,6 @@ -- TASKS --------------------------------------- -create function evaluation__new_task (integer, integer, varchar, integer, integer, varchar, numeric, timestamptz, char, char, char, decimal, 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_estimated_time alias for $12; - p_object_type alias for $13; - p_creation_date alias for $14; - p_creation_user alias for $15; - p_creation_ip alias for $16; - p_title alias for $17; -- default null - p_publish_date alias for $18; - p_nls_language alias for $19; -- default null - p_mime_type alias for $20; -- 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 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.20 -r1.21 --- openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl 31 Mar 2005 11:09:27 -0000 1.20 +++ openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl 4 Apr 2005 18:22:36 -0000 1.21 @@ -69,7 +69,7 @@ content::type::attribute::new -content_type evaluation_tasks -attribute_name task_item_id -datatype number -pretty_name task_item_id -column_spec integer content::type::attribute::new -content_type evaluation_tasks -attribute_name task_name -datatype number -pretty_name task_name -column_spec integer content::type::attribute::new -content_type evaluation_tasks -attribute_name number_of_members -datatype string -pretty_name number_of_members -column_spec varchar - content::type::attribute::new -content_type evaluation_tasks -attribute_name due_date -datatype number -pretty_name due_date -column_spec timestamptz + content::type::attribute::new -content_type evaluation_tasks -attribute_name due_date -datatype timestamp -pretty_name due_date -column_spec timestamptz content::type::attribute::new -content_type evaluation_tasks -attribute_name grade_item_id -datatype number -pretty_name grade_item_id -column_spec integer content::type::attribute::new -content_type evaluation_tasks -attribute_name weight -datatype number -pretty_name weight -column_spec numeric content::type::attribute::new -content_type evaluation_tasks -attribute_name online_p -datatype string -pretty_name online_p -column_spec "varchar(1)" Index: openacs-4/packages/evaluation/tcl/evaluation-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/evaluation-procs-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/tcl/evaluation-procs-oracle.xql 31 Mar 2005 11:09:27 -0000 1.1 +++ openacs-4/packages/evaluation/tcl/evaluation-procs-oracle.xql 4 Apr 2005 18:22:36 -0000 1.2 @@ -155,5 +155,45 @@ select sysdate from dual + + + + + select et.task_name, + et.number_of_members, + et.due_date, + et.weight, + et.online_p, + et.late_submit_p, + et.requires_grade_p, + crr.content, + crr.filename, + crr.content_length, + crr.title, + crr.description, + crr.mime_type, + cri.storage_type, + cri.content_type + from evaluation_tasksi et, + cr_revisions crr, + cr_items cri + where task_id = :from_task_id + and et.task_id = crr.revision_id + and cri.item_id = crr.item_id + + + + + + + + update cr_revisions + set content = :content, + content_length = :content_length, + filename = :filename + where revision_id = :revision_id + + + 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.21 -r1.22 --- openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql 31 Mar 2005 11:09:28 -0000 1.21 +++ openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql 4 Apr 2005 18:22:36 -0000 1.22 @@ -179,5 +179,45 @@ + + + + + select et.task_name, + et.number_of_members, + et.due_date, + et.weight, + et.online_p, + et.late_submit_p, + et.requires_grade_p, + crr.lob, + crr.content, + crr.content_length, + crr.title, + crr.description, + crr.mime_type, + cri.storage_type, + cri.content_type + from evaluation_tasksi et, + cr_revisions crr, + cr_items cri + where task_id = :from_task_id + and et.task_id = crr.revision_id + and cri.item_id = crr.item_id + + + + + + + + update cr_revisions + set content = :content, + content_length = :content_length, + lob = :lob + where revision_id = :revision_id + + + 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.28 -r1.29 --- openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 31 Mar 2005 11:09:28 -0000 1.28 +++ openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 4 Apr 2005 18:22:36 -0000 1.29 @@ -247,19 +247,6 @@ return $revision_id } - -ad_proc -public evaluation::set_live { - -revision_id:required -} { - - Makes a live revision of the revision_id provided. - - @param revision_id The revision to set live. -} { - db_exec_plsql content_set_live_revision { *SQL* } - return -} - ad_proc -private evaluation::now_plus_days { -ndays } { Create a new Date object for the current date and time plus the number of days given @@ -321,11 +308,12 @@ } set item_name "${item_id}_${title}" + set to_folder_id [content::item::get_id -item_path "${content_type}_${to_package_id}" -resolve_index f] set revision_id [db_nextval acs_object_id_seq] set item_id [content::item::new -item_id $item_id \ - -parent_id $folder_id \ + -parent_id $to_folder_id \ -content_type evaluation_tasks \ -creation_user $creation_user \ -name $item_name \ Index: openacs-4/packages/evaluation/tcl/evaluation-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/evaluation-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/evaluation/tcl/evaluation-procs.xql 31 Mar 2005 11:09:28 -0000 1.2 +++ openacs-4/packages/evaluation/tcl/evaluation-procs.xql 4 Apr 2005 18:22:36 -0000 1.3 @@ -14,44 +14,6 @@ - - - - select et.task_name, - et.number_of_members, - et.due_date, - et.weight, - et.online_p, - et.late_submit_p, - et.requires_grade_p, - crr.lob, crr.content, - crr.content_length, - crr.title, - crr.description, - crr.mime_type, - cri.storage_type - from evaluation_tasksi et, - cr_revisions crr, - cr_items cri - where task_id = :from_task_id - and et.task_id = crr.revision_id - and cri.item_id = crr.item_id - - - - - - - - update cr_revisions - set content = :content, - content_length = :content_length, - lob = :lob - where revision_id = :revision_id - - - - 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.14 -r1.15 --- openacs-4/packages/evaluation/www/answer-add-edit.tcl 22 Dec 2004 22:06:40 -0000 1.14 +++ openacs-4/packages/evaluation/www/answer-add-edit.tcl 4 Apr 2005 18:22:36 -0000 1.15 @@ -80,7 +80,8 @@ set mime_type "text/plain" set title "" - set storage_type text + # set storage_type to its default value according to a db constraint + set storage_type "" if { ![empty_string_p $upload_file] } { # Get the filename part of the upload file @@ -94,14 +95,10 @@ if { [parameter::get -parameter "StoreFilesInDatabaseP" -package_id [ad_conn package_id]] } { set storage_type file - } else { - set storage_type lob } - } elseif { ![string eq $url "http://"] } { set mime_type "text/plain" set title "link" - set storage_type text } set title [evaluation::safe_url_name -name $title] Index: openacs-4/packages/evaluation/www/admin/grades/distribution-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/Attic/distribution-edit-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/distribution-edit-oracle.xql 4 Apr 2005 18:22:36 -0000 1.1 @@ -0,0 +1,21 @@ + + + + oracle8.1.6 + + + + + select task_name, + weight as task_weight, + requires_grade_p, + task_id + from evaluation_tasksi + where grade_item_id = :grade_item_id + and content_revision.is_live(task_id) = 't' + order by task_name + + + + + 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.6 -r1.7 --- openacs-4/packages/evaluation/www/admin/grades/grades-delete-2.tcl 22 Dec 2004 22:06:40 -0000 1.6 +++ openacs-4/packages/evaluation/www/admin/grades/grades-delete-2.tcl 4 Apr 2005 18:22:36 -0000 1.7 @@ -21,9 +21,7 @@ calendar::item::delete -cal_item_id $cal_item_id } # calendar integration (end) - #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/tasks/solution-add-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit-oracle.xql 4 Apr 2005 18:22:36 -0000 1.1 @@ -0,0 +1,62 @@ + + + + oracle8.1.6 + + + + + select crr.filename as content, + crr.title, + crr.item_id, + cri.storage_type, + crr.revision_id, + crr.content_length, + crr.mime_type + from cr_items cri, cr_revisions crr + where crr.revision_id = :solution_id + and crr.item_id = cri.item_id + + + + + + + + select solution_id + from evaluation_tasks_sols + where task_item_id = :task_item_id + and content_revision.is_live(solution_id) = 't' + + + + + + + begin + content_revision.content_copy(:solution_id, :revision_id); + end; + + + + + + + update cr_revisions + set lob = [set __lob_id [db_string get_lob_id "select empty_lob() from dual"]] + where revision_id = :revision_id + + + + + + + + update cr_revisions + set filename = :url + where revision_id = :revision_id + + + + + Index: openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit-postgresql.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit-postgresql.xql 24 Aug 2004 22:40:33 -0000 1.5 +++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit-postgresql.xql 4 Apr 2005 18:22:36 -0000 1.6 @@ -11,6 +11,7 @@ crr.item_id, cri.storage_type, crr.revision_id, + crr.content_length, ets.mime_type from evaluation_tasks_solsi ets, cr_items cri, cr_revisions crr where ets.solution_id = :solution_id @@ -31,20 +32,20 @@ - + - select evaluation__delete_task_sol(solution_id) - from evaluation_tasks_sols - where task_item_id = :task_item_id - + content_revision__content_copy(:solution_id, :revision_id) + - + - content_revision__content_copy(:solution_id, :revision_id) + update cr_revisions + set lob = [set __lob_id [db_string get_lob_id "select empty_lob()"]] + where revision_id = :revision_id 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.12 -r1.13 --- openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl 22 Dec 2004 22:06:41 -0000 1.12 +++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl 4 Apr 2005 18:22:36 -0000 1.13 @@ -42,7 +42,7 @@ db_1row get_sol_info { *SQL* } - if { [string eq $storage_type "lob"] || [string eq $storage_type "file"] } { + if { ![string eq $title "link"] && $content_length > 0 } { if { [string eq $solution_mode "edit"] } { set attached_p "t" @@ -68,8 +68,7 @@ {upload_file:text,optional {label "[_ evaluation.File_]"} {html "size 30"} - {value "[return $title]"} - {after_html "$title"} + {after_html "$content"} } {unattach_p:text(hidden) } @@ -172,8 +171,10 @@ db_transaction { if { [string eq $unattach_p "t"] } { - db_exec_plsql unassociate_task_sol { *SQL* } + content::revision::delete -revision_id $solution_id } else { + # set storage_type to its default value according to a db constraint + set storage_type "lob" if { ![empty_string_p $upload_file] } { # Get the filename part of the upload file @@ -187,28 +188,29 @@ if { [parameter::get -parameter "StoreFilesInDatabaseP" -package_id [ad_conn package_id]] } { set storage_type file - } else { - set storage_type lob } - } elseif { ![string eq $url "http://"] } { set mime_type "text/plain" set title "link" - set storage_type text } elseif { [string eq $attached_p "f"] } { set mime_type "text/plain" set title "" - set storage_type text } set title [evaluation::safe_url_name -name $title] if { [ad_form_new_p -key solution_id] } { set item_id $solution_id } - set revision_id [evaluation::new_solution -new_item_p [ad_form_new_p -key solution_id] -item_id $item_id -content_type evaluation_tasks_sols \ - -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] + set revision_id [evaluation::new_solution -new_item_p [ad_form_new_p -key solution_id] \ + -item_id $item_id \ + -content_type evaluation_tasks_sols \ + -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] content::item::set_live_revision -revision_id $revision_id Index: openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.xql 10 Sep 2004 19:16:33 -0000 1.5 +++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.xql 4 Apr 2005 18:22:36 -0000 1.6 @@ -45,16 +45,6 @@ - - - - update cr_revisions - set lob = [set __lob_id [db_string get_lob_id "select empty_lob()"]] - where revision_id = :revision_id - - - - Index: openacs-4/packages/evaluation/www/admin/tasks/task-add-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-add-edit-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit-oracle.xql 4 Apr 2005 18:22:36 -0000 1.1 @@ -0,0 +1,86 @@ + + + + oracle8.1.6 + + + + + select crr.filename as content, + crr.title, + crr.content_length, + crr.item_id, + crr.mime_type, + cri.storage_type + from cr_revisions crr, cr_items cri + where crr.revision_id = :task_id + and crr.item_id = cri.item_id + + + + + + + select to_date('[template::util::date::get_property linear_date $due_date]','YYYY-MM-DD HH24:MI:SS') from dual + + + + + + + update cr_revisions + set lob = [set __lob_id [db_string get_lob_id "select empty_lob() from dual"]] + where revision_id = :revision_id + + + + + + + + update cr_revisions + set filename = :url + where revision_id = :revision_id + + + + + + + begin + content_revision.content_copy (:task_id, :revision_id); + end; + + + + + + + update cr_revisions + set filename = :title, + mime_type = :mime_type, + content_length = :content_length + where revision_id = :revision_id + + + + + + + + select count(*) + from dotlrn_communities_all, + dotlrn_member_rels_approved, + dotlrn_classes + where dotlrn_communities_all.community_id = dotlrn_member_rels_approved.community_id + and dotlrn_communities_all.community_type = dotlrn_classes.class_key + and dotlrn_member_rels_approved.user_id = :user_id + and acs_permission.permission_p(dotlrn_communities_all.community_id, :user_id, 'admin') = 't' + and dotlrn_communities_all.community_id <> [dotlrn_community::get_community_id] + + + + + + + Index: openacs-4/packages/evaluation/www/admin/tasks/task-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-add-edit-postgresql.xql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/evaluation/www/admin/tasks/task-add-edit-postgresql.xql 10 Sep 2004 19:16:33 -0000 1.9 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit-postgresql.xql 4 Apr 2005 18:22:36 -0000 1.10 @@ -3,18 +3,6 @@ postgresql7.3 - - - - select grade_plural_name, - grade_name, - weight as grade_weight, - grade_item_id - from evaluation_grades where grade_id = :grade_id - - - - @@ -30,21 +18,10 @@ - - - - select et.task_name, et.description, to_char(et.due_date,'YYYY-MM-DD HH24:MI:SS') as due_date_ansi, - et.weight, et.number_of_members, et.online_p, et.late_submit_p, et.requires_grade_p - from evaluation_tasksi et - where task_id = :task_id - - - - - select to_timestamp('[template::util::date::get_property linear_date $due_date]','YYYY MM DD HH24 MI SS') from dual + select to_timestamp('[template::util::date::get_property linear_date $due_date]','YYYY MM DD HH24 MI SS')l @@ -69,34 +46,26 @@ - + - update cr_revisions - set content_length = :content_length - where revision_id = :revision_id + select content_revision__content_copy(:task_id,:revision_id) - + - update cr_revisions - set content_length = :content_length - where revision_id = :revision_id - - + update cr_revisions + set content = :filename, + mime_type = :mime_type, + content_length = :content_length + where revision_id = :revision_id + + - - - - select content_revision__content_copy(:task_id,:revision_id) - - - - Index: openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.adp 10 Jun 2004 21:08:54 -0000 1.4 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.adp 4 Apr 2005 18:22:36 -0000 1.5 @@ -35,7 +35,7 @@ } - +

#evaluation.lt_To_add_this_assignmen#
#evaluation.lt_please_check_the_last#

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.22 -r1.23 --- openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 22 Dec 2004 22:06:41 -0000 1.22 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 4 Apr 2005 18:22:36 -0000 1.23 @@ -24,6 +24,12 @@ set community_id [dotlrn_community::get_community_id] set new_p [ad_form_new_p -key task_id] + +set more_communities_option 0 +if { $new_p && ![empty_string_p $community_id] && [db_string get_user_comunities { *SQL* }] } { + set more_communities_option 1 +} + db_1row get_grade_info { *SQL* } if { $new_p } { set page_title "[_ evaluation.Add_grade_name_]" @@ -56,7 +62,7 @@ db_1row get_task_info { *SQL* } - if { [string eq $storage_type "lob"] || [string eq $storage_type "file"] } { + if { ![string eq $title "link"] && $content_length > 0 } { if { [string eq $mode "edit"] } { set attached_p "t" @@ -82,7 +88,7 @@ {upload_file:text,optional {label "[_ evaluation.File_]"} {html "size 30"} - {value "$title"} + {value "$content"} } {unattach_p:text(hidden) } @@ -179,7 +185,7 @@ {html {rows 4 cols 40 wrap soft}} } - {due_date:date,to_sql(linear_date),from_sql(sql_date) + {due_date:date,to_sql(linear_date),from_sql(sql_date),optional {label "[_ evaluation.Due_Date_]"} {format "MONTH DD YYYY HH24 MI SS"} {today} @@ -234,7 +240,7 @@ } } -if { $new_p && ![empty_string_p $community_id] && [db_string get_user_comunities { *SQL* }] } { +if { $more_communities_option } { ad_form -extend -name task -form { {add_to_more_classes_p:text(checkbox),optional {label "[_ evaluation.lt_Add_this_assignment_t]"} @@ -278,6 +284,10 @@ { $number_of_members >= 1 } { [_ evaluation.lt_The_number_of_members]} } + {online_p + { ([empty_string_p $due_date] && [string eq $online_p "f"]) || (![empty_string_p $due_date] && [string eq $online_p "t"]) } + { "You can't leave the due date empty if the students have to submit their answers online." } + } {estimated_time { $estimated_time >= 0 } { [_ evaluation.lt_The_estimated_time_mu] } @@ -302,8 +312,11 @@ db_transaction { - if { ![empty_string_p $upload_file] } { + # set storage_type to its default value according to a db constraint + set storage_type "lob" + if { ![empty_string_p $upload_file] } { + # Get the filename part of the upload file if { ![regexp {[^//\\]+$} $upload_file filename] } { # no match @@ -315,34 +328,51 @@ if { [parameter::get -parameter "StoreFilesInDatabaseP" -package_id [ad_conn package_id]] } { set storage_type file - } else { - set storage_type lob } } elseif { ![string eq $url "http://"] } { set mime_type "text/plain" set title "link" - set storage_type text } elseif { [string eq $attached_p "f"] } { set mime_type "text/plain" set title "" - set storage_type text } set title [evaluation::safe_url_name -name $title] set cal_due_date [calendar::to_sql_datetime -date $due_date -time $due_date -time_p 1] - set due_date [db_string set_date { *SQL* }] + set due_date_ansi [db_string set_date " *SQL* "] + if { [ad_form_new_p -key task_id] } { set item_id $task_id } - set revision_id [evaluation::new_task -new_item_p [ad_form_new_p -key grade_id] -item_id $item_id -content_type evaluation_tasks \ - -content_table evaluation_tasks -content_id task_id -name $task_name -description $description -weight $weight \ - -grade_item_id $grade_item_id -number_of_members $number_of_members -online_p $online_p -storage_type $storage_type \ - -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] + set revision_id [evaluation::new_task -new_item_p [ad_form_new_p -key grade_id] -item_id $item_id \ + -content_type evaluation_tasks \ + -content_table evaluation_tasks \ + -content_id task_id \ + -name $task_name \ + -description $description \ + -weight $weight \ + -grade_item_id $grade_item_id \ + -number_of_members $number_of_members \ + -online_p $online_p \ + -storage_type $storage_type \ + -due_date $due_date_ansi \ + -late_submit_p $late_submit_p \ + -requires_grade_p $requires_grade_p \ + -title $title \ + -mime_type $mime_type \ + -estimated_time $estimated_time] content::item::set_live_revision -revision_id $revision_id + # by the moment, since I'm having a date problem with oracle10g, I have to do this in order + # to store the entire date + + db_dml update_date { + update evaluation_tasks set due_date = (select to_date(:due_date,'YYYY-MM-DD HH24:MI:SS') from dual) + where task_id = :revision_id + } + if { ![empty_string_p $upload_file] } { set tmp_file [template::util::file::get_property tmp_filename $upload_file] @@ -391,9 +421,8 @@ db_dml insert_cal_mapping { *SQL* } } else { # edit previous cal_item - calendar::item::edit -cal_item_id $cal_item_id -start_date $due_date -end_date $due_date -name "[_ evaluation.Due_date_task_name]" -description $desc_url -calendar_id $calendar_id + calendar::item::edit -cal_item_id $cal_item_id -start_date $due_date_ansi -end_date $due_date_ansi -name "[_ evaluation.Due_date_task_name]" -description $desc_url -calendar_id $calendar_id } - } } -after_submit { set redirect_to_groups_p 0 Index: openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.xql 20 Sep 2004 18:16:49 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.xql 4 Apr 2005 18:22:36 -0000 1.2 @@ -2,7 +2,29 @@ + + + select grade_plural_name, + grade_name, + weight as grade_weight, + grade_item_id + from evaluation_grades where grade_id = :grade_id + + + + + + + + select et.task_name, et.description, to_char(et.due_date,'YYYY-MM-DD HH24:MI:SS') as due_date_ansi, + et.weight, et.number_of_members, et.online_p, et.late_submit_p, et.requires_grade_p + from evaluation_tasksi et + where task_id = :task_id + + + + @@ -23,18 +45,6 @@ - - - - update cr_revisions - set content = :filename, - mime_type = :mime_type, - content_length = :content_length - where revision_id = :revision_id - - - - @@ -50,4 +60,24 @@ + + + + update cr_revisions + set content_length = :content_length + where revision_id = :revision_id + + + + + + + + update cr_revisions + set content_length = :content_length + where revision_id = :revision_id + + + + Index: openacs-4/packages/evaluation/www/admin/tasks/task-add-to-communities-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-add-to-communities-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-to-communities-oracle.xql 4 Apr 2005 18:22:36 -0000 1.1 @@ -0,0 +1,49 @@ + + + + oracle8.1.6 + + + + + select dotlrn_communities_all.pretty_name, + dotlrn_communities_all.community_id, + dotlrn_community.url(dotlrn_communities_all.community_id) as url + from dotlrn_communities_all, + dotlrn_member_rels_approved, + dotlrn_classes + where dotlrn_communities_all.community_id = dotlrn_member_rels_approved.community_id + and dotlrn_communities_all.community_type = dotlrn_classes.class_key + and dotlrn_member_rels_approved.user_id = :user_id + and acs_permission.permission_p(dotlrn_communities_all.community_id, :user_id, 'admin') = 't' + and dotlrn_communities_all.community_id <> [dotlrn_community::get_community_id] + order by dotlrn_communities_all.pretty_name + + + + + + + + select eg.grade_item_id as to_grade_item_id from evaluation_gradesx eg, acs_objects ao + where content_revision.is_live(eg.grade_id) = 't' + and eg.item_id = ao.object_id + and ao.context_id = :community_package_id + and lower(eg.grade_name) = '[string tolower $grade_name]' + + + + + + + + select et.task_name, eg.grade_name + from evaluation_grades eg, evaluation_tasks et + where et.grade_item_id = eg.grade_item_id + and et.task_id = :task_id + and content_revision.is_live(eg.grade_id) = 't' + + + + + Index: openacs-4/packages/evaluation/www/admin/tasks/task-add-to-communities-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-add-to-communities-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/evaluation/www/admin/tasks/task-add-to-communities-postgresql.xql 30 Jul 2004 22:50:11 -0000 1.3 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-to-communities-postgresql.xql 4 Apr 2005 18:22:36 -0000 1.4 @@ -34,4 +34,14 @@
+ + + + select et.task_name, eg.grade_name + from evaluation_grades eg, evaluation_tasks et + where et.grade_item_id = eg.grade_item_id and et.task_id = :task_id and content_revision__is_live(eg.grade_id) = true + + + + Index: openacs-4/packages/evaluation/www/admin/tasks/task-add-to-communities.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-add-to-communities.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/evaluation/www/admin/tasks/task-add-to-communities.tcl 22 Dec 2004 22:06:41 -0000 1.7 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-to-communities.tcl 4 Apr 2005 18:22:36 -0000 1.8 @@ -57,7 +57,7 @@ foreach id [array names communities_packages_ids] { set revision_id [evaluation::clone_task -item_id $item_ids($id) -from_task_id $task_id -to_grade_item_id $communities_packages_ids($id) -to_package_id $id] - evaluation::set_live -revision_id $revision_id + content::item::set_live_revision -revision_id $revision_id } ad_returnredirect $return_url Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/evaluation/www/admin/tasks/task-add-to-communities.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/evaluation/www/admin/tasks/task-delete-2-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? 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.6 -r1.7 --- openacs-4/packages/evaluation/www/admin/tasks/task-delete-2.tcl 22 Dec 2004 22:06:41 -0000 1.6 +++ openacs-4/packages/evaluation/www/admin/tasks/task-delete-2.tcl 4 Apr 2005 18:22:36 -0000 1.7 @@ -24,9 +24,7 @@ calendar::item::delete -cal_item_id $cal_item_id } # calendar integration (end) - # 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]" Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/evaluation/www/admin/tasks/task-delete-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff?