Files
mip/Data/BulkLoad/EFT/Nominations/plsql/saco_stylesheet$.bdy

1094 lines
31 KiB
Plaintext

CREATE OR REPLACE PACKAGE BODY EFT_NOM.saco_stylesheet$ IS
--
-- Private Variables
--
g_index_number NUMBER := 1;
g_null_array owa_util.vc_arr;
--
-- Private Procedures
--
FUNCTION check_system_user RETURN BOOLEAN IS
--
v_return BOOLEAN := FALSE;
v_dummy VARCHAR(10);
--
CURSOR cur_sypr(p_syus_id IN system_users.syus_id%TYPE, p_prof_name IN VARCHAR) IS
SELECT NULL
FROM user_profiles uspr, system_profiles sypr
WHERE uspr.syus_id = p_syus_id AND uspr.sypr_id = sypr.sypr_id AND
sypr.name = p_prof_name;
--
BEGIN
--
OPEN cur_sypr(caco_utilities.get_syus_id, 'SYSTEM');
FETCH cur_sypr
INTO v_dummy;
--
IF cur_sypr%NOTFOUND THEN
--
v_return := FALSE;
--
ELSE
--
v_return := TRUE;
--
END IF;
--
CLOSE cur_sypr;
--
RETURN v_return;
--
END check_system_user;
--
PROCEDURE display_header(v_screen_name IN VARCHAR2,
v_body_atts IN VARCHAR2 DEFAULT NULL) IS
BEGIN
--
htp.htmlopen;
htp.headopen;
--
htp.meta('Content-Type', 'SACO_STYLESHEET', 'text/html');
htp.meta('Expires', '', '0');
htp.meta('Pragma', '', 'no-cache');
--
htp.linkrel('stylesheet', 'caco_system.css?p_type=content');
--
htp.headclose;
--
htp.bodyopen(cattributes => v_body_atts);
--
htp.print(caco_system.menu);
--
htp.title(v_screen_name);
--
htp.p('<h1>' || v_screen_name || '</h1>');
--
htp.anchor2(curl => 'saco_stylesheet$.showabout', ctext => 'About');
--
htp.br;
htp.br;
--
END display_header;
--
PROCEDURE display_footer IS
BEGIN
--
htp.bodyclose;
htp.htmlclose;
--
END display_footer;
--
PROCEDURE expand_javascript IS
BEGIN
--
htp.p('<script language="JavaScript1.2">');
htp.p('function initialise()');
htp.p('{');
htp.p(' tempColl = document.all.tags("DIV");');
htp.p(' for (i=0; i<tempColl.length; i++) {');
htp.p(' if (tempColl(i).className == "detail") tempColl(i).style.display = "none";');
htp.p(' }');
htp.p('}');
htp.p('function expandTag(el)');
htp.p('{');
htp.p(' whichEl = eval(el + "Detail");');
htp.p(' whichIm = event.srcElement;');
htp.p(' if (whichEl.style.display == "none") {');
htp.p(' whichEl.style.display = "block";');
htp.p(' }');
htp.p(' else {');
htp.p(' whichEl.style.display = "none";');
htp.p(' }');
htp.p(' }');
htp.p('</script>');
--
END expand_javascript;
--
FUNCTION dec_to_hex(decin IN NUMBER) RETURN VARCHAR2 IS
--
v_decin NUMBER;
v_next_digit NUMBER;
v_result VARCHAR(2000);
--
BEGIN
--
v_decin := decin;
--
WHILE v_decin > 0 LOOP
--
v_next_digit := mod(v_decin, 16);
--
IF v_next_digit > 9 THEN
--
IF v_next_digit = 10 THEN
v_result := 'A' || v_result;
ELSIF v_next_digit = 11 THEN
v_result := 'B' || v_result;
ELSIF v_next_digit = 12 THEN
v_result := 'C' || v_result;
ELSIF v_next_digit = 13 THEN
v_result := 'D' || v_result;
ELSIF v_next_digit = 14 THEN
v_result := 'E' || v_result;
ELSIF v_next_digit = 15 THEN
v_result := 'F' || v_result;
ELSE
raise_application_error(-20600, 'Untrapped exception');
END IF;
--
ELSE
--
v_result := to_char(v_next_digit) || v_result;
--
END IF;
--
v_decin := floor(v_decin / 16);
--
END LOOP;
--
RETURN NVL(v_result, '00');
--
END dec_to_hex;
--
PROCEDURE query_css IS
--
-- Cursor Declaration
--
CURSOR cur_stst(p_username IN stylesheets.username%TYPE DEFAULT NULL) IS
SELECT stst.stst_id,
caco_utilities.cgrefmeaning('STYLESHEET TYPE', stst.stst_type) stst_type
FROM stylesheets stst
WHERE (stst.username = p_username) OR
(p_username IS NULL AND stst.username IS NULL)
ORDER BY stst.stst_type;
--
-- Variable Declaration
--
v_found BOOLEAN;
--
BEGIN
--
-- Perform standard security check
--
IF NOT caco_security.security_check('saco_stylesheet$') THEN
--
RETURN;
--
END IF;
--
-- If allowed to use this module, build up a list of stored stylesheets
--
htp.para;
--
-- System Stylesheets
--
htp.p(htf.bold('System Stylesheets'));
htp.br;
--
-- Initialise Boolean
--
v_found := FALSE;
--
FOR cur_stst_rec IN cur_stst(NULL) LOOP
--
IF NOT v_found THEN
--
v_found := TRUE;
--
END IF;
--
IF check_system_user THEN
--
htp.anchor2('saco_stylesheet$.querybykey?p_stst_id=' ||
cur_stst_rec.stst_id,
cur_stst_rec.stst_type);
--
ELSE
--
htp.p(cur_stst_rec.stst_type);
--
END IF;
--
htp.br;
--
END LOOP;
--
IF NOT v_found THEN
--
htp.p(' ' || 'No System Stylesheets');
htp.br;
--
ELSE
--
v_found := FALSE;
--
END IF;
--
htp.br;
htp.p(htf.bold('User Stylesheets'));
htp.br;
--
FOR cur_stst_rec IN cur_stst(caco_utilities.get_syus_name) LOOP
--
IF NOT v_found THEN
--
v_found := TRUE;
--
END IF;
--
htp.anchor2('saco_stylesheet$.querybykey?p_stst_id=' ||
cur_stst_rec.stst_id,
cur_stst_rec.stst_type);
htp.br;
--
END LOOP;
--
IF NOT v_found THEN
--
htp.p(' ' || 'No User Stylesheets');
htp.br;
--
ELSE
--
v_found := FALSE;
--
END IF;
--
htp.br;
--
-- Include navigation buttons
--
htp.formopen(curl => 'saco_stylesheet$.action', cmethod => 'POST');
--
htp.formsubmit(cname => 'p_button', cvalue => 'Requery');
--
htp.formsubmit(cname => 'p_button', cvalue => 'New');
--
htp.formclose;
--
END query_css;
--
PROCEDURE display_item(p_item_type IN VARCHAR2,
p_item_name IN VARCHAR2,
p_item_prompt IN VARCHAR2,
p_item_value IN VARCHAR2) IS
--
-- Cursor Declaration
--
CURSOR cur_cgr(p_domain IN cg_ref_codes.rv_domain%TYPE, p_value IN cg_ref_codes.rv_low_value%TYPE) IS
SELECT cgr.rv_low_value, cgr.rv_meaning
FROM cg_ref_codes cgr
WHERE cgr.rv_domain = p_domain AND
(cgr.rv_low_value = p_value OR p_value IS NULL);
--
FUNCTION is_selected(p_value IN VARCHAR2, p_option IN VARCHAR2)
RETURN VARCHAR2 IS
--
v_return CHAR(1) := NULL;
--
BEGIN
--
IF p_value IS NOT NULL AND p_option = p_value THEN
--
v_return := 'Y';
--
END IF;
--
RETURN v_return;
--
END is_selected;
--
BEGIN
--
htp.formhidden(cname => 'p_item_type_array', cvalue => p_item_type);
--
g_index_number := g_index_number + 1;
--
htp.formhidden(cname => 'p_item_name_array', cvalue => p_item_name);
--
g_index_number := g_index_number + 1;
--
htp.formhidden(cname => 'p_item_prompt_array', cvalue => p_item_prompt);
--
g_index_number := g_index_number + 1;
--
IF p_item_type = 'TAG' THEN
--
htp.p('</div>');
--
htp.p('<div class="'||p_item_type||'" id="'||p_item_name||'header'||'"><a href="#" onclick="expandTag('''||p_item_name||'''); return false">');
htp.p(htf.bold(p_item_prompt) || '</a></div>');
--
htp.formhidden(cname => 'p_item_value_array', cvalue => p_item_value);
--
g_index_number := g_index_number + 1;
--
htp.p('<div class="detail" id="' || p_item_name || 'Detail">');
--
ELSIF p_item_type = 'SSTYPE' THEN
--
htp.formselectopen(cname => 'p_item_value_array',
cprompt => htf.bold(p_item_prompt || ': '));
--
FOR cur_cgr_rec IN cur_cgr('STYLESHEET TYPE', p_item_value) LOOP
--
htp.formselectoption(cvalue => cur_cgr_rec.rv_meaning,
cattributes => 'VALUE="' ||
cur_cgr_rec.rv_low_value || '"');
--
END LOOP;
--
htp.formselectclose;
htp.br;
htp.br;
--
g_index_number := g_index_number + 1;
--
ELSIF p_item_type = 'COLOUR' THEN
--
htp.p(htf.bold(p_item_prompt || ': '));
htp.formtext('p_item_value_array', 8, 8, p_item_value);
--
htp.anchor2(curl => '#',
cattributes => 'onClick="thew=window.open(''saco_stylesheet$.colour_chart?p_index=' ||
TO_CHAR(g_index_number - 1) ||
''',''newWin'',''width=220,height=310,resizable=no'')"',
ctext => htf.img(curl => '/images/lov.gif',
calign => 'TOP',
calt => 'List Values',
cattributes => 'WIDTH=18 HEIGHT=22 BORDER=0'));
--
g_index_number := g_index_number + 1;
--
ELSIF p_item_type = 'ID' THEN
--
htp.formhidden(cname => 'p_item_value_array', cvalue => p_item_value);
--
g_index_number := g_index_number + 1;
--
ELSIF p_item_type = 'FONTNAME' THEN
--
htp.formselectopen(cname => 'p_item_value_array',
cprompt => htf.bold(p_item_prompt || ': '));
--
htp.formselectoption(cvalue => NULL,
cselected => NULL,
cattributes => 'VALUE="' || NULL || '"');
--
htp.formselectoption(cvalue => 'Arial',
cselected => is_selected(p_item_value, 'arial'),
cattributes => 'VALUE="' || 'arial' || '"');
--
htp.formselectoption(cvalue => 'Comic Sans MS',
cselected => is_selected(p_item_value,
'comic sans ms'),
cattributes => 'VALUE="' || 'comic sans ms' || '"');
--
htp.formselectoption(cvalue => 'Courier',
cselected => is_selected(p_item_value,
'courier'),
cattributes => 'VALUE="' || 'courier' || '"');
--
htp.formselectoption(cvalue => 'MS Sans Serif',
cselected => is_selected(p_item_value,
'ms sans serif'),
cattributes => 'VALUE="' || 'ms sans serif' || '"');
--
htp.formselectoption(cvalue => 'Times New Roman',
cselected => is_selected(p_item_value,
'times new roman'),
cattributes => 'VALUE="' || 'times new roman' || '"');
--
htp.formselectclose;
--
g_index_number := g_index_number + 1;
--
ELSIF p_item_type = 'FONTSIZE' THEN
--
htp.formselectopen(cname => 'p_item_value_array',
cprompt => htf.bold(p_item_prompt || ': '));
--
htp.formselectoption(cvalue => NULL,
cattributes => 'VALUE="' || NULL || '"');
--
FOR loop_idx IN 1 .. 10 LOOP
--
htp.formselectoption(cvalue => TO_CHAR((loop_idx * 2) + 4) || 'pt',
cselected => is_selected(p_item_value,
TO_CHAR((loop_idx * 2) + 4) || 'pt'),
cattributes => 'VALUE="' ||
TO_CHAR((loop_idx * 2) + 4) ||
'pt"');
--
END LOOP;
--
htp.formselectclose;
--
g_index_number := g_index_number + 1;
--
ELSIF p_item_type = 'FONTSTYLE' THEN
--
htp.formselectopen(cname => 'p_item_value_array',
cprompt => htf.bold(p_item_prompt || ': '));
--
htp.formselectoption(cvalue => NULL,
cattributes => 'VALUE="' || NULL || '"');
--
htp.formselectoption(cvalue => 'Bold',
cselected => is_selected(p_item_value, 'bold'),
cattributes => 'VALUE="' || 'bold' || '"');
--
htp.formselectoption(cvalue => 'Italic',
cselected => is_selected(p_item_value, 'italic'),
cattributes => 'VALUE="' || 'italic' || '"');
--
htp.formselectoption(cvalue => 'Bold Italic',
cselected => is_selected(p_item_value,
'bolditalic'),
cattributes => 'VALUE="' || 'bolditalic' || '"');
--
htp.formselectclose;
--
g_index_number := g_index_number + 1;
--
ELSIF p_item_type = 'SSOWNER' THEN
--
htp.formselectopen(cname => 'p_item_value_array',
cprompt => htf.bold(p_item_prompt || ': '));
--
htp.formselectoption(cvalue => 'Current User',
cattributes => 'VALUE="CURRUSER"');
--
htp.formselectoption(cvalue => 'System',
cattributes => 'VALUE="SYSTEM"');
--
htp.formselectclose;
htp.br;
htp.br;
--
g_index_number := g_index_number + 1;
--
END IF;
--
END display_item;
--
-- Public Procedures
--
PROCEDURE colour_chart(p_index IN NUMBER) IS
--
--
BEGIN
--
htp.htmlopen;
--
htp.meta('Content-Type', 'SACO_STYLESHEET', 'text/html');
htp.linkrel('stylesheet', 'caco_system.css?p_type=content');
--
htp.title('Choose Colour');
--
htp.p('<SCRIPT TYPE=''text/javascript''>');
htp.p('function setcolour(cvalue) {');
htp.p('document.colourchart.colour.value=cvalue');
htp.p('document.colourchart.discolour.style.backgroundColor=cvalue');
htp.p('}');
htp.p('</SCRIPT>');
--
htp.p('<FORM NAME=colourchart>');
--
htp.bodyopen;
--
htp.tableopen(cborder => 3,
cattributes => 'cellpadding="3" cellspacing="0" width=200 height=200');
--
FOR g IN REVERSE 0 .. 5 LOOP
--
FOR b IN REVERSE 0 .. 5 LOOP
--
htp.tablerowopen;
--
FOR r IN REVERSE 0 .. 5 LOOP
--
htp.tabledata(cvalue => ' ',
calign => 'center',
cattributes => 'bgcolor="#' || dec_to_hex(r * 51) ||
dec_to_hex(g * 51) ||
dec_to_hex(b * 51) || '"' ||
' onclick="setcolour(''#' ||
dec_to_hex(r * 51) ||
dec_to_hex(g * 51) ||
dec_to_hex(b * 51) || ''')"');
--
END LOOP;
--
htp.tablerowclose;
--
END LOOP;
--
END LOOP;
--
htp.tableclose;
--
htp.br;
--
htp.p(htf.bold('Colour: '));
htp.formtext('colour', 8, 8, '#FFFFFF');
htp.formtext('discolour', 8, 8);
--
htp.br;
htp.br;
htp.p('<INPUT TYPE="button" VALUE="OK" onClick="window.opener.document.ss.elements[' ||
p_index ||
'].value=document.colourchart.colour.value;self.close()">');
htp.p('<INPUT TYPE="button" VALUE="Cancel" onClick="self.close()">');
htp.br;
--
htp.bodyclose;
--
htp.formclose;
--
htp.htmlclose;
--
END colour_chart;
--
PROCEDURE showabout IS
--
l_usr varchar2(255) := null;
--
BEGIN
--
IF NOT caco_security.security_check('saco_stylesheet$') THEN
--
RETURN;
--
END IF;
--
l_usr := caco_security.get_user;
--
WSGL.RegisterURL('caco_security$.showabout');
--
IF WSGL.NotLowerCase THEN
--
RETURN;
--
END IF;
--
WSGL.OpenPageHead(WSGL.MsgGetText(107, WSGLM.DSP107_ABOUT) || ' ');
--
htp.linkrel('stylesheet', 'caco_system.css?p_type=about');
--
WSGL.ClosePageHead;
--
WSGL.OpenPageBody(FALSE, p_attributes => '');
--
htp.p(caco_system.menu);
--
WSGL.DefaultPageCaption(WSGL.MsgGetText(107, WSGLM.DSP107_ABOUT) || ' ');
--
htp.para;
--
htp.p(WSGL.MsgGetText(108,
WSGLM.DSP108_GENERATED_BY,
'PL/SQL Web Generator',
'6.5.88.4.0'));
htp.para;
--
WSGL.Info(FALSE, 'N/A', 'SACO_STYLESHEET$', l_usr);
--
htp.p(caco_system.statusbar);
--
WSGL.ClosePageBody;
--
EXCEPTION
WHEN OTHERS THEN
WSGL.DisplayMessage(WSGL.MESS_EXCEPTION,
SQLERRM,
'',
'',
'saco_stylesheet$.showabout');
END;
--
PROCEDURE startup IS
BEGIN
--
IF NOT caco_security.security_check('saco_stylesheet$') THEN
--
RETURN;
--
END IF;
--
display_header(caco_utilities.get_system_name || ' ' ||
'Define Stylesheet');
--
query_css;
--
display_footer;
--
END startup;
--
PROCEDURE action(p_button IN VARCHAR2 DEFAULT NULL) IS
BEGIN
--
IF NOT caco_security.security_check('saco_stylesheet$') THEN
--
RETURN;
--
END IF;
--
IF p_button IS NOT NULL THEN
--
IF p_button = 'Requery' THEN
--
-- Requery by calling the main page
--
startup;
--
ELSIF p_button = 'New' THEN
--
-- Call the process procedure
--
process(g_null_array,
g_null_array,
g_null_array,
g_null_array,
NULL);
--
END IF;
--
END IF;
--
END action;
--
PROCEDURE querybykey(p_stst_id IN stylesheets.stst_id%TYPE DEFAULT NULL) IS
--
CURSOR cur_stst(p_stst_id IN stylesheets.stst_id%TYPE) IS
SELECT stst.stst_id, stst.stst_type
FROM stylesheets stst
WHERE stst.stst_id = p_stst_id;
--
CURSOR cur_stel(p_stst_id IN stylesheets.stst_id%TYPE) IS
SELECT stel.item_type,
stel.item_name,
stel.item_prompt,
stel.item_value
FROM stylesheet_elements stel
WHERE stel.stst_id = p_stst_id
ORDER BY stel.stel_id;
--
r_stst cur_stst%ROWTYPE;
--
BEGIN
--
IF NOT caco_security.security_check('saco_stylesheet$') THEN
--
RETURN;
--
END IF;
--
display_header(caco_utilities.get_system_name || ' ' ||
'Update Stylesheet',
'onload="initialise();"');
--
IF p_stst_id IS NOT NULL THEN
--
OPEN cur_stst(p_stst_id);
FETCH cur_stst
INTO r_stst;
CLOSE cur_stst;
--
expand_javascript;
--
htp.formopen(curl => 'saco_stylesheet$.process',
cmethod => 'POST',
cattributes => 'NAME=ss');
--
g_index_number := 1;
--
display_item('SSTYPE', 'SSTYPE', 'Stylesheet Type', r_stst.stst_type);
--
display_item('ID', 'ID', NULL, r_stst.stst_id);
--
FOR cur_stel_rec IN cur_stel(p_stst_id) LOOP
--
display_item(cur_stel_rec.item_type,
cur_stel_rec.item_name,
cur_stel_rec.item_prompt,
cur_stel_rec.item_value);
--
END LOOP;
--
-- Close off the last unexpanded item so the buttons can be displayed without expanding the item
--
htp.p('</DIV>');
--
htp.br;
htp.br;
--
-- Display the standard buttons
--
htp.formsubmit(cname => 'p_button', cvalue => 'Cancel');
--
htp.formsubmit(cname => 'p_button', cvalue => 'Delete');
--
htp.formsubmit(cname => 'p_button', cvalue => 'Update');
--
htp.formclose;
--
htp.anchor2(curl => 'saco_stylesheet$.startup', ctext => 'Return');
--
display_footer;
--
END IF;
--
display_footer;
--
END querybykey;
--
PROCEDURE process(p_item_type_array IN owa_util.vc_arr,
p_item_name_array IN owa_util.vc_arr,
p_item_prompt_array IN owa_util.vc_arr,
p_item_value_array IN owa_util.vc_arr,
p_button IN VARCHAR2) IS
--
-- Private Variables
--
v_stst_id stylesheets.stst_id%TYPE;
v_syus_name VARCHAR2(30);
--
-- Private Cursors
--
CURSOR cur_stel_setup IS
SELECT stel.item_type,
stel.item_name,
stel.item_prompt,
stel.item_value
FROM stylesheet_elements stel
WHERE stel.stst_id = 0;
--
BEGIN
--
IF NOT caco_security.security_check('saco_stylesheet$') THEN
--
RETURN;
--
END IF;
--
IF p_button IS NULL THEN
--
display_header(caco_utilities.get_system_name || ' ' ||
'New Stylesheet',
'onload="initialise();"');
--
expand_javascript;
--
htp.formopen(curl => 'saco_stylesheet$.process',
cmethod => 'POST',
cattributes => 'NAME=ss');
--
g_index_number := 1;
--
IF check_system_user THEN
--
display_item('SSOWNER', 'SSOWNER', 'Stylesheet Owner', NULL);
--
END IF;
--
display_item('SSTYPE', 'SSTYPE', 'Stylesheet Type', NULL);
--
FOR cur_stel_setup_rec IN cur_stel_setup LOOP
--
display_item(cur_stel_setup_rec.item_type,
cur_stel_setup_rec.item_name,
cur_stel_setup_rec.item_prompt,
cur_stel_setup_rec.item_value);
--
END LOOP;
--
-- Close off the last unexpanded item so the buttons can be displayed without expanding the item
--
htp.p('</DIV>');
--
htp.br;
htp.br;
--
-- Display the standard buttons
--
htp.formsubmit(cname => 'p_button', cvalue => 'Cancel');
--
htp.formsubmit(cname => 'p_button', cvalue => 'Save');
--
htp.formclose;
--
htp.anchor2(curl => 'saco_stylesheet$.startup', ctext => 'Return');
--
display_footer;
--
ELSIF p_button = 'Cancel' THEN
--
-- If cancel then redraw the screen without parameters
--
process(g_null_array, g_null_array, g_null_array, g_null_array, NULL);
--
ELSIF p_button = 'Save' THEN
--
-- Insert Stylesheet record returning key into var
-- then query by key
--
IF p_item_name_array IS NOT NULL THEN
--
v_stst_id := NULL;
v_syus_name := caco_utilities.get_syus_name;
--
FOR v_index IN 1 .. p_item_name_array.COUNT LOOP
--
IF p_item_name_array(v_index) = 'SSOWNER' THEN
--
IF p_item_value_array(v_index) = 'SYSTEM' THEN
--
v_syus_name := NULL;
--
END IF;
--
ELSIF p_item_name_array(v_index) = 'SSTYPE' THEN
--
INSERT INTO stylesheets
(stst_type, username)
VALUES
(p_item_value_array(v_index), v_syus_name)
RETURNING stst_id INTO v_stst_id;
--
ELSE
--
INSERT INTO stylesheet_elements
(stst_id, item_type, item_name, item_prompt, item_value)
VALUES
(v_stst_id,
p_item_type_array(v_index),
p_item_name_array(v_index),
p_item_prompt_array(v_index),
p_item_value_array(v_index));
--
END IF;
--
END LOOP;
--
querybykey(v_stst_id);
--
END IF;
--
ELSIF p_button = 'Update' THEN
--
IF NOT caco_security.security_check('saco_stylesheet$') THEN
--
RETURN;
--
END IF;
--
display_header(caco_utilities.get_system_name || ' ' ||
'Update Stylesheet');
--
IF p_item_name_array IS NOT NULL THEN
--
v_stst_id := NULL;
--
FOR v_index IN 1 .. p_item_name_array.COUNT LOOP
--
IF p_item_type_array(v_index) = 'SSTYPE' THEN
--
NULL;
--
ELSIF p_item_type_array(v_index) = 'ID' THEN
--
v_stst_id := p_item_value_array(v_index);
--
DELETE stylesheet_elements stel WHERE stel.stst_id = v_stst_id;
--
ELSE
--
INSERT INTO stylesheet_elements
(stst_id, item_type, item_name, item_prompt, item_value)
VALUES
(v_stst_id,
p_item_type_array(v_index),
p_item_name_array(v_index),
p_item_prompt_array(v_index),
p_item_value_array(v_index));
--
END IF;
--
END LOOP;
--
htp.p('The selected stylesheet has been updated.');
htp.br;
htp.br;
htp.anchor2(curl => 'saco_stylesheet$.startup', ctext => 'Return');
--
display_footer;
--
END IF;
--
ELSIF p_button = 'Delete' THEN
--
IF NOT caco_security.security_check('saco_stylesheet$') THEN
--
RETURN;
--
END IF;
--
display_header(caco_utilities.get_system_name || ' ' ||
'Delete Stylesheet');
--
IF p_item_name_array IS NOT NULL THEN
--
v_stst_id := NULL;
--
FOR v_index IN 1 .. p_item_name_array.COUNT LOOP
--
IF p_item_name_array(v_index) = 'ID' THEN
--
v_stst_id := p_item_value_array(v_index);
--
DELETE FROM stylesheet_elements stel
WHERE stel.stst_id = v_stst_id;
--
DELETE FROM stylesheets stst WHERE stst.stst_id = v_stst_id;
--
END IF;
--
END LOOP;
--
END IF;
--
htp.p('The selected stylesheet has been deleted.');
htp.br;
htp.br;
htp.anchor2(curl => 'saco_stylesheet$.startup', ctext => 'Return');
--
display_footer;
--
END IF;
--
END process;
--
FUNCTION convert_tags_to_css(p_stst_id IN stylesheets.stst_id%TYPE DEFAULT NULL)
RETURN VARCHAR2 IS
--
CURSOR cur_stel(p_stst_id IN stylesheets.stst_id%TYPE) IS
SELECT stel.item_type,
stel.item_name,
stel.item_prompt,
stel.item_value
FROM stylesheet_elements stel
WHERE stel.stst_id = p_stst_id
ORDER BY stel.stel_id;
--
v_first BOOLEAN;
v_items BOOLEAN;
v_return VARCHAR2(4000);
v_temp VARCHAR2(4000);
--
BEGIN
--
IF p_stst_id IS NOT NULL THEN
--
-- Define the character set which is identical for each stylesheet
--
v_return := v_return || '@charset "iso-8859-1";' || CHR(10);
--
-- Initialise Variables
--
v_first := TRUE;
v_items := FALSE;
--
FOR cur_stel_rec IN cur_stel(p_stst_id) LOOP
--
IF v_first AND cur_stel_rec.item_type <> 'TAG' THEN
--
-- Skip any records before the first tag
--
NULL;
--
ELSE
--
IF cur_stel_rec.item_type = 'TAG' THEN
--
IF v_first THEN
--
v_first := FALSE;
--
ELSE
--
v_temp := v_temp || '}' || CHR(10);
--
IF v_items THEN
--
v_return := v_return || v_temp;
--
v_items := FALSE;
--
END IF;
--
v_temp := NULL;
--
END IF;
--
v_temp := v_temp || NVL(cur_stel_rec.item_value, cur_stel_rec.item_name) || '{';
--
END IF;
--
IF cur_stel_rec.item_value IS NOT NULL THEN
--
v_items := TRUE;
--
IF cur_stel_rec.item_type = 'FONTSTYLE' THEN
--
IF cur_stel_rec.item_value = 'bold' THEN
--
v_temp := v_temp || 'font-weight: bold; ';
--
ELSIF cur_stel_rec.item_value = 'italic' THEN
--
v_temp := v_temp || 'font-style: italic; ';
--
ELSIF cur_stel_rec.item_value = 'bolditalic' THEN
--
v_temp := v_temp ||
'font-weight: bold; font-style: italic; ';
--
END IF;
--
ELSE
--
v_temp := v_temp || cur_stel_rec.item_name || ': ' ||
cur_stel_rec.item_value || '; ';
--
END IF;
--
END IF;
--
END IF;
--
END LOOP;
--
v_temp := v_temp || '}' || CHR(10);
--
IF v_items THEN
--
v_return := v_return || v_temp;
--
END IF;
--
END IF;
--
RETURN v_return;
--
END convert_tags_to_css;
--
BEGIN
--
NULL;
--
END saco_stylesheet$;
/