procedure add_scores( u_access in varchar2 default NULL, term_in in varchar2 default NULL, lnum in number default NULL, cnum in varchar2 default NULL) as access_check varchar2(30); no_access exception; cursor c1 is select term, lineno, compname from components where term = term_in and lineno = lnum; begin if (u_access = NULL) then raise no_access; end if; access_check := user_access.check_access(u_access); if (access_check != 'Teacher') then raise no_access; end if;
htp.htmlOpen; htp.headOpen; htp.title('Selecting Component'); htp.header(1,'Selecting Component'); htp.headClose; htp.bodyOpen; htp.formOpen(owa_util.get_owa_service_path || 'add_all.process_scores'); htp.nl; htp.formSelectOpen('comp', 'Choose the course component: '); for crec in c1 loop htp.formSelectOption(crec.compname); end loop; htp.formSelectClose; htp.formHidden('term_in', term_in); htp.formHidden('cnum', cnum); htp.formHidden('lnum', lnum); htp.formHidden('u_access', u_access); htp.formSubmit; htp.formClose; htp.bodyClose; htp.htmlClose; Exception when no_access then htp.print('You are not logged on'); when others then htp.print('Something is wrong in add_scores'); end add_scores;
procedure process_scores ( u_access in varchar2 default NULL, term_in in varchar2 default NULL, lnum in integer default NULL, comp in varchar2 default NULL, cnum in varchar2 default NULL) as access_check varchar2(30); no_access exception; cursor c1 is select distinct B.lname, B.fname, A.sid, A.term, A.lineno from enrolls A, students B where (A.term = term_in) and (A.lineno = lnum) and (A.sid = B.sid); begin if (u_access = NULL) then raise no_access; end if; access_check := user_access.check_access(u_access); if (access_check != 'Teacher') then raise no_access; end if;
htp.htmlOpen; htp.headOpen; htp.title('Entering Scores'); htp.header(1,'Entering Scores for ' || cnum || ',' || lnum || ',' || term_in); htp.headClose; htp.bodyOpen; htp.formOpen(owa_util.get_owa_service_path || 'insert_all.insert_scores'); htp.formHidden('u_access', u_access); htp.formHidden('term_in', term_in); htp.formHidden('lnum', lnum); htp.formHidden('comp', comp); htp.formHidden('score_arr', '000'); htp.formHidden('ids', '0000'); htp.print('Component: '); htp.print(comp); htp.nl; htp.nl;
htp.tableOpen; for crec in c1 loop htp.tableRowopen; htp.tableData(htf.strong(crec.lname||', '|| crec.fname)); htp.tableData(htf.formText('score_arr', 3, 3)); htp.formHidden('ids', crec.sid); htp.tableRowClose; end loop; htp.tableClose; htp.formSubmit(NULL,'Enter the scores'); htp.formclose; htp.bodyClose; htp.htmlClose; Exception when no_access then htp.print('You are not logged on'); when others then htp.print('Something is wrong in process_scores'); end process_scores;
procedure insert_scores(u_access in varchar2 default NULL, term_in in varchar2 default NULL, lnum in number default NULL, comp in varchar2 default NULL, score_arr in owa_util.ident_arr, ids in owa_util.ident_arr) as access_check varchar2(30); no_access exception; counter integer; begin if (u_access = NULL) then raise no_access; end if; access_check := user_access.check_access(u_access); if (access_check != 'Teacher') then raise no_access; end if; htp.htmlOpen; htp.headOpen; htp.title('Inserting Scores'); htp.headClose; htp.bodyOpen; htp.nl;
counter := 2; loop insert into scores(sid,term,lineno,compname,points) values(ids(counter),term_in,lnum,comp, score_arr(counter)); counter := counter+1; end loop; commit; EXCEPTION when no_access then htp.print('You are not logged on'); htp.anchor2('http://tinman.cs.gsu.edu:9999/' || 'ows-bin/book/owa/user_access.get_access', 'Back to sign in page'); htp.bodyClose; htp.htmlClose; when no_data_found then if (counter = 2) then htp.print('No DATA'); htp.nl; htp.anchor2('http://tinman.cs.gsu.edu:9999/' || 'ows-bin/book/owa/add_all.select_course?' || 'u_access='||u_access, 'Back to Previous Menu'); htp.nl; htp.bodyClose; htp.htmlClose;
else htp.print('Inserted scores successfully'); htp.nl; htp.anchor2('http://tinman.cs.gsu.edu:9999/' || 'ows-bin/book/owa/add_all.select_course?' || 'u_access='||u_access, 'Back to Previous Menu'); htp.nl; htp.bodyClose; htp.htmlClose; end if; when others then htp.print('Other Error'); htp.br; htp.anchor2('http://tinman.cs.gsu.edu:9999/' || 'ows-bin/book/owa/add_all.select_course?' || 'u_access='||u_access, 'Back to the Main Menu'); htp.bodyClose; htp.htmlClose; end insert_scores;