git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@50874 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
543
Data/BulkLoad/EFT/Nominations/plsql/efnow097$.bdy
Normal file
543
Data/BulkLoad/EFT/Nominations/plsql/efnow097$.bdy
Normal file
@@ -0,0 +1,543 @@
|
||||
CREATE OR REPLACE PACKAGE BODY efnow097$ IS
|
||||
|
||||
|
||||
PROCEDURE msg_subs_js IS
|
||||
BEGIN
|
||||
htp.p('
|
||||
function setChanged() {
|
||||
document.getElementById(''p_changes'').value = ''changed'';
|
||||
}
|
||||
|
||||
function submitMsgForm() {
|
||||
var checkChanges = document.getElementById(''p_changes'');
|
||||
|
||||
if ( checkChanges.value == ''changed'' ) {
|
||||
//clear all unwanted named input from the form
|
||||
var allInputs = document.forms[0];
|
||||
//alert(allInputs.length);
|
||||
for (i=0;i<allInputs.length;i++) {
|
||||
if ( allInputs[i].name != ''p_suca_count''
|
||||
&& allInputs[i].name != ''p_suca_id''
|
||||
&& allInputs[i].name != ''p_suca_checked''
|
||||
&& allInputs[i].name != ''p_uscd''
|
||||
&& allInputs[i].name != ''p_type''
|
||||
&& allInputs[i].name )
|
||||
{
|
||||
// delete the item (we want a specific list submitted)
|
||||
allInputs[i].parentNode.removeChild(allInputs[i]);
|
||||
}
|
||||
}
|
||||
var theForm = document.getElementById(''msgSubsForm'');
|
||||
theForm.submit();
|
||||
}
|
||||
else {
|
||||
alert('''||caco_utilities.get_module_text(2280)||''');'); -- No changes to Submit
|
||||
htp.p(' }
|
||||
}
|
||||
|
||||
function setSuca( obj ) {
|
||||
var prevInput = obj.previousSibling;
|
||||
|
||||
if (obj.checked) {
|
||||
prevInput.value = "Y";
|
||||
}
|
||||
else {
|
||||
prevInput.value = "N";
|
||||
}
|
||||
|
||||
setChanged();
|
||||
}
|
||||
|
||||
function setSMS( obj ) {
|
||||
var sucaItem = obj.nextSibling;
|
||||
var emailChecked = ''N'';
|
||||
|
||||
if (obj.checked) {
|
||||
emailChecked = ''Y'';
|
||||
}
|
||||
|
||||
var allSucaItems = document.getElementsByName( sucaItem.name );
|
||||
|
||||
var smsIndex = -1; // to hold the index of the smsSucaItem we are interested in
|
||||
|
||||
for (i=0;i<allSucaItems.length;i++) {
|
||||
if (allSucaItems[i] == sucaItem) {
|
||||
smsIndex = i+1;
|
||||
}
|
||||
}
|
||||
|
||||
if (smsIndex > 0) {
|
||||
allSucaItems[smsIndex].previousSibling.previousSibling.value = ''N'';
|
||||
allSucaItems[smsIndex].previousSibling.checked = false;
|
||||
|
||||
if (emailChecked == ''Y'') {
|
||||
allSucaItems[smsIndex].previousSibling.disabled = false;
|
||||
}
|
||||
else {
|
||||
allSucaItems[smsIndex].previousSibling.disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
');
|
||||
END msg_subs_js;
|
||||
|
||||
PROCEDURE msg_subs_css IS
|
||||
BEGIN
|
||||
htp.p('
|
||||
.msgSubsTable {
|
||||
border-left-width : 1px;
|
||||
border-left-style : solid;
|
||||
border-left-color : black;
|
||||
border-right-width : 1px;
|
||||
border-right-style : solid;
|
||||
border-right-color : black;
|
||||
border-bottom-width : 1px;
|
||||
border-bottom-style : solid;
|
||||
border-bottom-color : black;
|
||||
}
|
||||
|
||||
.msgSubsAllTypes {
|
||||
background-color : #D9D9D9;
|
||||
text-align : center;
|
||||
border-left-width : 1px;
|
||||
border-left-style : solid;
|
||||
border-left-color : #F21C0A;
|
||||
border-right-width : 1px;
|
||||
border-right-style : solid;
|
||||
border-right-color : #F21C0A;
|
||||
border-top-width : 1px;
|
||||
border-top-style : solid;
|
||||
border-top-color : #F21C0A;
|
||||
border-bottom-width : 1px;
|
||||
border-bottom-style : solid;
|
||||
border-bottom-color : #F21C0A;
|
||||
font-weight : normal;
|
||||
height : 16px;
|
||||
}
|
||||
|
||||
.msgSeparateTH {
|
||||
background-color : #D9D9D9;
|
||||
border-left : none;
|
||||
border-right-width : 1px;
|
||||
border-right-style : solid;
|
||||
border-right-color : #F21C0A;
|
||||
border-top-width : 1px;
|
||||
border-top-style : solid;
|
||||
border-top-color : #F21C0A;
|
||||
border-bottom-width : 1px;
|
||||
border-bottom-style : solid;
|
||||
border-bottom-color : #F21C0A;
|
||||
}
|
||||
|
||||
.msgSubsEmailTH {
|
||||
background-color : #D9D9D9;
|
||||
text-align : center;
|
||||
width : 250px;
|
||||
font-weight : normal;
|
||||
border-left-width : 1px;
|
||||
border-left-style : solid;
|
||||
border-left-color : #F21C0A;
|
||||
border-right : none;
|
||||
border-top-width : 1px;
|
||||
border-top-style : solid;
|
||||
border-top-color : #F21C0A;
|
||||
border-bottom-width : 1px;
|
||||
border-bottom-style : solid;
|
||||
border-bottom-color : #F21C0A;
|
||||
height : 16px;
|
||||
}
|
||||
|
||||
.msgSubsUserTH {
|
||||
background-color : #D9D9D9;
|
||||
text-align : center;
|
||||
width : 100px;
|
||||
font-weight : normal;
|
||||
border-left-width : 1px;
|
||||
border-left-style : solid;
|
||||
border-left-color : #F21C0A;
|
||||
border-right : none;
|
||||
border-top-width : 1px;
|
||||
border-top-style : solid;
|
||||
border-top-color : #F21C0A;
|
||||
border-bottom-width : 1px;
|
||||
border-bottom-style : solid;
|
||||
border-bottom-color : #F21C0A;
|
||||
height : 16px;
|
||||
}
|
||||
|
||||
.msgSubsTypeTH {
|
||||
background-color : #D9D9D9;
|
||||
text-align : center;
|
||||
width : 100px;
|
||||
font-weight : normal;
|
||||
border-left-width : 1px;
|
||||
border-left-style : solid;
|
||||
border-left-color : #F21C0A;
|
||||
border-right-width : 1px;
|
||||
border-right-style : solid;
|
||||
border-right-color : #F21C0A;
|
||||
border-top-width : 1px;
|
||||
border-top-style : solid;
|
||||
border-top-color : #F21C0A;
|
||||
border-bottom-width : 1px;
|
||||
border-bottom-style : solid;
|
||||
border-bottom-color : #F21C0A;
|
||||
height : 16px;
|
||||
}
|
||||
|
||||
.msgSubsTR1 {
|
||||
background-color : #FFFFFF;
|
||||
text-align : left;
|
||||
border-style : none;
|
||||
}
|
||||
|
||||
.msgSubsTR2 {
|
||||
background-color : #F5F5F5;
|
||||
text-align : left;
|
||||
border-style : none;
|
||||
}
|
||||
|
||||
.msgSeparate {
|
||||
border-right : 1px solid black;
|
||||
}
|
||||
|
||||
.msgSubsCheckBox {
|
||||
text-align : center;
|
||||
}
|
||||
');
|
||||
END msg_subs_css;
|
||||
|
||||
|
||||
|
||||
PROCEDURE display_message( p_success IN VARCHAR2
|
||||
, p_error IN VARCHAR2
|
||||
, p_err_msg IN VARCHAR2 )
|
||||
IS
|
||||
BEGIN
|
||||
--
|
||||
IF p_success = 'Y' THEN
|
||||
htp.p('<b><font size="+2" color="#008000"><i>'||caco_utilities.get_module_text(876)||'</i></font><br /></b><p></p>'); -- Success!
|
||||
ELSIF p_error = 'Y' THEN
|
||||
htp.p('<b><font size="+2" color="#840201"><i>'||caco_utilities.get_module_text(2340)||'</i></font><br /></b>'); -- Update failed
|
||||
htp.p('<b>'||p_err_msg||'<br /></b><p></p>');
|
||||
END IF;
|
||||
--
|
||||
END display_message;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
PROCEDURE startup( p_success IN VARCHAR2 DEFAULT NULL
|
||||
, p_error IN VARCHAR2 DEFAULT NULL
|
||||
, p_err_msg IN VARCHAR2 DEFAULT NULL )
|
||||
IS
|
||||
--
|
||||
TYPE suca_sms_tab IS TABLE OF VARCHAR2(1) INDEX BY BINARY_INTEGER;
|
||||
--
|
||||
CURSOR c_users IS
|
||||
SELECT uscd.uscd_id
|
||||
, syus.syus_id
|
||||
, syus.db_username
|
||||
, uscd.email_address
|
||||
, uscd.default_address
|
||||
, uscd.sms_number
|
||||
FROM user_contact_details uscd
|
||||
, system_users syus
|
||||
WHERE syus.syus_id = uscd.syus_id
|
||||
AND syus.cust_id = caco_utilities.get_cust_id;
|
||||
--
|
||||
CURSOR c_suca IS
|
||||
SELECT suca_id
|
||||
, msg_group_en
|
||||
, msg_group_hu
|
||||
, name_en
|
||||
, name_hu
|
||||
FROM subscription_categories
|
||||
ORDER BY NVL(msg_group_en,'AAAA') ASC
|
||||
, display_sequence ASC;
|
||||
--
|
||||
l_prev_suca_rec c_suca%ROWTYPE;
|
||||
l_suca_rec c_suca%ROWTYPE;
|
||||
--
|
||||
l_suca_sms_tab suca_sms_tab;
|
||||
--
|
||||
l_user_count NUMBER := 0;
|
||||
l_count_suca NUMBER := 0;
|
||||
l_value_and_checkbox VARCHAR2(255);
|
||||
already_subscribed BOOLEAN := FALSE;
|
||||
l_language system_users.LANGUAGE%TYPE := 'EN';
|
||||
--
|
||||
l_msg_group_cats NUMBER := 1;
|
||||
--
|
||||
BEGIN
|
||||
--
|
||||
IF NOT caco_security.security_check('efnow097$') THEN
|
||||
RETURN;
|
||||
END IF;
|
||||
--
|
||||
-- Get the current language
|
||||
l_language := caco_utilities.get_syus_lang;
|
||||
--
|
||||
-- htp.p('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
|
||||
-- htp.p('<html xmlns="http://www.w3.org/1999/xhtml" lang="en-gb">');
|
||||
wsgl.openpagehead(g_title);
|
||||
--wsgl.metatag;
|
||||
--htp.p('<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
|
||||
caco_system.content_type;
|
||||
htp.p('<meta http-equiv="Pragma" content="no-cache">');
|
||||
-- htp.p('<meta http-equiv="Expires" content="Mon, 01 Jan 1990 12:00:00 GMT">');
|
||||
htp.p('<meta http-equiv="Cache-control" content="no-cache">');
|
||||
htp.p('<meta http-equiv="Cache-control" content="must-revalidate">');
|
||||
htp.p('<meta http-equiv="Cache-control" content="max-age=0">');
|
||||
htp.p( '<LINK REL=stylesheet HREF="caco_system.css?p_type=content" >');
|
||||
htp.p(' <link rel="stylesheet" media="all" type="text/css" href="'||g_package_name||'.msg_subs_css" />');
|
||||
htp.p(' <script type="text/javascript" src="'||g_package_name||'.msg_subs_js"></script>');
|
||||
--
|
||||
wsgl.closepagehead;
|
||||
wsgl.openpagebody(FALSE);
|
||||
htp.p(caco_system.menu);
|
||||
--
|
||||
htp.p('
|
||||
<div style="margin:15px;">
|
||||
<input id="p_changes" type="hidden" value="none" />
|
||||
<h1>'||caco_utilities.get_module_text(2067)||'</h1>'); -- Message Subscriptions
|
||||
--
|
||||
-- Put out success or error messages from completed or failed update
|
||||
display_message( p_success => p_success
|
||||
, p_error => p_error
|
||||
, p_err_msg => p_err_msg );
|
||||
--
|
||||
htp.p('
|
||||
<form id="msgSubsForm" name="msgSubsForm" action="efno_msgsubs.update_msg_subs" method="post">');
|
||||
--
|
||||
--
|
||||
-- How many Subscription categories are there?
|
||||
l_count_suca := efno_msgsubs.count_suca;
|
||||
htp.p('<input name="p_suca_count" type="hidden" value="'||l_count_suca||'" />');
|
||||
--
|
||||
-- Create the Message Subscriptions table header rows
|
||||
htp.p('
|
||||
<table class="msgSubsTable">
|
||||
<tr>');
|
||||
--
|
||||
/* CGR 29-MAY-2007 Added new table header for username */
|
||||
--
|
||||
htp.p(' <th class="msgSubsUserTH" rowspan="3">'||caco_utilities.get_module_text(345)||'</th> ');
|
||||
htp.p(' <th class="msgSubsEmailTH" rowspan="3">'||caco_utilities.get_module_text(1054)||'</th>'); -- Email Address
|
||||
htp.p(' <th class="msgSeparateTH" rowspan="3"> </th>
|
||||
<th class="msgSubsAllTypes" colspan="'||l_count_suca||'">'||caco_utilities.get_module_text(2070)||'</th>'); -- Message Types
|
||||
htp.p(' </tr>');
|
||||
--
|
||||
-- Dynamically create the Message Subscriptions tables header row(s)
|
||||
-- First put out ungrouped message types and group names
|
||||
htp.p('<tr>');
|
||||
OPEN c_suca;
|
||||
FETCH c_suca INTO l_prev_suca_rec;
|
||||
WHILE c_suca%FOUND LOOP
|
||||
l_suca_rec := NULL;
|
||||
FETCH c_suca INTO l_suca_rec;
|
||||
--
|
||||
IF NVL(l_suca_rec.msg_group_en,'*$%()L*') != NVL(l_prev_suca_rec.msg_group_en,'##~&"L%"') THEN
|
||||
--
|
||||
-- If we have a standalone category (not grouped), then rowspan the header
|
||||
-- otherwise put out the group name colspanning the number of categories in the group
|
||||
IF l_prev_suca_rec.msg_group_en IS NULL THEN
|
||||
htp.p('<th class="msgSubsTypeTH" colspan="'||l_msg_group_cats||'" rowspan="2" style="text-align:center;" >');
|
||||
IF l_language = 'HU' THEN
|
||||
htp.p(l_prev_suca_rec.name_hu||'</th>');
|
||||
ELSE
|
||||
htp.p(l_prev_suca_rec.name_en||'</th>');
|
||||
END IF;
|
||||
ELSE
|
||||
htp.p('<th class="msgSubsAllTypes" colspan="'||l_msg_group_cats||'" style="text-align:center;" >');
|
||||
IF l_language = 'HU' THEN
|
||||
htp.p(l_prev_suca_rec.msg_group_hu||'</th>');
|
||||
ELSE
|
||||
htp.p(l_prev_suca_rec.msg_group_en||'</th>');
|
||||
END IF;
|
||||
END IF;
|
||||
--
|
||||
l_msg_group_cats := 1;
|
||||
--
|
||||
ELSE
|
||||
l_msg_group_cats := l_msg_group_cats + 1;
|
||||
END IF;
|
||||
--
|
||||
l_prev_suca_rec := l_suca_rec;
|
||||
--
|
||||
END LOOP;
|
||||
CLOSE c_suca;
|
||||
htp.p('</tr>');
|
||||
--
|
||||
-- Finally put out TH names of the subscription categories that are in groups.
|
||||
htp.p('<tr>');
|
||||
FOR r IN c_suca LOOP
|
||||
--
|
||||
IF r.msg_group_en IS NOT NULL THEN
|
||||
--
|
||||
IF l_language = 'HU' THEN
|
||||
htp.p('<th class="msgSubsTypeTH">'||r.name_hu||'</th>');
|
||||
ELSE
|
||||
htp.p('<th class="msgSubsTypeTH">'||r.name_en||'</th>');
|
||||
END IF;
|
||||
--
|
||||
END IF;
|
||||
--
|
||||
END LOOP;
|
||||
htp.p('</tr>');
|
||||
--
|
||||
--
|
||||
-- Now loop through all the User Email address/Telephone Number combinations
|
||||
-- and put out a row for each type
|
||||
-- Check if value is already set or not
|
||||
FOR user_rec IN c_users LOOP
|
||||
--
|
||||
l_suca_sms_tab.DELETE;
|
||||
l_user_count := l_user_count + 1;
|
||||
--
|
||||
-- First row for the email
|
||||
IF MOD(l_user_count,2) = 0 THEN
|
||||
htp.p('<tr class="msgSubsTR2">');
|
||||
ELSE
|
||||
htp.p('<tr class="msgSubsTR1">');
|
||||
END IF;
|
||||
--
|
||||
-- Output details and hidden parameters
|
||||
htp.p('<input name="p_uscd" type="hidden" value="'||user_rec.uscd_id||'" />');
|
||||
htp.p('<input name="p_type" type="hidden" value="EMAIL" />');
|
||||
--
|
||||
/* CGR 29-MAY-2007 Added the db_username as can be many emails for a customer/user combination */
|
||||
--
|
||||
htp.p('<td>'||user_rec.db_username||'</td>');
|
||||
htp.p('<td>'||user_rec.email_address||'</td>');
|
||||
htp.p('<td class="msgSeparate">'||caco_utilities.get_module_text(2068)||'</td>'); -- Email
|
||||
--
|
||||
FOR r2 IN c_suca LOOP
|
||||
--
|
||||
already_subscribed := FALSE;
|
||||
--
|
||||
htp.p('<td class="msgSubsCheckBox">');
|
||||
htp.p('<input type="hidden" name="p_suca_id" value="'||r2.suca_id||'" />');
|
||||
--
|
||||
already_subscribed := efno_msgsubs.check_msg_subscription( user_rec.uscd_id
|
||||
, r2.suca_id
|
||||
, 'EMAIL' );
|
||||
--
|
||||
l_value_and_checkbox := '<input type="hidden" name="p_suca_checked" value="';
|
||||
IF already_subscribed THEN
|
||||
l_suca_sms_tab(r2.suca_id) := 'Y';
|
||||
l_value_and_checkbox := l_value_and_checkbox||'Y" /><input type="checkbox" checked ';
|
||||
ELSE
|
||||
l_suca_sms_tab(r2.suca_id) := 'N';
|
||||
l_value_and_checkbox := l_value_and_checkbox||'N" /><input type="checkbox" unchecked ';
|
||||
END IF;
|
||||
--
|
||||
l_value_and_checkbox := l_value_and_checkbox
|
||||
||' onclick="setSuca(this);setSMS(this);" />'
|
||||
||'<input type="hidden" name="'||r2.suca_id||'" value="" />';
|
||||
--
|
||||
htp.p(l_value_and_checkbox);
|
||||
--
|
||||
htp.p('</td>');
|
||||
--
|
||||
END LOOP;
|
||||
--
|
||||
-- End the 1st row for the given user
|
||||
htp.p('</tr>');
|
||||
--
|
||||
-- Second row for the SMS
|
||||
IF MOD(l_user_count,2) = 0 THEN
|
||||
htp.p('<tr class="msgSubsTR2">');
|
||||
ELSE
|
||||
htp.p('<tr class="msgSubsTR1">');
|
||||
END IF;
|
||||
--
|
||||
htp.p('<input name="p_uscd" type="hidden" value="'||user_rec.uscd_id||'" />');
|
||||
htp.p('<input name="p_type" type="hidden" value="SMS" />');
|
||||
--
|
||||
/*CGR 29-MAY-2007 Added to pad out the cell below username */
|
||||
--
|
||||
htp.p('<td> </td>');
|
||||
htp.p('<td>'||user_rec.sms_number||'</td>');
|
||||
htp.p('<td class="msgSeparate">'||caco_utilities.get_module_text(2069)||'</td>'); -- SMS
|
||||
--
|
||||
FOR r2 IN c_suca LOOP
|
||||
--
|
||||
already_subscribed := FALSE;
|
||||
--
|
||||
htp.p('<td class="msgSubsCheckBox">');
|
||||
htp.p('<input type="hidden" name="p_suca_id" value="'||r2.suca_id||'" />');
|
||||
--
|
||||
already_subscribed := efno_msgsubs.check_msg_subscription( user_rec.uscd_id
|
||||
, r2.suca_id
|
||||
, 'SMS' );
|
||||
--
|
||||
l_value_and_checkbox := '<input type="hidden" name="p_suca_checked" value="';
|
||||
IF already_subscribed THEN
|
||||
l_value_and_checkbox := l_value_and_checkbox||'Y" /><input type="checkbox" checked ';
|
||||
ELSE
|
||||
l_value_and_checkbox := l_value_and_checkbox||'N" /><input type="checkbox" unchecked ';
|
||||
IF l_suca_sms_tab(r2.suca_id) = 'N' THEN
|
||||
l_value_and_checkbox := l_value_and_checkbox||' disabled ';
|
||||
END IF;
|
||||
END IF;
|
||||
--
|
||||
l_value_and_checkbox := l_value_and_checkbox
|
||||
||' onclick="setSuca(this);" />'
|
||||
||'<input type="hidden" name="'||r2.suca_id||'" value="" />';
|
||||
--
|
||||
htp.p(l_value_and_checkbox);
|
||||
--
|
||||
htp.p('</td>');
|
||||
--
|
||||
END LOOP;
|
||||
--
|
||||
-- End the 2nd row for the given user
|
||||
htp.p('</tr>');
|
||||
--
|
||||
END LOOP;
|
||||
--
|
||||
-- Close the table
|
||||
htp.p('</table>');
|
||||
--
|
||||
-- Submit button
|
||||
htp.p('
|
||||
<br /><input type="button" value="'||caco_utilities.get_module_text(2078) -- Submit Changes
|
||||
||'" onclick="submitMsgForm();" /><br />');
|
||||
--
|
||||
-- Close Form msgsubsform
|
||||
htp.p('</form>');
|
||||
-- Close margin div
|
||||
htp.p('</div>');
|
||||
--
|
||||
-- Close the menu div's and close the body
|
||||
caco_system.footer( TRUE );
|
||||
--
|
||||
-- Close the html tag
|
||||
htp.p('</html>');
|
||||
--
|
||||
END startup;
|
||||
|
||||
|
||||
/**
|
||||
-- FUNCTION about --
|
||||
-- Returns the version number and VSS header for this package
|
||||
--
|
||||
-- %return The version number and VSS header for this package
|
||||
*/
|
||||
FUNCTION about RETURN VARCHAR2 IS
|
||||
BEGIN
|
||||
RETURN ( g_package_name || CHR(10) ||g_revision||chr(10)|| g_header );
|
||||
END about;
|
||||
|
||||
|
||||
|
||||
BEGIN
|
||||
-- Initialization
|
||||
NULL;
|
||||
--
|
||||
END efnow097$;
|
||||
/
|
||||
Reference in New Issue
Block a user