CREATE OR REPLACE PACKAGE BODY saco_help IS /* * $Header: /Isle Of Grain/database/PLSQL/saco_help.pck 1 7/01/05 12:54 Gilberta $ * $Revision: 1 $ * */ PROCEDURE display(p_context IN VARCHAR2) IS v_context help_text.CONTEXT%TYPE := upper(substr(p_context ,1 ,80)); v_docu_id help_text.docu_id%TYPE; FUNCTION get_docu_id(p_context help_text.CONTEXT%TYPE) RETURN help_text.docu_id%TYPE IS v_docu_id help_text.docu_id%TYPE; v_syus_lang help_text.LANGUAGE%TYPE := caco_utilities.get_syus_lang; v_string_table caco_utilities.t_string_table; v_string_count NUMBER; BEGIN caco_utilities.string_to_table(p_string => p_context ,p_delimiter => '$' ,p_table => v_string_table ,p_count => v_string_count); FOR v_string_check_index IN REVERSE 1 .. v_string_count LOOP v_context := NULL; FOR v_build_string_index IN 1 .. v_string_check_index LOOP v_context := v_context || v_string_table(v_build_string_index) .stringpart || v_string_table(v_build_string_index) .delimiter; END LOOP; -- -- just get the first match -- FOR v_language IN (SELECT decode(LANGUAGE ,v_syus_lang ,0 ,decode(LANGUAGE ,'EN' ,1 ,2)) ,docu_id FROM help_text WHERE CONTEXT = v_context ORDER BY 1) LOOP v_docu_id := v_language.docu_id; EXIT; END LOOP; -- -- finish as soon as we have an id -- EXIT WHEN NOT v_docu_id IS NULL; END LOOP; RETURN v_docu_id; END get_docu_id; BEGIN -- caco_debug.debug_on; caco_debug.putline('Called with ' || v_context); v_docu_id := get_docu_id(v_context); caco_debug.putline('Found ' || v_docu_id); IF v_docu_id IS NOT NULL THEN saco_documents.download_document(p_docu_id => v_docu_id); ELSE htp.htmlopen; htp.headopen; htp.title(ctitle => caco_utilities.get_module_text(p_text_number => 1019)); -- caco_system.content_type; -- htp.linkrel('stylesheet' ,'caco_system.css?p_type=general'); htp.headclose; htp.bodyopen; htp.print(caco_system.menu); htp.header(nsize => 1 ,cheader => caco_utilities.get_module_text(p_text_number => 1019)); htp.bold(caco_utilities.get_module_text(p_text_number => 1019)); htp.bodyclose; htp.htmlclose; END IF; END display; BEGIN -- Initialization NULL; END saco_help; /