create or replace package body odwachck is /***************************************************************************************** Purpose ODWACHCK: support for Check Out and Check In Dialogs Usage Remarks Revision history When Who Construct Revision What ------------------------------------------------------------------------------------------ $REVISION_HISTORY$ 10-Sep-2003 Kannan Parthasarathy - B2782523: Fixed coFormFrame to display proper branch name. 19-Nov-2002 Kannan Parthasarathy - Fixed OAC P1 issues. 12-mar-2001 Lucas Jellema 1.8 - issue: Check Out + Download does not download most of it fixed in cdwp_fil (1.16) just small changes in onInit trigger for BODY in procedure coSuccess 26-feb-2001 Lucas Jellema 1.7 - undo check out not prompts in bold 30-jan-2001 Lucas Jellema 1.6 - solve issue 160 - In the form that you get after you have checked out the lock check box is updateable. This should be a read only screen. Do not write default Check Out Notes 26-jan-2001 Lucas Jellema 1.5 solve issue 42: NAV UNDO CO REQUERIES EMPTY PATH 24-jan-2001 Lucas Jellema 1.4 Changed: procedure undocoSuccess - to fix Issue 59: undo check out and download gives error (ivid of working copy is used instead of predecessor) 23-jan-2001 Lucas Jellema 1.3 Solve : do not use session id as parameter for co,ci,undoco javascript function 22-dec-2000 Lucas Jellema 1.1 Add links to the On Line Help System 20-dec-2000 Lucas Jellema 1.0 Initial creation to support file upload and Check In/Check Out. *****************************************************************************************/ -- -- private constants -- REVISION_LABEL constant varchar2(30) := '$x.y::1.8 $'; PACKAGE_NAME constant varchar2(30) := 'odwachck'; -- this function returns the URL that is appropriate for checking out the indicated object function url_checkout ( p_ivid in number ) return varchar2 is begin return htf.anchor ( curl => 'javascript:co('''||to_char(p_ivid)||''')' , ctext => cdwp.add_images('{checkout.gif}', p_attributes => ' ALT="Check Out"') ); end; -- url_checkout -- this function returns the URL that is appropriate for undo the check out of the indicated object function url_undoCheckout ( p_ivid in number ) return varchar2 is begin return htf.anchor ( curl => 'javascript:undoco('''||to_char(p_ivid)||''')' , ctext => cdwp.add_images('{undocheckout.gif}', p_attributes => ' ALT="Undo Check Out"') ); end; -- url_undoCheckout -- this function will write the Javascript function to be included in the HEAD section of the HTML -- page; this function will be called to do a checkout request for object with IVID procedure js_checkout_request is begin htp.p (' '); end; -- js_checkout_request -- this function will write the Javascript function to be included in the HEAD section of the HTML -- page; this function will be called to do a checkout request for object with IVID procedure js_undocheckout_request is begin htp.p (' '); end; -- js_undocheckout_request procedure js_ok ( p_new_fol_ivid in number default null ) is begin htp.p (' '); end; -- js_ok procedure js_write_button_frame is begin htp.p (' '); end; --js_write_button_frame procedure js_download_file ( p_ivid in number ) is begin htp.p (' '); end; --js_write_button_frame procedure coSuccess ( p_session_id in number , p_ivid in number , p_new_ivid in number , p_lock in varchar2 default '' , checkNotes in varchar2 default '' , p_error_stack in varchar2 default '' , p_download in varchar2 default 'N' ) is l_menu_bar varchar2(4000); l_label varchar2(2000); begin htp.htmlOpen; htp.headopen; cdwp.write_about(package_name, revision_label); cdwp.include_report_styles; htp.p(''); odwavrsn.js_invoke_vev ( p_irid => odwactxt.get_pac_irid , p_ivid => p_new_ivid ); odwavrsn.js_invoke_vhv ( p_irid => odwactxt.get_pac_irid , p_ivid => p_new_ivid ); odwainfo.js_invoke_info; js_write_button_frame; cdwp_fil.js_download_file_request; js_download_file( p_ivid => p_ivid); htp.headClose; htp.bodyopen ( cattributes => 'onLoad="writeButtonFrame();' ||cdwpbase.ifThenElse ( p_download = 'Y' ,'downloadFile();' ) ||cdwpbase.ifThenElse ( cdwpbase.get_ivid_type_id(p_ivid => p_new_ivid) in (4844, 4845, 5009 ) ,'top.opener.document.refreshForm.p_app_ivid.value = '''||to_char(nvl(p_new_ivid,p_ivid))||'''' ) ||';"'); cdwp_fil.form_download_file_request; htp.p(''); htp.p(''); l_menu_bar:=cdwp.add_images( p_text => '{ft-left.gif}') ; l_menu_bar:= l_menu_bar ||htf.anchor2 -- 1.2 ( curl => 'javascript:invokeVhv();' , ctext => cdwp.add_images ( p_text => '{versiontreegr.gif}' , p_attributes=> ' alt="'||Rob_msg.GetMsg(Rob_msg.CAP073_ODWACHCK_VERHIST,'','','','')||'"' ) ) ||htf.anchor ( ctext=> cdwp.add_images ( '{vevgr.jpg}' , p_attributes => 'ALT="'||Rob_msg.GetMsg(Rob_msg.CAP074_ODWACHCK_REVHIST,'','','','')||'"' ) , curl => 'javascript:invokeVev();' ) ||odwabrow.browser_link ( p_session_id => odwactxt.get_session_id , p_ivid => p_new_ivid ) ||cdwp.add_images ( p_text => '{ft-right.gif}' , p_attributes=> ' Qwidth="25" ' ) ; htp.tabledata ( cvalue=> l_menu_bar ,calign => 'right' ,cattributes => 'Zwidth="400" ABGCOLOR="#cccccc"' ); htp.tableRowClose; htp.tableClose; htp.nl; -- include in this frame: -- * link to VHV -- * link to VHV-rev notes -- * link to ODWAINFO htp.formopen ( curl => 'odwachck.doCheckOut' , cmethod => 'POST' , cattributes => 'NAME="coForm"' ); cdwp.p ( p_string => Rob_msg.GetMsg(Rob_msg.DSP214_ODWACHCK_COUTSUCC,'','','','') , p_style => 'partitle' ); htp.nl; htp.nl; cdwp.tableOpen; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images ('{' ||cdwpbase.get_icon( p_type_id => cdwpbase.get_ivid_type_id(p_ivid => p_ivid)) ||'}' ) ||cdwpbase.get_nls_type_name(p_type_id => cdwpbase.get_ivid_type_id(p_ivid => p_ivid)) ); cdwp.TableDataValue ( cdwpbase.get_name( jr_name.get_path( id => odwactxt.get_pac_irid, format=> 'NAME')) ||' ('||odwavrsn.get_version_label(p_ivid => p_new_ivid) ||')' , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images ('{folder.gif}' ) ||Rob_msg.GetMsg(Rob_msg.CAP075_ODWACHCK_FOLPATH,'','','','') ); cdwp.TableDataValue ( cdwpbase.get_path( jr_name.get_path( id => odwactxt.get_pac_irid, format=> 'NAME')) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images('{branch.gif}') ||Rob_msg.GetMsg(Rob_msg.CAP076_ODWACHCK_BRANCH,'','','','') ); cdwp.TableDataValue ( odwavrsn.get_branch_label(p_ivid => p_ivid) ||' ;'||to_char(odwavrsn.get_edge_sequence(p_ivid => p_new_ivid)) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images('{workarea.gif}') ||Rob_msg.GetMsg(Rob_msg.CAP077_ODWACHCK_WA,'','','','') ); cdwp.TableDataValue ( cdwpbase.get_wa_name(p_wa_irid => odwactxt.get_workarea_irid) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; -- check out lock -- this checkbox is only shown if Strict Locking is off cdwp.tableRowOpen; -- 1.6 to fix ISSUE 160 cdwp.tabledataheading ( cdwp.add_images ( '{locked_indicator.gif}' , p_attributes => 'ALT="'||Rob_msg.GetMsg(Rob_msg.MSG159_ODWACHCK_LOCKBR,odwavrsn.get_branch_label(p_ivid => p_ivid),'','','')||'"' ) || Rob_msg.GetMsg(Rob_msg.MSG160_ODWACHCK_CONFLOCK,odwavrsn.get_branch_label(p_ivid => p_ivid),'','','') ); cdwp.TableDataValue ( cdwpbase.ifthenelse ( p_lock = 'Y' , cdwp.add_images('{check_mark.gif}') , ''||Rob_msg.GetMsg(Rob_msg.DSP215_ODWACHCK_NOTLOCKED,'','','','')||'' ) ); cdwp.tableRowClose; -- check out notes cdwp.tableRowOpen; cdwp.tabledataheading ( Rob_msg.GetMsg(Rob_msg.CAP078_ODWACHCK_CONOTES,'','','','') ); cdwp.TableDataValue ( htf.italic( replace(replace(checkNotes,chr(10),''),chr(13),'
')) ); cdwp.tableRowClose; cdwp.tableClose; htp.formclose; htp.bodyclose; htp.htmlClose; end; -- coSuccess -- this function handles the current execption; -- it will analyze the error stack and return a string with all found exceptions,warnings and error messages function handle_exception return varchar2 is l_oracle_error_message varchar2(4000); l_message varchar2(100); l_stack varchar2(16000); arg0 varchar2(5000); arg1 varchar2(5000); arg2 varchar2(5000); arg3 varchar2(5000); arg4 varchar2(5000); arg5 varchar2(5000); arg6 varchar2(5000); arg7 varchar2(5000); arg8 varchar2(5000); msg_fac varchar2(100); msg_code varchar2(100); procedure write( p_text in varchar2) is begin l_stack:= l_stack ||chr(10)||chr(13)||p_text ; end; -- write begin if cdapi.stacksize > 0 then while cdapi.stacksize > 0 loop cdapi.get_message ( cdapi.stacksize , msg_fac , msg_code ,arg1 ,arg2,arg3,arg4,arg5,arg6,arg7,arg8 ); if instr( arg8, 'UDM') > 0 -- User Defined Message then -- now pop the message to remove it from the message stack! cdapi.pop_message ( msg_fac , msg_code ,arg1 ,arg2,arg3,arg4,arg5,arg6,arg7,arg8 ); write( msg_fac||'-'||msg_code||':'||arg7||arg6||arg5 ||cdwpbase.ifThenElse( arg6 <> '', ', '||arg6) ||cdwpbase.ifThenElse( arg5 <> '', ', '||arg5) ||cdwpbase.ifThenElse( arg4 <> '', ', '||arg6) ||cdwpbase.ifThenElse( arg3 <> '', ', '||arg7) ); else write(cdapi.pop_instantiated_message); end if; end loop; if cdapi.activity is not null then cdapi.abort_activity; write(Rob_msg.GetMsg(Rob_msg.MSG161_ODWACHCK_APIERR,'','','','')); else write(Rob_msg.GetMsg(Rob_msg.MSG162_ODWACHCK_SESSERR,'','','','')); end if; else l_oracle_error_message := sqlcode||' '||sqlerrm; if cdapi.activity is not null then cdapi.abort_activity; l_message := Rob_msg.GetMsg(Rob_msg.MSG161_ODWACHCK_APIERR,'','','',''); else l_message := Rob_msg.GetMsg(Rob_msg.MSG162_ODWACHCK_SESSERR,'','','',''); end if; if l_oracle_error_message = Rob_msg.GetMsg(Rob_msg.CAP079_ODWACHCK_UDEXCEP,'','','','') then write(l_message||'.'); else write(l_message||Rob_msg.GetMsg(Rob_msg.DSP216_ODWACHCK_ORAERR,'','','','')); write(l_oracle_error_message ); end if; end if; return l_stack; end handle_exception; procedure doCheckOut ( p_session_id in number , p_ivid in number , p_lock in varchar2 default '' , checkNotes in varchar2 , p_download in varchar2 default 'N' ) is l_stack varchar2(16000); l_co_ivid number(38); l_act_status varchar2(1); begin odwactxt.update_context ( p_session_id => p_session_id , p_pac_irid => cdwpbase.get_irid( p_ivid) , p_pac_ivid => p_ivid , p_package_name => PACKAGE_NAME , p_procedure_name=> 'doCheckOut' ); jr_context.set_workarea(workarea_irid => odwactxt.get_workarea_irid); cdapi.open_activity; l_co_ivid:= jr_version.check_out ( i_irid => odwactxt.get_pac_irid , i_ivid => odwactxt.get_pac_ivid , i_lock => p_lock <> '' , i_notes => checkNotes ); cdapi.close_activity(act_status => l_act_status); -- attempt check out -- when successful, return HTML page with -- 1) Success Report -- 2) The second frame is rewritten with an OK button -- (that when pressed will close the Window and ideally requery the calling form) -- 3) if Check and Download was selected, will upon load set the 2nd frame location -- to the FileDownload URL coSuccess ( p_session_id => odwactxt.get_session_id , p_ivid => p_ivid , p_new_ivid => l_co_ivid , p_lock => p_lock , checkNotes => checkNotes , p_error_stack => '' , p_download => p_download ); -- When failed: -- * retrieves the error messages into a string -- * calls coFormFrame with the error mesaages and the Form Field values exception when jr_version.check_out_error then l_stack:= handle_exception; coFormFrame ( p_Session_Id => odwactxt.get_session_id , p_Ivid => p_ivid , p_Lock => p_lock , Checknotes => CheckNotes , p_Error_Stack => l_stack ); when jr_version.not_checked_out then l_stack:= handle_exception; coFormFrame ( p_Session_Id => odwactxt.get_session_id , p_Ivid => p_ivid , p_Lock => p_lock , Checknotes => CheckNotes , p_Error_Stack => l_stack ); when others then l_stack:= handle_exception; coFormFrame ( p_Session_Id => odwactxt.get_session_id , p_Ivid => p_ivid , p_Lock => p_lock , Checknotes => CheckNotes , p_Error_Stack => l_stack ); end; -- doCheckOut procedure js_init ( p_checkout_notes in varchar2 , p_error_stack in varchar2 ) is begin htp.p (' '); end; -- js_init function get_co_wa ( p_ivid in number ) return number is cursor c_wa( b_ivid in number) is SELECT wa.irid FROM I$SDD_WORKAREAS wa ,I$SDD_WA_CONTEXT ctxt WHERE wa.irid=ctxt.workarea_irid AND ctxt.object_ivid= b_ivid ; r_wa c_wa%rowtype; begin open c_wa( b_ivid => p_ivid); fetch c_wa into r_wa; close c_wa; return r_wa.irid; end; -- get_co_wa procedure coFormFrame ( p_session_id in number , p_ivid in number , p_lock in varchar2 default '' , checkNotes in varchar2 default '' , p_error_stack in varchar2 default '' ) is l_menu_bar varchar2(4000); l_label varchar2(2000); l_warning varchar2(10000); l_first boolean; l_branch_locked boolean:= false; l_tip_ivid number(38) := jr_version.get_tip_on_current_branch (i_irid => cdwpbase.get_irid(p_ivid => p_ivid), i_ivid => p_ivid); l_strict_locking boolean:= jr_version.get_strict_lock_policy; -- this cursor retrieves versions of the current object checked out from the indicated branch cursor c_cob ( b_irid in number default odwactxt.get_pac_irid , b_branch_id in number ) is select va.notes , va.created_by , va.date_created , va.from_ivid , va.to_ivid , ov.vlabel , va.edge_kind -- L means checked out with lock, C means checked out , usr.full_user_name full_user_name , usr.description user_description from i$sdd_object_versions ov , i$sdd_version_associations va , sdw_users usr where va.irid = b_irid and va.branch_id = b_branch_id and va.edge_kind in ('L','C') and va.from_ivid = ov.ivid and usr.username = va.created_by order by va.date_created ; begin odwactxt.update_context ( p_session_id => p_session_id , p_pac_irid => cdwpbase.get_irid( p_ivid) , p_pac_ivid => p_ivid , p_package_name => PACKAGE_NAME , p_procedure_name=> 'coFormFrame' ); l_label:=cdwpbase.get_name( jr_name.get_path( id => odwactxt.get_pac_irid, format=> 'NAME')); htp.htmlOpen; htp.headopen; cdwp.write_about(package_name, revision_label); cdwp.include_report_styles; htp.p(''); odwavrsn.js_invoke_vev ( p_irid => odwactxt.get_pac_irid , p_ivid => p_ivid ); odwavrsn.js_invoke_vhv ( p_irid => odwactxt.get_pac_irid , p_ivid => p_ivid ); odwainfo.js_invoke_info; js_init ( p_checkout_notes => checkNotes , p_error_stack => p_error_stack ); htp.headClose; htp.bodyopen(cattributes => 'onLoad="init()"'); htp.p('
'); htp.p(''); l_menu_bar:=cdwp.add_images( p_text => '{ft-left.gif}') ; l_menu_bar:= l_menu_bar ||htf.anchor2 -- 1.2 ( curl => 'javascript:invokeVhv('''','''');' , ctext => cdwp.add_images ( p_text => '{versiontreegr.gif}' , p_attributes=> ' alt="Version History"' ) ) ||htf.anchor ( ctext=> cdwp.add_images ( '{vevgr.jpg}' , p_attributes => 'ALT="Version Events (Revision History)"' ) , curl => 'javascript:invokeVev();' ) ||odwabrow.browser_link ( p_session_id => odwactxt.get_session_id , p_ivid => p_ivid ) ||cdwp.add_images ( p_text => '{ft-right.gif}' , p_attributes=> ' Qwidth="25" ' ) ; htp.tabledata ( cvalue=> l_menu_bar ,calign => 'right' ,cattributes => 'Zwidth="400" ABGCOLOR="#cccccc"' ); htp.tableRowClose; htp.tableClose; htp.nl; -- include in this frame: -- * link to VHV -- * link to VHV-rev notes -- * link to ODWAINFO cdwp.p ( p_string => cdwp.add_images('{checkout.gif}')||'Check Out ' , p_style => 'partitle' ); htp.nl; htp.nl; cdwp.tableOpen; -- if p_error_stack <> '' -- the report the errors now if length(p_error_stack) > 0 then htp.formopen ( curl => 'none' , cmethod => 'POST' , cattributes => 'NAME="errorStackForm"' ); cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images('{deletion.gif}') ||'Errors' , p_attributes => 'VALIGN=TOP' ); --htf.escape_sc(p_error_stack) cdwp.TableDataValue ( htf.formtextarea2 ( cname => 'errorStack' , nrows => 5 , ncolumns => 50 , cwrap => 'VIRTUAL' -- here we could implemet a template for check out notes! ) ); cdwp.tableRowClose; htp.formClose; end if; -- error stack not empty -- if l_strict_locking then check if any version on the current branch is already checked out if l_strict_locking then l_first:= true; for r_cob in c_cob ( b_irid => odwactxt.get_pac_irid , b_branch_id => jr_version.get_current_branch_id ( i_irid => odwactxt.get_pac_irid , i_ivid => p_ivid ) ) loop if l_first then l_first:= false; cdwp.tabledataheading ( cdwp.add_images('{warning.gif}') ||'Warning' ); l_warning:= Rob_msg.GetMsg(Rob_msg.MSG163_ODWACHCK_WARNCO,'','','',''); end if; -- l_first l_warning:= l_warning ||'
' ||Rob_msg.GetMsg(Rob_msg.MSG164_ODWACHCK_COMSG,r_cob.vlabel,r_cob.full_user_name, to_char( r_cob.date_created, 'DD-mon-YYYY HH24:MI'),cdwpbase.get_wa_name(p_wa_irid => get_co_wa( p_ivid => r_cob.to_ivid))) ||'.
'||Rob_msg.GetMsg(Rob_msg.CAP078_ODWACHCK_CONOTES,'','','','')||':' ||htf.italic( r_cob.notes) ||'
' ; end loop; -- r_cob if not l_first then cdwp.tabledatavalue( l_warning,p_attributes => 'ALIGN=LEFT'); cdwp.tableRowClose; end if; -- not l_first else -- check for any check outs with lock l_first:= true; for r_cob in c_cob ( b_irid => odwactxt.get_pac_irid , b_branch_id => jr_version.get_current_branch_id ( i_irid => odwactxt.get_pac_irid , i_ivid => p_ivid ) ) loop if r_cob.edge_kind ='L' -- with lock then if l_first then l_first:= false; cdwp.tabledataheading ( cdwp.add_images('{warning.gif}') ||Rob_msg.GetMsg(Rob_msg.CAP080_ODWACHCK_WARNING,'','','','') ); l_warning:= cdwp.add_images ( '{locked_indicator.gif}' ) ||Rob_msg.GetMsg(Rob_msg.MSG165_ODWACHCK_COWARNMSG,'','','',''); l_branch_locked := true; end if; -- l_first l_warning:= l_warning ||'
' ||Rob_msg.GetMsg(Rob_msg.MSG164_ODWACHCK_COMSG,r_cob.vlabel,r_cob.full_user_name, to_char( r_cob.date_created, 'DD-mon-YYYY HH24:MI'),cdwpbase.get_wa_name(p_wa_irid => get_co_wa( p_ivid => r_cob.to_ivid))) ||'.
'||Rob_msg.GetMsg(Rob_msg.CAP078_ODWACHCK_CONOTES,'','','','')||':' ||htf.italic( r_cob.notes) ||'
' ; end if; -- r_cob.edge_kind = 'L' end loop; -- r_cob if not l_first then cdwp.tabledatavalue( l_warning,p_attributes => 'ALIGN=LEFT'); cdwp.tableRowClose; end if; -- not l_first end if; -- strict_locking -- warn the user for any simultaneous check outs of this version l_first:= true; for r_cob in c_cob ( b_irid => odwactxt.get_pac_irid , b_branch_id => jr_version.get_current_branch_id ( i_irid => odwactxt.get_pac_irid , i_ivid => p_ivid ) ) loop if r_cob.from_ivid = p_ivid then if l_first then l_first:= false; cdwp.tabledataheading ( cdwp.add_images('{warning.gif}') ||Rob_msg.GetMsg(Rob_msg.CAP080_ODWACHCK_WARNING,'','','','') ); l_warning:= Rob_msg.GetMsg(Rob_msg.DSP217_ODWACHCK_COWARN,'','','',''); end if; -- l_first l_warning:= l_warning ||'
' ||Rob_msg.GetMsg(Rob_msg.MSG164_ODWACHCK_COMSG,r_cob.vlabel,r_cob.full_user_name, to_char( r_cob.date_created, 'DD-mon-YYYY HH24:MI'),cdwpbase.get_wa_name(p_wa_irid => get_co_wa( p_ivid => r_cob.to_ivid))) ||'.
'||Rob_msg.GetMsg(Rob_msg.CAP078_ODWACHCK_CONOTES,'','','','')||':' ||htf.italic( r_cob.notes) ||'
' ; end if; end loop; -- r_cob if not l_first then cdwp.tabledatavalue( l_warning,p_attributes => 'ALIGN=LEFT'); cdwp.tableRowClose; end if; -- not l_first -- check if this version is a non-tip version if p_ivid <> l_tip_ivid then cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images('{warning.gif}') ||Rob_msg.GetMsg(Rob_msg.CAP080_ODWACHCK_WARNING,'','','','') ); cdwp.TableDataValue ( Rob_msg.GetMsg(Rob_msg.MSG166_ODWACHCK_NONTIPVER,l_label,odwavrsn.get_branch_label(p_ivid => p_ivid) ,odwavrsn.get_version_label( p_ivid => l_tip_ivid),to_char(odwavrsn.get_edge_sequence(p_ivid => l_tip_ivid))) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; end if; -- p_ivid <> l_tip_ivid htp.formopen ( curl => 'odwachck.doCheckOut' , cmethod => 'POST' , cattributes => 'NAME="coForm"' ); cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images ('{' ||cdwpbase.get_icon( p_type_id => cdwpbase.get_ivid_type_id(p_ivid => p_ivid)) ||'}' ) ||cdwpbase.get_nls_type_name(p_type_id => cdwpbase.get_ivid_type_id(p_ivid => p_ivid)) ); cdwp.TableDataValue ( l_label ||' ('||odwavrsn.get_version_label(p_ivid => p_ivid) ||')' ||odwainfo.info_url( p_ivid => p_ivid) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images ('{folder.gif}' ) ||Rob_msg.GetMsg(Rob_msg.CAP075_ODWACHCK_FOLPATH,'','','','') ); cdwp.TableDataValue ( cdwpbase.get_path( jr_name.get_path( id => odwactxt.get_pac_irid, format=> 'NAME')) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images('{branch.gif}') ||Rob_msg.GetMsg(Rob_msg.CAP076_ODWACHCK_BRANCH,'','','','') ); cdwp.TableDataValue ( odwavrsn.get_branch_label(p_ivid => p_ivid) ||' ;'||to_char(odwavrsn.get_edge_sequence(p_ivid => p_ivid)) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images('{workarea.gif}') ||Rob_msg.GetMsg(Rob_msg.CAP077_ODWACHCK_WA,'','','','') ); cdwp.TableDataValue ( cdwpbase.get_wa_name(p_wa_irid => odwactxt.get_workarea_irid) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; -- check out lock if l_strict_locking then cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images ( '{locked_indicator.gif}' , p_attributes => 'ALT="'||Rob_msg.GetMsg(Rob_msg.DSP218_ODWACHCK_STRICTLOCK,odwavrsn.get_branch_label(p_ivid => p_ivid),'','','')||'"' ) ); cdwp.TableDataValue ( Rob_msg.GetMsg(Rob_msg.DSP219_ODWACHCK_STRICTLOCK2,'','','','')); cdwp.tableRowClose; else -- this checkbox is only shown if Strict Locking is off -- and the current branch is not already locked if not l_branch_locked then cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images ( '{locked_indicator.gif}' , p_attributes => 'ALT="'|| Rob_msg.GetMsg(Rob_msg.MSG159_ODWACHCK_LOCKBR,odwavrsn.get_branch_label(p_ivid => p_ivid),'','','') ||cdwpbase.ifthenelse ( p_ivid <> l_tip_ivid , Rob_msg.GetMsg(Rob_msg.MSG167_ODWACHCK_CINONTIP,'','','','') , Rob_msg.GetMsg(Rob_msg.MSG168_ODWACHCK_CITIP,'','','','') ) ||'"' ) || Rob_msg.GetMsg(Rob_msg.MSG160_ODWACHCK_CONFLOCK,odwavrsn.get_branch_label(p_ivid => p_ivid),'','','') ); cdwp.tabledatavalue (htf.formcheckbox(cname => 'p_lock',cvalue => 'Y',cchecked => p_lock) ); cdwp.tableRowClose; end if; -- not l_branch_locked end if; -- l_strict_locking -- check out notes cdwp.tableRowOpen; cdwp.tabledataheading ( cdwpbase.nbsp(1) ); cdwp.TableDataValue ( Rob_msg.GetMsg(Rob_msg.CAP078_ODWACHCK_CONOTES,'','','','') ||'
' ||htf.formtextarea2 ( cname => 'checkNotes' , nrows => 6 , ncolumns => 50 , cwrap => 'VIRTUAL' -- here we could implemet a template for check out notes! ) ); cdwp.tableRowClose; htp.formhidden ( cname => 'p_ivid' , cvalue => to_char(odwactxt.get_pac_ivid) ); htp.formhidden ( cname => 'p_session_id' , cvalue => to_char(odwactxt.get_session_id) ); htp.formhidden ( cname => 'p_download' , cvalue => 'N' ); htp.formclose; cdwp.tableClose; htp.bodyclose; htp.htmlClose; end; -- coFormFrame procedure coButtonFrame ( p_session_id in number , p_ivid in number ) is begin htp.htmlOpen; htp.headopen; cdwp_fil.js_download_file_request; htp.headclose; htp.bodyopen; cdwp_fil.form_download_file_request; htp.formopen ( curl => '' , cmethod => 'POST' , cattributes => 'NAME="buttonForm"' ); htp.tableopen(calign => 'CENTER'); htp.tablerowopen; htp.tabledata ( ' p_ivid) = 4819 -- Primary Access File then htp.tabledata ( ' odwachck.checkOut | -------------------------------- | | | coFormFrame | | | | | | | | | | | |-------------------------------- | | -------------------------------- | | | coButtonFrame | | | |-------------------------------| | |------------------------------------| */ -- this procedure defines an HTML document with two frames procedure checkout ( p_session_id in number , p_ivid in number ) is begin -- create session when necessary, refresh session cache, set workarea context -- from here on reference to odwactxt.get_... functions for any context value odwactxt.update_context ( p_session_id => p_session_id , p_package_name => PACKAGE_NAME , p_procedure_name=> 'checkout' , p_pac_irid => cdwpbase.get_irid (p_ivid) , p_pac_ivid => p_ivid -- , p_workarea_irid => null ); htp.htmlOpen; htp.headOpen; cdwp.write_about(package_name, revision_label); htp.title ( Rob_msg.GetMsg(Rob_msg.CAP081_ODWACHCK_ROBCO,'','','','') ||jr_name.get_path( id => odwactxt.get_pac_irid, format=> 'VLABEL') ); odwainfo.js_invoke_info; js_ok; -- allow frames in this document to include calls to the On Line Help System by including the -- JavaScript function that can invoke the Help Window odwahelp.js_invoke_help; htp.headClose; htp.framesetopen ( crows => '80%,20%' , cattributes => 'BORDER="0" LONGDESC=odwahelp.rightSide?p_session_id=&p_him_id=120 TITLE="' ||Rob_msg.Getmsg(Rob_msg.CAP081_ODWACHCK_ROBCO,'','','','')||'"' ); htp.frame ( csrc => 'odwachck.coFormFrame?p_session_id=' ||to_char(odwactxt.get_session_id) ||chr(38)||'p_ivid='||to_char(p_ivid) , cname=> 'coFormFrame' , cattributes => 'LONGDESC=odwahelp.rightSide?p_session_id=&p_him_id=120 TITLE="' ||Rob_msg.Getmsg(Rob_msg.CAP081_ODWACHCK_ROBCO,'','','','')||'"' ); htp.frame ( csrc => 'odwachck.coButtonFrame?p_session_id=' ||to_char(odwactxt.get_session_id) ||chr(38)||'p_ivid='||to_char(p_ivid) , cname=> 'coButtonFrame' , cattributes => 'LONGDESC=odwahelp.rightSide?p_session_id=&p_him_id=120 TITLE="' ||Rob_msg.Getmsg(Rob_msg.CAP081_ODWACHCK_ROBCO,'','','','')||'"' ); htp.framesetclose; htp.htmlClose; end; -- checkout --=== Undo Check Out ================================================ procedure js_ok_undoco ( p_new_fol_ivid in number default null ) is begin htp.p (' '); end; -- js_ok procedure undocoSuccess ( p_session_id in number , p_ivid in number , p_new_ivid in number , p_lock in varchar2 default '' , checkNotes in varchar2 default '' , p_error_stack in varchar2 default '' , p_download in varchar2 default 'N' ) is l_menu_bar varchar2(4000); l_label varchar2(2000); begin htp.htmlOpen; htp.headopen; cdwp.write_about(package_name, revision_label); cdwp.include_report_styles; htp.p(''); odwavrsn.js_invoke_vev ( p_irid => odwactxt.get_pac_irid , p_ivid => p_new_ivid ); odwavrsn.js_invoke_vhv ( p_irid => odwactxt.get_pac_irid , p_ivid => p_new_ivid ); odwainfo.js_invoke_info; cdwp_fil.js_download_file_request; js_download_file( p_ivid => p_new_ivid); -- 1.4 instead of p_ivid, which is the value of the working copy that was removed by the undo checkout -- if we undid the check out of a folder, the calling document should get the new ivid as new folder context if cdwpbase.get_ivid_type_id(p_ivid => p_new_ivid) in (4844, 4845, 5009 ) -- short_name in ('CEL','FOL','APP') then js_ok(p_new_fol_ivid => p_new_ivid); else js_ok; end if; -- undo check out of a folder htp.title ( Rob_msg.GetMsg(Rob_msg.CAP082_ODWACHCK_ROBUCO,'','','','') ||cdwpbase.get_name( jr_name.get_path( id => odwactxt.get_pac_irid, format=> 'NAME')) ||' ('||odwavrsn.get_version_label(p_ivid => p_new_ivid)||'CO' ||')' ); htp.headClose; htp.bodyopen ( cattributes => '' ||cdwpbase.ifThenElse ( p_download = 'Y' ,'onLoad="downloadFile();"' ) ); cdwp_fil.form_download_file_request; htp.p('
'); htp.p(''); l_menu_bar:=cdwp.add_images( p_text => '{ft-left.gif}') ; l_menu_bar:= l_menu_bar ||htf.anchor2 -- 1.2 ( curl => 'javascript:invokeVhv();' , ctext => cdwp.add_images ( p_text => '{versiontreegr.gif}' , p_attributes=> ' alt="'||Rob_msg.GetMsg(Rob_msg.CAP073_ODWACHCK_VERHIST,'','','','')||'"' ) ) ||htf.anchor ( ctext=> cdwp.add_images ( '{vevgr.jpg}' , p_attributes => 'ALT="Version Events (Revision History)"' ) , curl => 'javascript:invokeVev();' ) ||odwabrow.browser_link ( p_session_id => odwactxt.get_session_id , p_ivid => p_new_ivid ) ||cdwp.add_images ( p_text => '{ft-right.gif}' , p_attributes=> ' Qwidth="25" ' ) ; htp.tabledata ( cvalue=> l_menu_bar ,calign => 'right' ,cattributes => 'Zwidth="400" ABGCOLOR="#cccccc"' ); htp.tableRowClose; htp.tableClose; htp.nl; -- include in this frame: -- * link to VHV -- * link to VHV-rev notes -- * link to ODWAINFO cdwp.p ( p_string => Rob_msg.GetMsg(Rob_msg.DSP220_ODWACHCK_UCOSUCC,'','','','') , p_style => 'partitle' ); htp.nl; htp.nl; cdwp.tableOpen; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images ('{' ||cdwpbase.get_icon( p_type_id => cdwpbase.get_ivid_type_id(p_ivid => p_new_ivid)) ||'}' ) ||cdwpbase.get_nls_type_name(p_type_id => cdwpbase.get_ivid_type_id(p_ivid => p_new_ivid)) ); cdwp.TableDataValue ( cdwpbase.get_name( jr_name.get_path( id => odwactxt.get_pac_irid, format=> 'NAME')) ||' ('||odwavrsn.get_version_label(p_ivid => p_new_ivid)||'CO' ||')' , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images ('{folder.gif}' ) ||Rob_msg.GetMsg(Rob_msg.CAP075_ODWACHCK_FOLPATH,'','','','') ); cdwp.TableDataValue ( cdwpbase.get_path( jr_name.get_path( id => odwactxt.get_pac_irid, format=> 'NAME')) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images('{branch.gif}') ||Rob_msg.GetMsg(Rob_msg.CAP076_ODWACHCK_BRANCH,'','','','') ); cdwp.TableDataValue ( odwavrsn.get_branch_label(p_ivid => p_new_ivid) ||' ;'||to_char(odwavrsn.get_edge_sequence(p_ivid => p_new_ivid)) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images('{workarea.gif}') ||Rob_msg.GetMsg(Rob_msg.CAP077_ODWACHCK_WA,'','','','') ); cdwp.TableDataValue ( cdwpbase.get_wa_name(p_wa_irid => odwactxt.get_workarea_irid) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; cdwp.tableClose; htp.formopen(curl => ''); htp.tableopen(calign => 'CENTER'); cdwp.tableRowOpen; cdwp.TableDataValue ( '' ); cdwp.tableRowClose; cdwp.tableClose; htp.formClose; htp.formclose; htp.bodyclose; htp.htmlClose; end; -- undocoSuccess -- this function handles the current execption; -- it will analyze the error stack and return a string with all found exceptions,warnings and error messages procedure doUndoCheckOut ( p_session_id in number , p_ivid in number , p_download in varchar2 default 'N' ) is l_stack varchar2(16000); l_co_ivid number(38); l_act_status varchar2(1); begin odwactxt.update_context ( p_session_id => p_session_id , p_pac_irid => cdwpbase.get_irid( p_ivid) , p_pac_ivid => p_ivid , p_package_name => PACKAGE_NAME , p_procedure_name=> 'doUndoCheckOut' ); jr_context.set_workarea(workarea_irid => odwactxt.get_workarea_irid); cdapi.open_activity; l_co_ivid:= jr_version.get_predecessor(i_ivid => p_ivid); jr_version.undo_checkout ( i_irid => odwactxt.get_pac_irid , i_ivid => odwactxt.get_pac_ivid ); cdapi.close_activity(act_status => l_act_status); -- attempt check out -- when successful, return HTML page with -- 1) Success Report -- 2) The second frame is rewritten with an OK button -- (that when pressed will close the Window and ideally requery the calling form) -- 3) if Check and Download was selected, will upon load set the 2nd frame location -- to the FileDownload URL undocoSuccess ( p_session_id => odwactxt.get_session_id , p_ivid => null -- p_ivid does not exist anymore , p_new_ivid => l_co_ivid , p_error_stack => '' , p_download => p_download ); -- When failed: -- * retrieves the error messages into a string -- * calls coFormFrame with the error mesaages and the Form Field values exception when others then l_stack:= handle_exception; undoCheckout ( p_Session_Id => odwactxt.get_session_id , p_Ivid => p_ivid , p_Error_Stack => 'Errors: '||l_stack ); end; -- doUndoCheckOut procedure undoCheckout ( p_session_id in number , p_ivid in number , p_error_stack in varchar2 default '' ) is l_menu_bar varchar2(4000); l_label varchar2(2000); begin -- create session when necessary, refresh session cache, set workarea context -- from here on reference to odwactxt.get_... functions for any context value odwactxt.update_context ( p_session_id => p_session_id , p_package_name => PACKAGE_NAME , p_procedure_name=> 'undoCheckout' , p_pac_irid => cdwpbase.get_irid (p_ivid) , p_pac_ivid => p_ivid -- , p_workarea_irid => null ); htp.htmlOpen; htp.headOpen; cdwp.write_about(package_name, revision_label); odwainfo.js_invoke_info; js_ok; cdwp_fil.js_download_file_request; odwavrsn.js_invoke_vev ( p_irid => odwactxt.get_pac_irid , p_ivid => p_ivid ); odwavrsn.js_invoke_vhv ( p_irid => odwactxt.get_pac_irid , p_ivid => p_ivid ); -- allow frames in this document to include calls to the On Line Help System by including the -- JavaScript function that can invoke the Help Window odwahelp.js_invoke_help; htp.title ( Rob_msg.GetMsg(Rob_msg.CAP082_ODWACHCK_ROBUCO,'','','','') ||jr_name.get_path( id => p_ivid, format=> 'VLABEL') ); odwainfo.js_invoke_info; cdwp.include_report_styles; htp.p(''); htp.headClose; htp.bodyopen; cdwp_fil.form_download_file_request; htp.p('
'); htp.p(''); l_menu_bar:=cdwp.add_images( p_text => '{ft-left.gif}') ; l_menu_bar:= l_menu_bar ||htf.anchor2 -- 1.2 ( curl => 'javascript:invokeVhv();' , ctext => cdwp.add_images ( p_text => '{versiontreegr.gif}' , p_attributes=> ' alt="'||Rob_msg.GetMsg(Rob_msg.CAP073_ODWACHCK_VERHIST,'','','','')||'"' ) ) ||htf.anchor ( ctext=> cdwp.add_images ( '{vevgr.jpg}' , p_attributes => 'ALT="'||Rob_msg.GetMsg(Rob_msg.CAP074_ODWACHCK_REVHIST,'','','','')||'"' ) , curl => 'javascript:invokeVev();' ) ||odwabrow.browser_link ( p_session_id => odwactxt.get_session_id , p_ivid => p_ivid ) ||cdwp.add_images ( p_text => '{ft-right.gif}' , p_attributes=> ' Qwidth="25" ' ) ; htp.tabledata ( cvalue=> l_menu_bar ,calign => 'right' ,cattributes => 'Zwidth="400" ABGCOLOR="#cccccc"' ); htp.tableRowClose; htp.tableClose; htp.nl; -- include in this frame: -- * link to VHV -- * link to VHV-rev notes -- * link to ODWAINFO htp.formopen ( curl => 'odwachck.doUndoCheckOut' , cmethod => 'POST' , cattributes => 'NAME="coForm"' ); cdwp.p ( p_string => cdwp.add_images('{undocheckout.gif}') ||'Undo Check Out ' , p_style => 'partitle' ); htp.nl; htp.nl; cdwp.tableOpen; -- if p_error_stack <> '' -- the report the errors now if instr(p_error_stack,'Error') > 0 then cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images('{deletion.gif}') ||'Errors' , p_attributes => 'VALIGN=TOP' ); cdwp.TableDataValue ( p_error_stack ); cdwp.tableRowClose; end if; -- error stack not empty cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images ('{' ||cdwpbase.get_icon( p_type_id => cdwpbase.get_ivid_type_id(p_ivid => p_ivid)) ||'}' ) ||cdwpbase.get_nls_type_name(p_type_id => cdwpbase.get_ivid_type_id(p_ivid => p_ivid)) ); cdwp.TableDataValue ( cdwpbase.get_name( jr_name.get_path( id => p_ivid, format=> 'NAME')) ||' ('||odwavrsn.get_version_label(p_ivid => p_ivid) ||')' ||odwainfo.info_url( p_ivid => p_ivid) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images ('{folder.gif}' ) ||Rob_msg.GetMsg(Rob_msg.CAP075_ODWACHCK_FOLPATH,'','','','') ); cdwp.TableDataValue ( cdwpbase.get_path( jr_name.get_path( id => p_ivid, format=> 'NAME')) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images('{branch.gif}') ||Rob_msg.GetMsg(Rob_msg.CAP076_ODWACHCK_BRANCH,'','','','') ); cdwp.TableDataValue ( odwavrsn.get_branch_label(p_ivid => p_ivid) ||' ;'||to_char(odwavrsn.get_edge_sequence(p_ivid => p_ivid)) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; cdwp.tableRowOpen; cdwp.tabledataheading ( cdwp.add_images('{workarea.gif}') ||Rob_msg.GetMsg(Rob_msg.CAP077_ODWACHCK_WA,'','','','') ); cdwp.TableDataValue ( cdwpbase.get_wa_name(p_wa_irid => odwactxt.get_workarea_irid) , p_Attributes => ' VALIGN=BOTTOM ' ); cdwp.tableRowClose; -- check out notes cdwp.tableRowOpen; cdwp.tabledataheading ( Rob_msg.GetMsg(Rob_msg.CAP078_ODWACHCK_CONOTES,'','','','') ); cdwp.TableDataValue ( odwavrsn.get_check_notes(p_ivid => p_ivid) ); cdwp.tableRowClose; cdwp.tableClose; htp.formhidden ( cname => 'p_ivid' , cvalue => to_char(odwactxt.get_pac_ivid) ); htp.formhidden ( cname => 'p_session_id' , cvalue => to_char(odwactxt.get_session_id) ); htp.formhidden ( cname => 'p_download' , cvalue => 'N' ); htp.formclose; htp.formopen ( curl => '' , cmethod => 'POST' , cattributes => 'NAME="buttonForm"' ); htp.tableopen(calign => 'CENTER'); htp.tablerowopen; htp.tabledata ( ' p_ivid) = 4819 -- Primary Access File then htp.tabledata ( '