prompt --application/pages/page_00001
begin
--   Manifest
--     PAGE: 00001
--   Manifest End
wwv_flow_imp.component_begin (
 p_version_yyyy_mm_dd=>'2023.10.31'
,p_release=>'23.2.6'
,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=>1
,p_name=>'Home'
,p_alias=>'HOME'
,p_step_title=>'Study Performance Tracking App'
,p_autocomplete_on_off=>'OFF'
,p_javascript_file_urls=>'[require jet]'
,p_javascript_code_onload=>'require(["ojs/ojgauge"], function() {});'
,p_css_file_urls=>'#JET_CSS_DIRECTORY#alta/oj-alta-notag-min.css'
,p_page_template_options=>'#DEFAULT#'
,p_protection_level=>'C'
,p_page_component_map=>'13'
,p_last_updated_by=>'STUDENT_DEV'
,p_last_upd_yyyymmddhh24miss=>'20240513165408'
);
wwv_flow_imp_page.create_page_plug(
 p_id=>wwv_flow_imp.id(9285100080561105)
,p_plug_name=>'Dashboard'
,p_region_template_options=>'#DEFAULT#:t-Region--scrollBody'
,p_plug_template=>wwv_flow_imp.id(16116793714514810)
,p_plug_display_sequence=>20
,p_attribute_01=>'N'
,p_attribute_02=>'HTML'
);
wwv_flow_imp_page.create_page_plug(
 p_id=>wwv_flow_imp.id(9285311031561107)
,p_plug_name=>'Tracked Stories'
,p_parent_plug_id=>wwv_flow_imp.id(9285100080561105)
,p_region_template_options=>'#DEFAULT#'
,p_component_template_options=>'#DEFAULT#'
,p_plug_template=>wwv_flow_imp.id(16069428724514672)
,p_plug_display_sequence=>10
,p_plug_display_point=>'SUB_REGIONS'
,p_query_type=>'SQL'
,p_plug_source=>wwv_flow_string.join(wwv_flow_t_varchar2(
'select',
'    ss.STORY_ID,',
'    ss.STORY_NAME,',
'    ss.DESCRIPTION,',
'    ss.TENANT_ID,',
'    ss.STUDENT_ID,',
'    ss.SUBJECT_ID,',
'    ss.CREATED_BY,',
'    ss.CREATION_DATE,',
'    ss.LAST_UPDATED_BY,',
'    ss.LAST_UPDATE_DATE,',
'    ss.DELETED_FLAG,',
'    ss.TRACKED_FLAG,',
'    ss.TERM_ID,',
'    (',
'        select',
'            sum(nvl(st.completion_percent, 0))',
'            / count(*)',
'        from',
'            stdt_tasks st',
'        where',
'            st.story_id = ss.story_id',
'    ) as progress,',
'    st.term_name,',
unistr('    ssub.subject_name\FF0C'),
'    apex_page.get_url(',
'        p_page     => 7,',
'        p_items    => ''P7_SEARCH_STUDENT,P7_SEARCH_TERM,P7_SEARCH_SUBJECT,P7_SEARCH_STORY'',',
'        p_values   => ss.student_id || '','' || ss.term_id || '','' || ss.subject_id || '','' || ss.story_id',
'    ) as link_url',
'from',
'    STDT_STORIES ss,',
'    stdt_terms st,',
'    stdt_subjects ssub',
'where',
'    ss.tracked_flag = ''Y''',
'and ss.term_id = st.term_id',
'and ss.subject_id = ssub.subject_id'))
,p_lazy_loading=>false
,p_plug_source_type=>'NATIVE_CARDS'
,p_plug_query_num_rows_type=>'SCROLL'
,p_show_total_row_count=>false
);
wwv_flow_imp_page.create_card(
 p_id=>wwv_flow_imp.id(9285448015561108)
,p_region_id=>wwv_flow_imp.id(9285311031561107)
,p_layout_type=>'GRID'
,p_title_adv_formatting=>false
,p_title_column_name=>'STORY_NAME'
,p_sub_title_adv_formatting=>false
,p_sub_title_column_name=>'DESCRIPTION'
,p_body_adv_formatting=>true
,p_body_html_expr=>wwv_flow_string.join(wwv_flow_t_varchar2(
'<a href="&LINK_URL.">',
'<oj-status-meter-gauge',
'  value=&PROGRESS.',
'  min=''0''',
'  max=''100''',
'  animation-on-display="auto"',
'  animation-duration=''2000''',
'  orientation=''circular''',
'  readonly=true',
'  thresholds=''[{"max": 33}, {"max": 67}, {}]''>',
'</oj-status-meter-gauge>',
'</a>'))
,p_second_body_adv_formatting=>true
,p_second_body_html_expr=>wwv_flow_string.join(wwv_flow_t_varchar2(
unistr('<div>\5B66\671F: &TERM_NAME.</div>'),
unistr('<div>\8BFE\7A0B: &SUBJECT_NAME.</div>')))
,p_media_adv_formatting=>false
);
wwv_flow_imp_page.create_page_plug(
 p_id=>wwv_flow_imp.id(9889691274144033)
,p_plug_name=>'Global Setting'
,p_region_template_options=>'#DEFAULT#:t-Region--scrollBody'
,p_plug_template=>wwv_flow_imp.id(16116793714514810)
,p_plug_display_sequence=>30
,p_include_in_reg_disp_sel_yn=>'Y'
,p_attribute_01=>'N'
,p_attribute_02=>'HTML'
);
wwv_flow_imp_page.create_page_plug(
 p_id=>wwv_flow_imp.id(16223001900515601)
,p_plug_name=>'Study Performance Tracking App'
,p_icon_css_classes=>'app-icon'
,p_region_template_options=>'#DEFAULT#'
,p_escape_on_http_output=>'Y'
,p_plug_template=>wwv_flow_imp.id(16094697015514771)
,p_plug_display_sequence=>10
,p_plug_display_point=>'REGION_POSITION_01'
,p_plug_query_num_rows=>15
,p_attribute_01=>'N'
,p_attribute_02=>'HTML'
,p_attribute_03=>'Y'
);
wwv_flow_imp_page.create_page_plug(
 p_id=>wwv_flow_imp.id(19128154182169029)
,p_plug_name=>'Administration'
,p_region_template_options=>'#DEFAULT#:t-Region--noPadding:t-Region--scrollBody'
,p_component_template_options=>'#DEFAULT#'
,p_plug_template=>wwv_flow_imp.id(16116793714514810)
,p_plug_display_sequence=>40
,p_include_in_reg_disp_sel_yn=>'Y'
,p_list_id=>wwv_flow_imp.id(20621341221513399)
,p_plug_source_type=>'NATIVE_LIST'
,p_list_template_id=>wwv_flow_imp.id(16171126567515021)
,p_plug_display_condition_type=>'FUNCTION_BODY'
,p_plug_display_when_condition=>wwv_flow_string.join(wwv_flow_t_varchar2(
'DECLARE',
'    lv_admin_flag VARCHAR2(1);',
'BEGIN',
'    SELECT admin_flag',
'    INTO   lv_admin_flag',
'    FROM   stdt_users',
'    WHERE  user_name = :APP_USER;',
'',
'    IF (lv_admin_flag = ''Y'') THEN',
'        RETURN TRUE;',
'    ELSE',
'        RETURN FALSE;',
'    END IF;',
'EXCEPTION',
'    WHEN OTHERS THEN',
'        RETURN FALSE;',
'END;'))
,p_plug_display_when_cond2=>'PLSQL'
);
wwv_flow_imp_page.create_page_item(
 p_id=>wwv_flow_imp.id(3287341446056408)
,p_name=>'P1_WELCOME'
,p_item_sequence=>10
,p_item_default=>'NVL(:APP_USER, ''Anonymous User'')'
,p_item_default_type=>'EXPRESSION'
,p_item_default_language=>'PLSQL'
,p_prompt=>'Welcome!'
,p_display_as=>'NATIVE_DISPLAY_ONLY'
,p_field_template=>wwv_flow_imp.id(16186811375515083)
,p_item_template_options=>'#DEFAULT#'
,p_attribute_01=>'Y'
,p_attribute_02=>'VALUE'
,p_attribute_04=>'Y'
,p_attribute_05=>'PLAIN'
);
wwv_flow_imp_page.create_page_item(
 p_id=>wwv_flow_imp.id(9889733334144034)
,p_name=>'P1_SESSION_LANGUAGE'
,p_item_sequence=>20
,p_item_plug_id=>wwv_flow_imp.id(9889691274144033)
,p_item_default=>'APEX_UTIL.get_session_lang'
,p_item_default_type=>'EXPRESSION'
,p_item_default_language=>'PLSQL'
,p_prompt=>'Session Language'
,p_display_as=>'NATIVE_RADIOGROUP'
,p_lov=>unistr('STATIC:English;en,\7B80\4F53\4E2D\6587;zh-cn')
,p_field_template=>wwv_flow_imp.id(16186811375515083)
,p_item_template_options=>'#DEFAULT#'
,p_lov_display_extra=>'NO'
,p_attribute_01=>'2'
,p_attribute_02=>'NONE'
);
wwv_flow_imp_page.create_page_item(
 p_id=>wwv_flow_imp.id(15031274091817401)
,p_name=>'P1_OCR_TOOL'
,p_item_sequence=>50
,p_item_plug_id=>wwv_flow_imp.id(9889691274144033)
,p_item_default=>'APEX_APP_SETTING.GET_VALUE(''OCR_TOOL'')'
,p_item_default_type=>'EXPRESSION'
,p_item_default_language=>'SQL'
,p_prompt=>'OCR Tool'
,p_display_as=>'NATIVE_RADIOGROUP'
,p_named_lov=>'LOV_OCR_TOOL'
,p_lov=>'.'||wwv_flow_imp.id(15046207819886791)||'.'
,p_field_template=>wwv_flow_imp.id(16186811375515083)
,p_item_template_options=>'#DEFAULT#'
,p_lov_display_extra=>'NO'
,p_attribute_01=>'3'
,p_attribute_02=>'NONE'
);
wwv_flow_imp_page.create_page_item(
 p_id=>wwv_flow_imp.id(15033268723817421)
,p_name=>'P1_ASR_TOOL'
,p_item_sequence=>60
,p_item_plug_id=>wwv_flow_imp.id(9889691274144033)
,p_item_default=>'APEX_APP_SETTING.GET_VALUE(''ASR_TOOL'')'
,p_item_default_type=>'EXPRESSION'
,p_item_default_language=>'SQL'
,p_prompt=>'ASR Tool'
,p_display_as=>'NATIVE_RADIOGROUP'
,p_named_lov=>'LOV_ASR_TOOL'
,p_lov=>'.'||wwv_flow_imp.id(17067981530128885)||'.'
,p_field_template=>wwv_flow_imp.id(16186811375515083)
,p_item_template_options=>'#DEFAULT#'
,p_lov_display_extra=>'NO'
,p_attribute_01=>'3'
,p_attribute_02=>'NONE'
);
wwv_flow_imp_page.create_page_item(
 p_id=>wwv_flow_imp.id(15033436212817423)
,p_name=>'P1_OPENAI_WHISPER_MODEL'
,p_item_sequence=>70
,p_item_plug_id=>wwv_flow_imp.id(9889691274144033)
,p_item_default=>'APEX_APP_SETTING.GET_VALUE(''OPENAI_WHISPER_MODEL'')'
,p_item_default_type=>'EXPRESSION'
,p_item_default_language=>'SQL'
,p_prompt=>'OpenAI Whisper Model'
,p_display_as=>'NATIVE_RADIOGROUP'
,p_named_lov=>'LOV_OPENAI_WHISPER_MODEL'
,p_lov=>'.'||wwv_flow_imp.id(17070316969149141)||'.'
,p_display_when=>'P1_ASR_TOOL'
,p_display_when2=>'W'
,p_display_when_type=>'VAL_OF_ITEM_IN_COND_EQ_COND2'
,p_field_template=>wwv_flow_imp.id(16186811375515083)
,p_item_template_options=>'#DEFAULT#'
,p_lov_display_extra=>'NO'
,p_attribute_01=>'4'
,p_attribute_02=>'NONE'
);
wwv_flow_imp_page.create_page_item(
 p_id=>wwv_flow_imp.id(20577748859116503)
,p_name=>'P1_DESKTOP_THEME_STYLE_ID'
,p_is_required=>true
,p_item_sequence=>40
,p_item_plug_id=>wwv_flow_imp.id(9889691274144033)
,p_use_cache_before_default=>'NO'
,p_prompt=>'Desktop Theme Style'
,p_source=>wwv_flow_string.join(wwv_flow_t_varchar2(
'select s.theme_style_id',
'from apex_application_theme_styles s, apex_application_themes t',
'where s.application_id = t.application_id',
'and s.theme_number = t.theme_number',
'and s.application_id = :app_id',
'and t.ui_type_name   = ''DESKTOP''',
'and s.is_current = ''Yes'''))
,p_source_type=>'QUERY'
,p_display_as=>'NATIVE_RADIOGROUP'
,p_lov=>wwv_flow_string.join(wwv_flow_t_varchar2(
'select s.name d,',
'          s.theme_style_id r',
'from apex_application_theme_styles s, apex_application_themes t',
'where s.application_id = t.application_id',
'and s.theme_number = t.theme_number',
'and s.application_id = :app_id',
'and t.ui_type_name   = ''DESKTOP''',
'and t.is_current = ''Yes''',
'order by 1'))
,p_display_when=>wwv_flow_string.join(wwv_flow_t_varchar2(
'select 1',
'from apex_application_theme_styles s, apex_application_themes t',
'where s.application_id = t.application_id',
'and s.theme_number = t.theme_number',
'and s.application_id = :app_id',
'and t.ui_type_name   = ''DESKTOP''',
'and t.is_current = ''Yes'''))
,p_display_when_type=>'EXISTS'
,p_field_template=>wwv_flow_imp.id(16188186001515088)
,p_item_template_options=>'#DEFAULT#'
,p_lov_display_extra=>'NO'
,p_protection_level=>'S'
,p_restricted_characters=>'WEB_SAFE'
,p_encrypt_session_state_yn=>'N'
,p_attribute_01=>'5'
,p_attribute_02=>'NONE'
);
wwv_flow_imp_page.create_page_da_event(
 p_id=>wwv_flow_imp.id(9890950498144046)
,p_name=>'Option Changed'
,p_event_sequence=>20
,p_triggering_element_type=>'ITEM'
,p_triggering_element=>'P1_SESSION_LANGUAGE,P1_DESKTOP_THEME_STYLE_ID,P1_OCR_TOOL,P1_ASR_TOOL,P1_OPENAI_WHISPER_MODEL'
,p_bind_type=>'bind'
,p_execution_type=>'IMMEDIATE'
,p_bind_event_type=>'change'
);
wwv_flow_imp_page.create_page_da_action(
 p_id=>wwv_flow_imp.id(9891000849144047)
,p_event_id=>wwv_flow_imp.id(9890950498144046)
,p_event_result=>'TRUE'
,p_action_sequence=>10
,p_execute_on_page_init=>'N'
,p_action=>'NATIVE_SUBMIT_PAGE'
,p_attribute_02=>'Y'
);
wwv_flow_imp_page.create_page_da_event(
 p_id=>wwv_flow_imp.id(10947271542306643)
,p_name=>'Check Session Language Existence'
,p_event_sequence=>30
,p_bind_type=>'bind'
,p_bind_event_type=>'ready'
,p_display_when_type=>'EXPRESSION'
,p_display_when_cond=>wwv_flow_string.join(wwv_flow_t_varchar2(
'APEX_UTIL.GET_SESSION_LANG IS NULL',
'AND APEX_UTIL.GET_PREFERENCE(      ',
'                p_preference => ''DEFAULT_LANGUAGE'',',
'                p_user       => :APP_USER',
'        ) IS NOT NULL'))
,p_display_when_cond2=>'PLSQL'
);
wwv_flow_imp_page.create_page_da_action(
 p_id=>wwv_flow_imp.id(10947374640306644)
,p_event_id=>wwv_flow_imp.id(10947271542306643)
,p_event_result=>'TRUE'
,p_action_sequence=>10
,p_execute_on_page_init=>'N'
,p_name=>'Set Session Language'
,p_action=>'NATIVE_EXECUTE_PLSQL_CODE'
,p_attribute_01=>wwv_flow_string.join(wwv_flow_t_varchar2(
'BEGIN',
'    APEX_UTIL.SET_SESSION_LANG(',
'        APEX_UTIL.GET_PREFERENCE(      ',
'                p_preference => ''DEFAULT_LANGUAGE'',',
'                p_user       => :APP_USER',
'        )',
'    );',
'END;'))
,p_attribute_05=>'PLSQL'
,p_wait_for_result=>'Y'
);
wwv_flow_imp_page.create_page_da_action(
 p_id=>wwv_flow_imp.id(10947680934306647)
,p_event_id=>wwv_flow_imp.id(10947271542306643)
,p_event_result=>'TRUE'
,p_action_sequence=>10
,p_execute_on_page_init=>'N'
,p_name=>'Submit'
,p_action=>'NATIVE_SUBMIT_PAGE'
,p_attribute_02=>'Y'
);
wwv_flow_imp_page.create_page_process(
 p_id=>wwv_flow_imp.id(9890432295144041)
,p_process_sequence=>20
,p_process_point=>'AFTER_SUBMIT'
,p_process_type=>'NATIVE_PLSQL'
,p_process_name=>'Set Session Language'
,p_process_sql_clob=>wwv_flow_string.join(wwv_flow_t_varchar2(
'BEGIN',
'    APEX_UTIL.SET_SESSION_LANG(:P1_SESSION_LANGUAGE);',
'END;'))
,p_process_clob_language=>'PLSQL'
,p_process_error_message=>'#SQLERRM#'
,p_error_display_location=>'INLINE_IN_NOTIFICATION'
,p_internal_uid=>9890432295144041
);
wwv_flow_imp_page.create_page_process(
 p_id=>wwv_flow_imp.id(20577841671116504)
,p_process_sequence=>30
,p_process_point=>'AFTER_SUBMIT'
,p_process_type=>'NATIVE_PLSQL'
,p_process_name=>'Set Theme Style'
,p_process_sql_clob=>wwv_flow_string.join(wwv_flow_t_varchar2(
'if :P1_DESKTOP_THEME_STYLE_ID is not null then',
'    for c1 in (select theme_number',
'               from apex_application_themes',
'               where application_id = :app_id',
'               and ui_type_name   = ''DESKTOP''',
'               and is_current = ''Yes'')',
'    loop',
'        apex_theme.set_current_style (',
'            p_theme_number   => c1.theme_number,',
'            p_id => :P1_DESKTOP_THEME_STYLE_ID',
'            );',
'    end loop;',
'end if;'))
,p_process_clob_language=>'PLSQL'
,p_process_error_message=>'#SQLERRM#'
,p_error_display_location=>'INLINE_IN_NOTIFICATION'
,p_internal_uid=>20577841671116504
);
wwv_flow_imp_page.create_page_process(
 p_id=>wwv_flow_imp.id(15031341245817402)
,p_process_sequence=>40
,p_process_point=>'AFTER_SUBMIT'
,p_process_type=>'NATIVE_PLSQL'
,p_process_name=>'Set OCR Tool'
,p_process_sql_clob=>wwv_flow_string.join(wwv_flow_t_varchar2(
'IF :P1_OCR_TOOL IS NOT NULL THEN',
'    APEX_APP_SETTING.SET_VALUE (',
'        p_name  => ''OCR_TOOL'',',
'        p_value => :P1_OCR_TOOL',
'    );',
'END IF;'))
,p_process_clob_language=>'PLSQL'
,p_process_error_message=>'#SQLERRM#'
,p_error_display_location=>'INLINE_IN_NOTIFICATION'
,p_internal_uid=>15031341245817402
);
wwv_flow_imp_page.create_page_process(
 p_id=>wwv_flow_imp.id(15033378127817422)
,p_process_sequence=>50
,p_process_point=>'AFTER_SUBMIT'
,p_process_type=>'NATIVE_PLSQL'
,p_process_name=>'Set ASR Tool'
,p_process_sql_clob=>wwv_flow_string.join(wwv_flow_t_varchar2(
'IF :P1_ASR_TOOL IS NOT NULL THEN',
'    APEX_APP_SETTING.SET_VALUE (',
'        p_name  => ''ASR_TOOL'',',
'        p_value => :P1_ASR_TOOL',
'    );',
'END IF;',
'',
'IF :P1_OPENAI_WHISPER_MODEL IS NOT NULL THEN',
'    APEX_APP_SETTING.SET_VALUE (',
'        p_name  => ''OPENAI_WHISPER_MODEL'',',
'        p_value => :P1_OPENAI_WHISPER_MODEL',
'    );',
'END IF;'))
,p_process_clob_language=>'PLSQL'
,p_process_error_message=>'#SQLERRM#'
,p_error_display_location=>'INLINE_IN_NOTIFICATION'
,p_internal_uid=>15033378127817422
);
wwv_flow_imp.component_end;
end;
/
