/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2016 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

SET VERIFY OFF
SET FEEDBACK OFF
SET SCAN OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK



DECLARE 

  e_dir_exists EXCEPTION;
  PRAGMA EXCEPTION_INIT(e_dir_exists, -31003);

  e_does_not_exists EXCEPTION;
  PRAGMA EXCEPTION_INIT(e_does_not_exists , -31001);

  result boolean;
  
BEGIN

  BEGIN

    result := DBMS_XDB.createfolder('/public/xxas/');
    result := DBMS_XDB.createfolder('/public/xxas/emp/');
    result := DBMS_XDB.createfolder('/public/xxas/emp/view/');

  EXCEPTION
    WHEN e_dir_exists THEN
      NULL;
  END;

  
  BEGIN

    DBMS_XDB.DeleteResource('/public/xxas/emp/view/step-reassign.xml');

  EXCEPTION  
    WHEN e_does_not_exists THEN
      NULL;
  END;
  
  result := DBMS_XDB.createresource('/public/xxas/emp/view/step-reassign.xml',
'<View title="Step Reassign" defaultFormHandler="xxas_perf_review_pkg.handle_step_reassign" submitLabel="{message.XXAS_RB_COM_SUBMIT}" showSubmit="true">
  <EditFields>
      <Hidden id="PERF_REVIEW_FORM_ID"/>
      <Hidden id="ACTION"/>
      <Hidden id="CURRENT_STEP_ID"/>
      <Hidden id="PREVIOUS_STEP_ID"/>
      <Hidden id="NEXT_STEP_ID"/>
      <Hidden id="CURRENT_STEP_STAGE"/>
      <Hidden id="PREVIOUS_STEP_STAGE"/>
      <Hidden id="NEXT_STEP_STAGE"/>
      <Hidden id="CURRENT_STEP_INTERACTION"/>
      <Hidden id="PREVIOUS_STEP_INTERACTION"/>
      <Hidden id="NEXT_STEP_INTERACTION"/>
      <Hidden id="CURRENT_STEP_PARTIC_COUNT"/>
      <Hidden id="CURR_ST_PART_COUNT_EX_SELF"/>
      <Hidden id="PREVIOUS_STEP_PARTIC_COUNT"/>
      <Hidden id="PREV_ST_PART_COUNT_EX_SELF"/>
      <Hidden id="NEXT_STEP_PARTIC_COUNT"/>
      <Hidden id="PREV_ST_PARTIC_EX_SELF"/>
      <Hidden id="CURR_ST_PARTIC_EX_SELF"/>     
      <Html id="HELP_TEXT" />
      <Poplist id="CURRENT_REV_PERSON" label="Reassign to" required="true" 
      listProvider="REST:reviewstep/participants/${field.CURRENT_STEP_ID}" hideIf="model.ACTION.value != &apos;REASSIGN&apos;"/>
      <TextArea id="COMMENTS" label="Comments" emptyValue="Enter comments" maxChars="2000" />
      <Poplist id="CONFIRMATION" label="{message.XXAS_PERF_ST_ACTION_AGREE}" visible="false" value="Y" listProvider="LOOKUP_TYPE:YES_NO" required="true" showAsBoolean="true" positiveBooleanValue="Y"/>
   </EditFields>
</View>
' );
xxas_forms_pkg.update_forms_resource('/public/xxas/emp/view/step-reassign.xml'); 
END;
/
COMMIT;
EXIT;
