prompt --application/pages/page_00023
begin
--   Manifest
--     PAGE: 00023
--   Manifest End
wwv_flow_imp.component_begin (
 p_version_yyyy_mm_dd=>'2023.10.31'
,p_release=>'23.2.4'
,p_default_workspace_id=>16017191443360494
,p_default_application_id=>10001
,p_default_id_offset=>0
,p_default_owner=>'STUDENT'
);
wwv_flow_imp_page.create_page(
 p_id=>23
,p_name=>'Choose Vocabulary Practice Options'
,p_alias=>'CHOOSE-VOCABULARY-PRACTICE-OPTIONS'
,p_step_title=>'Choose Vocabulary Practice Options'
,p_autocomplete_on_off=>'OFF'
,p_page_template_options=>'#DEFAULT#'
,p_protection_level=>'C'
,p_page_component_map=>'16'
,p_last_updated_by=>'STUDENT_DEV'
,p_last_upd_yyyymmddhh24miss=>'20240221090149'
);
wwv_flow_imp_page.create_page_plug(
 p_id=>wwv_flow_imp.id(10927002195902764)
,p_plug_name=>'Choose Vocabulary Practice Options'
,p_region_template_options=>'#DEFAULT#:t-Wizard--hideStepsXSmall'
,p_plug_template=>wwv_flow_imp.id(16133604317514901)
,p_plug_display_sequence=>10
,p_list_id=>wwv_flow_imp.id(10926169243902728)
,p_plug_source_type=>'NATIVE_LIST'
,p_list_template_id=>wwv_flow_imp.id(16164979301515009)
);
wwv_flow_imp_page.create_page_plug(
 p_id=>wwv_flow_imp.id(10927169528902764)
,p_plug_name=>'Choose Vocabulary Practice Options'
,p_parent_plug_id=>wwv_flow_imp.id(10927002195902764)
,p_region_template_options=>'#DEFAULT#'
,p_plug_template=>wwv_flow_imp.id(16062384265514656)
,p_plug_display_sequence=>10
,p_plug_display_point=>'SUB_REGIONS'
,p_attribute_01=>'N'
,p_attribute_02=>'HTML'
,p_attribute_03=>'Y'
);
wwv_flow_imp_page.create_page_button(
 p_id=>wwv_flow_imp.id(10928498563902773)
,p_button_sequence=>10
,p_button_plug_id=>wwv_flow_imp.id(10927002195902764)
,p_button_name=>'CANCEL'
,p_button_action=>'REDIRECT_PAGE'
,p_button_template_options=>'#DEFAULT#'
,p_button_template_id=>wwv_flow_imp.id(16189347253515098)
,p_button_image_alt=>'Cancel'
,p_button_position=>'CLOSE'
,p_button_redirect_url=>'f?p=&APP_ID.:1:&APP_SESSION.::&DEBUG.:::'
);
wwv_flow_imp_page.create_page_button(
 p_id=>wwv_flow_imp.id(10928797720902773)
,p_button_sequence=>30
,p_button_plug_id=>wwv_flow_imp.id(10927002195902764)
,p_button_name=>'NEXT'
,p_button_action=>'SUBMIT'
,p_button_template_options=>'t-Button--iconRight'
,p_button_template_id=>wwv_flow_imp.id(16189438884515099)
,p_button_is_hot=>'Y'
,p_button_image_alt=>'Next'
,p_button_position=>'NEXT'
,p_icon_css_classes=>'fa-chevron-right'
);
wwv_flow_imp_page.create_page_branch(
 p_id=>wwv_flow_imp.id(10929436467902776)
,p_branch_name=>'Go To Page 24'
,p_branch_action=>'f?p=&APP_ID.:24:&SESSION.::&DEBUG.::P24_PRACTICE_COUNT,P24_PRACTICE_DIRECTION:&P23_PRACTICE_COUNT.,&P23_PRACTICE_DIRECTION.&success_msg=#SUCCESS_MSG#'
,p_branch_point=>'AFTER_PROCESSING'
,p_branch_type=>'REDIRECT_URL'
,p_branch_when_button_id=>wwv_flow_imp.id(10928797720902773)
,p_branch_sequence=>20
);
wwv_flow_imp_page.create_page_item(
 p_id=>wwv_flow_imp.id(4619735750271446)
,p_name=>'P23_PRACTICE_COUNT'
,p_item_sequence=>10
,p_item_plug_id=>wwv_flow_imp.id(10927169528902764)
,p_prompt=>'Practice Count'
,p_display_as=>'NATIVE_SELECT_LIST'
,p_lov=>'STATIC:10;10,15;15,20;20,25;25,30;30'
,p_cHeight=>1
,p_field_template=>wwv_flow_imp.id(16186900279515084)
,p_item_template_options=>'#DEFAULT#'
,p_lov_display_extra=>'NO'
,p_attribute_01=>'NONE'
,p_attribute_02=>'N'
);
wwv_flow_imp_page.create_page_item(
 p_id=>wwv_flow_imp.id(4619905393271448)
,p_name=>'P23_PRACTICE_TYPE'
,p_item_sequence=>30
,p_item_plug_id=>wwv_flow_imp.id(10927169528902764)
,p_prompt=>'Vocabulary Type'
,p_display_as=>'NATIVE_SELECT_LIST'
,p_named_lov=>'LOV_VOCABULARY_TYPE'
,p_lov=>'.'||wwv_flow_imp.id(10895357747746433)||'.'
,p_cHeight=>1
,p_field_template=>wwv_flow_imp.id(16186900279515084)
,p_item_template_options=>'#DEFAULT#'
,p_lov_display_extra=>'NO'
,p_attribute_01=>'NONE'
,p_attribute_02=>'N'
);
wwv_flow_imp_page.create_page_item(
 p_id=>wwv_flow_imp.id(4620142837271450)
,p_name=>'P23_PRACTICE_DIRECTION'
,p_item_sequence=>40
,p_item_plug_id=>wwv_flow_imp.id(10927169528902764)
,p_prompt=>'Practice Type'
,p_display_as=>'NATIVE_SELECT_LIST'
,p_named_lov=>'LOV_VOCABULARY_DIRECTION'
,p_lov=>'.'||wwv_flow_imp.id(11024487289977832)||'.'
,p_cHeight=>1
,p_field_template=>wwv_flow_imp.id(16186900279515084)
,p_item_template_options=>'#DEFAULT#'
,p_lov_display_extra=>'NO'
,p_attribute_01=>'NONE'
,p_attribute_02=>'N'
);
wwv_flow_imp_page.create_page_item(
 p_id=>wwv_flow_imp.id(10946242617306633)
,p_name=>'P23_SEQ_FROM'
,p_item_sequence=>50
,p_item_plug_id=>wwv_flow_imp.id(10927169528902764)
,p_prompt=>'Sequence From'
,p_display_as=>'NATIVE_NUMBER_FIELD'
,p_cSize=>8
,p_field_template=>wwv_flow_imp.id(16186646648515083)
,p_item_template_options=>'#DEFAULT#'
,p_attribute_03=>'left'
,p_attribute_04=>'numeric'
);
wwv_flow_imp_page.create_page_item(
 p_id=>wwv_flow_imp.id(10946347735306634)
,p_name=>'P23_SEQ_TO'
,p_item_sequence=>60
,p_item_plug_id=>wwv_flow_imp.id(10927169528902764)
,p_prompt=>'Sequence To'
,p_display_as=>'NATIVE_NUMBER_FIELD'
,p_cSize=>8
,p_field_template=>wwv_flow_imp.id(16186646648515083)
,p_item_template_options=>'#DEFAULT#'
,p_attribute_03=>'left'
,p_attribute_04=>'numeric'
);
wwv_flow_imp_page.create_page_process(
 p_id=>wwv_flow_imp.id(4620092831271449)
,p_process_sequence=>10
,p_process_point=>'AFTER_SUBMIT'
,p_process_type=>'NATIVE_PLSQL'
,p_process_name=>'Re-Populate Temp Table'
,p_process_sql_clob=>wwv_flow_string.join(wwv_flow_t_varchar2(
'DECLARE',
'',
'    lv_session_id VARCHAR2(100) := APEX_CUSTOM_AUTH.GET_SESSION_ID;',
'',
'BEGIN',
'',
'    DELETE FROM',
'        stdt_en_vocabularies_temp',
'    WHERE',
'        -- Reset for current session',
'        session_id = APEX_CUSTOM_AUTH.GET_SESSION_ID',
'    -- Reset for inactive session',
'    OR session_id NOT IN (',
'        SELECT',
'            aws.apex_session_id',
'        FROM',
'            apex_workspace_sessions aws',
'    );',
'',
'    apex_debug.log_message(',
'        p_message   => ''------'',',
'        p_level     => apex_debug.c_log_level_info',
'    );',
'',
'    apex_debug.log_message(',
'        p_message   => ''session id => '' || lv_session_id,',
'        p_level     => apex_debug.c_log_level_info',
'    );',
'',
'    apex_debug.log_message(',
'        p_message   => ''Table has been deleted, SQL%ROWCOUNT = '' || SQL%ROWCOUNT,',
'        p_level     => apex_debug.c_log_level_info',
'    );',
'',
'    -- Populate temp table',
'    INSERT INTO stdt_en_vocabularies_temp sevt(',
'        vocabulary_id,',
'        row_num,',
'        vocabulary_name,',
'        "TYPE",',
'        "TRANSLATION",',
'        vocabulary_answer,',
'        session_id',
'    )',
'',
'    WITH CTE AS (',
'        SELECT',
'            sev.vocabulary_id,',
'            sev.vocabulary_name,',
'            sev."TYPE",',
'            sev."TRANSLATION",',
'            lv_session_id           AS session_id',
'        FROM',
'            stdt_en_vocabularies sev',
'        WHERE',
'            sev.type = :P23_PRACTICE_TYPE',
'        AND (:P23_SEQ_FROM IS NULL',
'             OR sev.seq >= :P23_SEQ_FROM)',
'        AND (:P23_SEQ_TO IS NULL',
'             OR sev.seq <= :P23_SEQ_TO)',
'        ORDER BY dbms_random.random',
'    )',
'    SELECT',
'        cte.vocabulary_id       AS VOCABULARY_ID,',
'        ROWNUM                  AS ROW_NUM,',
'        cte.vocabulary_name     AS VOCABULARY_NAME,',
'        cte.type                AS TYPE,',
'        cte."TRANSLATION"       AS "TRANSLATION",',
'        NULL                    AS VOCABULARY_ANSWER,',
'        cte.session_id          AS SESSION_ID',
'    FROM',
'        cte',
'    WHERE',
'        ROWNUM <= :P23_PRACTICE_COUNT;',
'',
'    apex_debug.log_message(',
'        p_message   => ''Table has been populated, SQL%ROWCOUNT = '' || SQL%ROWCOUNT,',
'        p_level     => apex_debug.c_log_level_info',
'    );',
'',
'END;'))
,p_process_clob_language=>'PLSQL'
,p_error_display_location=>'INLINE_IN_NOTIFICATION'
,p_internal_uid=>4620092831271449
);
wwv_flow_imp.component_end;
end;
/
