  /* $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/worklist-notif-summary.xml');

    EXCEPTION
      WHEN e_does_not_exists THEN
        NULL;
    END;

    
    result := DBMS_XDB.createresource('/public/xxas/emp/view/worklist-notif-summary.xml',
  '<View submitLabel="{message.XXAS_RB_COM_SAVE}" title="Worklist summary" showSubmit="false" defaultFormHandler="xxas_com_worklist_pkg.form_respond">
     <EditFields>
     
	     <Container id="BASIC_GRP">
         <Hidden id="STATUS"/>
         <Hidden id="BEGIN_DATE"/>
         <Hidden id="DUE_DATE"/>
         <Hidden id="END_DATE"/>
         <Hidden id="ATTACHMENTS_COUNT"/>
		 <Hidden id="FILE_ATTACHMENTS_COUNT"/>
         <Hidden id="WEB_ATTACHMENTS_COUNT"/>
         <Poplist id="SHOW_HEADERS" label="{message.XXAS_NOTIF_SHOW_HEADERS}" value="Y" listProvider="LOOKUP_TYPE:YES_NO" showAsBoolean="true" positiveBooleanValue="Y"
                  description="{message.XXAS_WL_SUMM_HEADER_DESC}"/>
       </Container>
       
       <Container id="OTHERS_GRP" hideIf="model.BASIC_GRP.SHOW_HEADERS.value!=&apos;Y&apos;">
         <TextArea id="SUBJECT" label="{message.XXAS_NOTIF_SUBJECT}" enabled="false"/>
         <Combolist id="FROM" label="{message.XXAS_NOTIF_FROM}" visible="true" enabled="false" multipleSelection="true" style="tags"/>
         <Combolist id="TO" label="{message.XXAS_NOTIF_TO}"  visible="true" enabled="false" multipleSelection="true" style="tags"/>
         <TextArea id="SENT" label="{message.XXAS_NOTIF_SENT}" enabled="false" hideIf="model.BASIC_GRP.BEGIN_DATE.value==null"/>
         <TextArea id="DUE" label="{message.XXAS_NOTIF_DUE}" enabled="false" hideIf="model.BASIC_GRP.DUE_DATE.value==null"/>
         <TextArea id="CLOSED" label="{message.XXAS_NOTIF_CLOSED}" enabled="false" hideIf="model.BASIC_GRP.STATUS.value==&apos;OPEN&apos;"/>
         <TextArea id="NOTIFICATION_ID" label="{message.XXAS_NOTIF_ID}" enabled="false"/>
         <Combolist id="RESPOND" label="{message.XXAS_NOTIF_RESPONDER}"  visible="true" enabled="false" multipleSelection="true" style="tags"
                    hideIf="model.BASIC_GRP.STATUS.value==&apos;OPEN&apos;"/>
       </Container>
       
      <Container id="ATTACH_GRP" label="{message.XXAS_NOTIF_ATTACHMENTS}" hideIf="model.BASIC_GRP.ATTACHMENTS_COUNT.value==0">
        <ListItem id="NOTIFICATION_ID" style="row" listFunction="xxas_attachment_util_pkg.get_attachment_details"/>
      </Container>
       
     </EditFields>
  </View>' ); 
  xxas_forms_pkg.update_forms_resource('/public/xxas/emp/view/worklist-notif-summary.xml');
  END;
  /
  COMMIT;
  EXIT;
