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

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

CREATE OR REPLACE VIEW xxas_pages_list_v
AS
SELECT 'flexible' "type"
      ,p.menu_id  "id"
      ,p.title || decode(p.slug, null, null
                        ,' (' || p.slug || ')') "line1"
      ,decode
        (p.published_flag, 'Y', null
        ,'<font color="'
         || xxas_rslt_cache_pkg.resolve_color_name('grey')
         || '">Draft</font>') "line3"
      ,p.icon     "icon"
      ,p.icon_color_hex "statusColor"
      ,'page-details' "pageId"
      ,p.menu_id "objectId"
      ,xxas_page_util_pkg.blocks_count_string(p.menu_id) "decorator"
      /* Commented out as not ready yet
      ,xxas_page_pkg.page_item_actions
        (p.published_flag)
        .get_xml() "linked" */
      ,p.title
      ,p.last_update_date
FROM   xxas_pages_v p
WHERE  p.internal_page_flag <> 'Y';

BEGIN
  xxas_fnd_dictionary_pkg.add_view
   (p_application_short_name => xxas_util_pkg.app
   ,p_view_name              => 'XXAS_PAGES_LIST_V'
   ,p_description            => 'Applaud Pages');
END;
/

COMMIT;
EXIT;

