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

1389 lines
49 KiB
Plaintext

CREATE OR REPLACE PACKAGE BODY efnow251$ IS
--
FUNCTION dad_path
RETURN VARCHAR2
IS
BEGIN
RETURN(lower(owa_util.get_cgi_env('REQUEST_PROTOCOL') || '://' ||
owa_util.get_cgi_env('HTTP_HOST') ||
owa_util.get_cgi_env('SCRIPT_NAME') || '/'));
END dad_path;
PROCEDURE find_passed_net_points( p_nepo_array IN owa_util.vc_arr
, p_network_point_array OUT network_point_array )
IS
CURSOR c_nepo( cp_id IN NUMBER ) IS
SELECT REPLACE(REPLACE(name,chr(13),''),chr(10),'') name
FROM network_points
WHERE nepo_id = cp_id;
--
l_count NUMBER := 0;
l_name network_points.name%TYPE;
--
BEGIN
--
IF NVL(p_nepo_array.COUNT,0) > 0 THEN
FOR i IN p_nepo_array.FIRST .. p_nepo_array.LAST LOOP
--
l_name := NULL;
l_count := l_count + 1;
--
-- Fetch the network point name
OPEN c_nepo( TO_NUMBER(p_nepo_array(i)) );
FETCH c_nepo INTO l_name;
IF c_nepo%FOUND THEN
-- valid network point
p_network_point_array(l_count).nepo_id := TO_NUMBER(p_nepo_array(i));
p_network_point_array(l_count).name := l_name;
ELSE
l_count := l_count - 1;
END IF;
CLOSE c_nepo;
--
END LOOP;
END IF;
--
END find_passed_net_points;
PROCEDURE get_nepg_details( p_nepg_id IN NUMBER
, p_nepg_record OUT network_point_groups%ROWTYPE
, p_network_point_array OUT network_point_array
)
IS
-- Cursor to get the full nepg row
CURSOR c_nepg IS
SELECT *
FROM network_point_groups
WHERE nepg_id = p_nepg_id;
--
-- Cursor to get all network points for this contract
CURSOR c_nepo IS
SELECT nepm.nepo_id net_point_id
, nepo.name nepo_name
FROM network_point_mappings nepm
, network_points nepo
WHERE nepm.nepo_id = nepo.nepo_id
AND nepm.nepg_id = p_nepg_id
ORDER BY nepo.name;
--
l_count NUMBER := 0;
--
BEGIN
--
OPEN c_nepg;
FETCH c_nepg INTO p_nepg_record;
CLOSE c_nepg;
--
FOR r IN c_nepo LOOP
l_count := l_count + 1;
--
p_network_point_array(l_count).nepo_id := r.net_point_id;
p_network_point_array(l_count).name := r.nepo_name;
--
END LOOP;
--
END get_nepg_details;
PROCEDURE get_avail_net_points( p_network_point_array IN OUT network_point_array
, p_avail_net_points OUT network_point_array )
IS
-- Cursor to select ALL network points
CURSOR c_nepo IS
SELECT nepo_id
, REPLACE(REPLACE(name,chr(13),''),chr(10),'') name
FROM network_points
WHERE nepo_type <> 'V'
ORDER BY name;
--
l_array_pos NUMBER := 0;
l_out_pos NUMBER := 0;
--
l_holder_record network_point_record;
--
BEGIN
--
-- Need to ensure that we are dealing with like on like
-- i.e. both the given array and the cursor must be sorted by name
-- So sort the array - this is belt and braces approach as the array SHOULD arrive sorted correctly
-- The Bubble Sort method.
-- (yes there are MUCH better ways to sort - this algorithm I remember off the top off my head though)
IF NVL(p_network_point_array.COUNT,0) > 0 THEN
FOR i IN 1..p_network_point_array.COUNT LOOP
--
FOR j IN 1..(p_network_point_array.COUNT-1) LOOP
--
IF p_network_point_array(j).name > p_network_point_array(j+1).name THEN
--
l_holder_record := p_network_point_array(j+1);
p_network_point_array(j+1) := p_network_point_array(j);
p_network_point_array(j) := l_holder_record;
--
END IF;
--
END LOOP;
--
END LOOP;
END IF;
--
-- Ok, so lets go
l_array_pos := 1;
OPEN c_nepo;
FETCH c_nepo INTO l_holder_record;
--
WHILE c_nepo%FOUND AND l_array_pos <= p_network_point_array.COUNT LOOP
--
IF p_network_point_array(l_array_pos).name > l_holder_record.name THEN
-- Output the current cursor detail to the OUT array
l_out_pos := l_out_pos + 1;
p_avail_net_points(l_out_pos).nepo_id := l_holder_record.nepo_id;
p_avail_net_points(l_out_pos).name := l_holder_record.name;
--
FETCH c_nepo INTO l_holder_record;
--
ELSIF p_network_point_array(l_array_pos).name = l_holder_record.name THEN
-- Move both on
l_array_pos := l_array_pos + 1;
FETCH c_nepo INTO l_holder_record;
--
ELSE
-- Move the array position on - shouldn't realy happen as this means there
-- will be a foreign key violation soon...
l_array_pos := l_array_pos + 1;
END IF;
--
END LOOP;
--
-- If we still have rows in the cursor - output the values
WHILE c_nepo%FOUND LOOP
-- Output the current cursor detail to the OUT array
l_out_pos := l_out_pos + 1;
p_avail_net_points(l_out_pos).nepo_id := l_holder_record.nepo_id;
p_avail_net_points(l_out_pos).name := l_holder_record.name;
--
FETCH c_nepo INTO l_holder_record;
--
END LOOP;
--
CLOSE c_nepo;
--
END get_avail_net_points;
PROCEDURE nepg_js
IS
BEGIN
--
htp.p('
function setListForSubmit( onOff, listId ) {
var theList = document.getElementById( listId );
if (onOff == "on") {
for (var i=0; i<theList.length; i++) {
theList.options[i].selected = true;
}
}
else {
for (var i=0; i<theList.length; i++) {
theList.options[i].selected = false;
}
}
}
function submitForm( formId ) {
var theForm = document.getElementById( formId );
theForm.submit();
}
function submitPage1() {
// Check to see if we have the network points lists - and set them if they are there
if (document.getElementById(''p_nepo_id'')) {
setListForSubmit(''on'',''p_nepo_id'');
setListForSubmit(''off'',''add_nepo_id'');
}
if (document.getElementById(''p_changes'')) {
var pch = document.getElementById(''p_changes'');
pch.parentNode.removeChild(pch);
}
submitForm(''nepgForm'');
}
function setChanged() {
document.getElementById(''p_changes'').value = ''changed'';
}
function clearNetworkPointFilter() {
var npf = document.getElementById(''networkPointFilter'');
npf.value = '''';
}
function moveFocusTo( str ) {
if (document.getElementById(str)) {
document.getElementById(str).focus();
}
}
');
--
END nepg_js;
PROCEDURE optiontransfer_js IS
BEGIN
htp.p('// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
// ===================================================================
');
htp.p('
/*
OptionTransfer.js
Last Modified: 7/12/2004
DESCRIPTION: This widget is used to easily and quickly create an interface
where the user can transfer choices from one select box to another. For
example, when selecting which columns to show or hide in search results.
This object adds value by automatically storing the values that were added
or removed from each list, as well as the state of the final list.
COMPATABILITY: Should work on all Javascript-compliant browsers.
USAGE:
// Create a new OptionTransfer object. Pass it the field names of the left
// select box and the right select box.
var ot = new OptionTransfer("from","to");
// Optionally tell the lists whether or not to auto-sort when options are
// moved. By default, the lists will be sorted.
ot.setAutoSort(true);
// Optionally set the delimiter to be used to separate values that are
// stored in hidden fields for the added and removed options, as well as
// final state of the lists. Defaults to a comma.
ot.setDelimiter("|");
// You can set a regular expression for option texts which are _not_ allowed to
// be transferred in either direction
ot.setStaticOptionRegex("static");');
htp.p('
// These functions assign the form fields which will store the state of
// the lists. Each one is optional, so you can pick to only store the
// new options which were transferred to the right list, for example.
// Each function takes the name of a HIDDEN or TEXT input field.
// Store list of options removed from left list into an input field
ot.saveRemovedLeftOptions("removedLeft");
// Store list of options removed from right list into an input field
ot.saveRemovedRightOptions("removedRight");
// Store list of options added to left list into an input field
ot.saveAddedLeftOptions("addedLeft");
// Store list of options radded to right list into an input field
ot.saveAddedRightOptions("addedRight");
// Store all options existing in the left list into an input field
ot.saveNewLeftOptions("newLeft");
// Store all options existing in the right list into an input field
ot.saveNewRightOptions("newRight");
// IMPORTANT: This step is required for the OptionTransfer object to work
// correctly.
// Add a call to the BODY onLoad="" tag of the page, and pass a reference to
// the form which contains the select boxes and input fields.
BODY onLoad="ot.init(document.forms[0])"
// ADDING ACTIONS INTO YOUR PAGE
// Finally, add calls to the object to move options back and forth, either
// from links in your page or from double-clicking the options themselves.
// See example page, and use the following methods:
ot.transferRight();
ot.transferAllRight();
ot.transferLeft();
ot.transferAllLeft();');
htp.p('
NOTES:
1) Requires the functions in selectbox.js
*/
function OT_transferLeft() { moveSelectedOptions(this.right,this.left,this.autoSort,this.staticOptionRegex); this.update(); }
function OT_transferRight() { moveSelectedOptions(this.left,this.right,this.autoSort,this.staticOptionRegex); this.update(); }
function OT_transferAllLeft() { moveAllOptions(this.right,this.left,this.autoSort,this.staticOptionRegex); this.update(); }
function OT_transferAllRight() { moveAllOptions(this.left,this.right,this.autoSort,this.staticOptionRegex); this.update(); }
function OT_saveRemovedLeftOptions(f) { this.removedLeftField = f; }
function OT_saveRemovedRightOptions(f) { this.removedRightField = f; }
function OT_saveAddedLeftOptions(f) { this.addedLeftField = f; }
function OT_saveAddedRightOptions(f) { this.addedRightField = f; }
function OT_saveNewLeftOptions(f) { this.newLeftField = f; }
function OT_saveNewRightOptions(f) { this.newRightField = f; }
function OT_update() {
var removedLeft = new Object();
var removedRight = new Object();
var addedLeft = new Object();
var addedRight = new Object();
var newLeft = new Object();
var newRight = new Object();
for (var i=0;i<this.left.options.length;i++) {
var o=this.left.options[i];
newLeft[o.value]=1;
if (typeof(this.originalLeftValues[o.value])=="undefined") {
addedLeft[o.value]=1;
removedRight[o.value]=1;
}
}
for (var i=0;i<this.right.options.length;i++) {
var o=this.right.options[i];
newRight[o.value]=1;
if (typeof(this.originalRightValues[o.value])=="undefined") {
addedRight[o.value]=1;
removedLeft[o.value]=1;
}
}
if (this.removedLeftField!=null) { this.removedLeftField.value = OT_join(removedLeft,this.delimiter); }
if (this.removedRightField!=null) { this.removedRightField.value = OT_join(removedRight,this.delimiter); }
if (this.addedLeftField!=null) { this.addedLeftField.value = OT_join(addedLeft,this.delimiter); }
if (this.addedRightField!=null) { this.addedRightField.value = OT_join(addedRight,this.delimiter); }
if (this.newLeftField!=null) { this.newLeftField.value = OT_join(newLeft,this.delimiter); }
if (this.newRightField!=null) { this.newRightField.value = OT_join(newRight,this.delimiter); }
}');
htp.p('
function OT_join(o,delimiter) {
var val; var str="";
for(val in o){
if (str.length>0) { str=str+delimiter; }
str=str+val;
}
return str;
}
function OT_setDelimiter(val) { this.delimiter=val; }
function OT_setAutoSort(val) { this.autoSort=val; }
function OT_setStaticOptionRegex(val) { this.staticOptionRegex=val; }
function OT_init(theform) {
this.form = theform;
if(!theform[this.left]){alert("OptionTransfer init(): Left select list does not exist in form!");return false;}
if(!theform[this.right]){alert("OptionTransfer init(): Right select list does not exist in form!");return false;}
this.left=theform[this.left];
this.right=theform[this.right];
for(var i=0;i<this.left.options.length;i++) {
this.originalLeftValues[this.left.options[i].value]=1;
}
for(var i=0;i<this.right.options.length;i++) {
this.originalRightValues[this.right.options[i].value]=1;
}
if(this.removedLeftField!=null) { this.removedLeftField=theform[this.removedLeftField]; }
if(this.removedRightField!=null) { this.removedRightField=theform[this.removedRightField]; }
if(this.addedLeftField!=null) { this.addedLeftField=theform[this.addedLeftField]; }
if(this.addedRightField!=null) { this.addedRightField=theform[this.addedRightField]; }
if(this.newLeftField!=null) { this.newLeftField=theform[this.newLeftField]; }
if(this.newRightField!=null) { this.newRightField=theform[this.newRightField]; }
this.update();
}
// -------------------------------------------------------------------
// OptionTransfer()
// This is the object interface.
// -------------------------------------------------------------------');
htp.p('
function OptionTransfer(l,r) {
this.form = null;
this.left=l;
this.right=r;
this.autoSort=true;
this.delimiter=",";
this.staticOptionRegex = "";
this.originalLeftValues = new Object();
this.originalRightValues = new Object();
this.removedLeftField = null;
this.removedRightField = null;
this.addedLeftField = null;
this.addedRightField = null;
this.newLeftField = null;
this.newRightField = null;
this.transferLeft=OT_transferLeft;
this.transferRight=OT_transferRight;
this.transferAllLeft=OT_transferAllLeft;
this.transferAllRight=OT_transferAllRight;
this.saveRemovedLeftOptions=OT_saveRemovedLeftOptions;
this.saveRemovedRightOptions=OT_saveRemovedRightOptions;
this.saveAddedLeftOptions=OT_saveAddedLeftOptions;
this.saveAddedRightOptions=OT_saveAddedRightOptions;
this.saveNewLeftOptions=OT_saveNewLeftOptions;
this.saveNewRightOptions=OT_saveNewRightOptions;
this.setDelimiter=OT_setDelimiter;
this.setAutoSort=OT_setAutoSort;
this.setStaticOptionRegex=OT_setStaticOptionRegex;
this.init=OT_init;
this.update=OT_update;
}
');
END optiontransfer_js;
PROCEDURE autocomplete_js IS
BEGIN
htp.p('// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
// ===================================================================
// -------------------------------------------------------------------
// autoComplete (text_input, select_input, ["text"|"value"], [true|false])
// Use this function when you have a SELECT box of values and a text
// input box with a fill-in value. Often, onChange of the SELECT box
// will fill in the selected value into the text input (working like
// a Windows combo box). Using this function, typing into the text
// box will auto-select the best match in the SELECT box and do
// auto-complete in supported browsers.
// Arguments:
// field = text input field object
// select = select list object containing valid values
// property = either "text" or "value". This chooses which of the
// SELECT properties gets filled into the text box -
// the ''value'' or ''text'' of the selected option
// forcematch = true or false. Set to ''true'' to not allow any text
// in the text box that does not match an option. Only
// supported in IE (possible future Netscape).
// -------------------------------------------------------------------
function autoComplete (field, select, property, forcematch) {
var found = false;
for (var i = 0; i < select.options.length; i++) {
if (select.options[i][property].toUpperCase().indexOf(field.value.toUpperCase()) == 0) {
found=true; break;
}
}
if (found) { select.selectedIndex = i; }
else { select.selectedIndex = -1; }
if (field.createTextRange) {
if (forcematch && !found) {
field.value=field.value.substring(0,field.value.length-1);
return;
}
var cursorKeys ="8;46;37;38;39;40;33;34;35;36;45;";
if (cursorKeys.indexOf(event.keyCode+";") == -1) {
var r1 = field.createTextRange();
var oldValue = r1.text;
var newValue = found ? select.options[i][property] : oldValue;
if (newValue != field.value) {
field.value = newValue;
var rNew = field.createTextRange();
rNew.moveStart(''character'', oldValue.length) ;
rNew.select();
}
}
}
}
');
END autocomplete_js;
PROCEDURE selectbox_js IS
BEGIN
htp.p('// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
// ===================================================================
// HISTORY
// ------------------------------------------------------------------
// April 20, 2005: Fixed the removeSelectedOptions() function to
// correctly handle single selects
// June 12, 2003: Modified up and down functions to support more than
// one selected option
/*
DESCRIPTION: These are general functions to deal with and manipulate
select boxes. Also see the OptionTransfer library to more easily
handle transferring options between two lists
COMPATABILITY: These are fairly basic functions - they should work on
all browsers that support Javascript.
*/
// -------------------------------------------------------------------
// hasOptions(obj)
// Utility function to determine if a select object has an options array
// -------------------------------------------------------------------
function hasOptions(obj) {
if (obj!=null && obj.options!=null) { return true; }
return false;
}
// -------------------------------------------------------------------
// selectUnselectMatchingOptions(select_object,regex,select/unselect,true/false)
// This is a general function used by the select functions below, to
// avoid code duplication
// -------------------------------------------------------------------
function selectUnselectMatchingOptions(obj,regex,which,only) {
if (window.RegExp) {
if (which == "select") {
var selected1=true;
var selected2=false;
}
else if (which == "unselect") {
var selected1=false;
var selected2=true;
}
else {
return;
}
var re = new RegExp(regex);
if (!hasOptions(obj)) { return; }
for (var i=0; i<obj.options.length; i++) {
if (re.test(obj.options[i].text)) {
obj.options[i].selected = selected1;
}
else {
if (only == true) {
obj.options[i].selected = selected2;
}
}
}
}
}
// -------------------------------------------------------------------
// selectMatchingOptions(select_object,regex)
// This function selects all options that match the regular expression
// passed in. Currently-selected options will not be changed.
// -------------------------------------------------------------------
function selectMatchingOptions(obj,regex) {
selectUnselectMatchingOptions(obj,regex,"select",false);
}
// -------------------------------------------------------------------
// selectOnlyMatchingOptions(select_object,regex)
// This function selects all options that match the regular expression
// passed in. Selected options that don''t match will be un-selected.
// -------------------------------------------------------------------
function selectOnlyMatchingOptions(obj,regex) {
selectUnselectMatchingOptions(obj,regex,"select",true);
}
// -------------------------------------------------------------------
// unSelectMatchingOptions(select_object,regex)
// This function Unselects all options that match the regular expression
// passed in.
// -------------------------------------------------------------------
function unSelectMatchingOptions(obj,regex) {
selectUnselectMatchingOptions(obj,regex,"unselect",false);
}
// -------------------------------------------------------------------
// sortSelect(select_object)
// Pass this function a SELECT object and the options will be sorted
// by their text (display) values
// -------------------------------------------------------------------
function sortSelect(obj) {
var o = new Array();
if (!hasOptions(obj)) { return; }
for (var i=0; i<obj.options.length; i++) {
o[o.length] = new Option( obj.options[i].text, obj.options[i].value, obj.options[i].defaultSelected, obj.options[i].selected);
o[i].className = obj.options[i].className;
}
if (o.length==0) { return; }
o = o.sort(
function(a,b) {
if ((a.text+"") < (b.text+"")) { return -1; }
if ((a.text+"") > (b.text+"")) { return 1; }
return 0;
}
);
for (var i=0; i<o.length; i++) {
obj.options[i] = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
obj.options[i].className = o[i].className;
}
}
');
htp.p('
// -------------------------------------------------------------------
// selectAllOptions(select_object)
// This function takes a select box and selects all options (in a
// multiple select object). This is used when passing values between
// two select boxes. Select all options in the right box before
// submitting the form so the values will be sent to the server.
// -------------------------------------------------------------------
function selectAllOptions(obj) {
if (!hasOptions(obj)) { return; }
for (var i=0; i<obj.options.length; i++) {
obj.options[i].selected = true;
}
}
// -------------------------------------------------------------------
// moveSelectedOptions(select_object,select_object[,autosort(true/false)[,regex]])
// This function moves options between select boxes. Works best with
// multi-select boxes to create the common Windows control effect.
// Passes all selected values from the first object to the second
// object and re-sorts each box.
// If a third argument of ''false'' is passed, then the lists are not
// sorted after the move.
// If a fourth string argument is passed, this will function as a
// Regular Expression to match against the TEXT or the options. If
// the text of an option matches the pattern, it will NOT be moved.
// It will be treated as an unmoveable option.
// You can also put this into the <SELECT> object as follows:
// onDblClick="moveSelectedOptions(this,this.form.target)
// This way, when the user double-clicks on a value in one box, it
// will be transferred to the other (in browsers that support the
// onDblClick() event handler).
// -------------------------------------------------------------------
function moveSelectedOptions(from,to) {
// Unselect matching options, if required
if (arguments.length>3) {
var regex = arguments[3];
if (regex != "") {
unSelectMatchingOptions(from,regex);
}
}
// Move them over
if (!hasOptions(from)) { return; }
for (var i=0; i<from.options.length; i++) {
var o = from.options[i];
if (o.selected) {
if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; }
to.options[index] = new Option( o.text, o.value, false, false);
}
}
// Delete them from original
for (var i=(from.options.length-1); i>=0; i--) {
var o = from.options[i];
if (o.selected) {
from.options[i] = null;
}
}
if ((arguments.length<3) || (arguments[2]==true)) {
sortSelect(from);
sortSelect(to);
}
from.selectedIndex = -1;
to.selectedIndex = -1;
}
// -------------------------------------------------------------------
// copySelectedOptions(select_object,select_object[,autosort(true/false)])
// This function copies options between select boxes instead of
// moving items. Duplicates in the target list are not allowed.
// -------------------------------------------------------------------
function copySelectedOptions(from,to) {
var options = new Object();
if (hasOptions(to)) {
for (var i=0; i<to.options.length; i++) {
options[to.options[i].value] = to.options[i].text;
}
}
if (!hasOptions(from)) { return; }
for (var i=0; i<from.options.length; i++) {
var o = from.options[i];
if (o.selected) {
if (options[o.value] == null || options[o.value] == "undefined" || options[o.value]!=o.text) {
if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; }
to.options[index] = new Option( o.text, o.value, false, false);
}
}
}
if ((arguments.length<3) || (arguments[2]==true)) {
sortSelect(to);
}
from.selectedIndex = -1;
to.selectedIndex = -1;
}
// -------------------------------------------------------------------
// moveAllOptions(select_object,select_object[,autosort(true/false)[,regex]])
// Move all options from one select box to another.
// -------------------------------------------------------------------
function moveAllOptions(from,to) {
selectAllOptions(from);
if (arguments.length==2) {
moveSelectedOptions(from,to);
}
else if (arguments.length==3) {
moveSelectedOptions(from,to,arguments[2]);
}
else if (arguments.length==4) {
moveSelectedOptions(from,to,arguments[2],arguments[3]);
}
}
// -------------------------------------------------------------------
// copyAllOptions(select_object,select_object[,autosort(true/false)])
// Copy all options from one select box to another, instead of
// removing items. Duplicates in the target list are not allowed.
// -------------------------------------------------------------------
function copyAllOptions(from,to) {
selectAllOptions(from);
if (arguments.length==2) {
copySelectedOptions(from,to);
}
else if (arguments.length==3) {
copySelectedOptions(from,to,arguments[2]);
}
}
');
htp.p('
// -------------------------------------------------------------------
// swapOptions(select_object,option1,option2)
// Swap positions of two options in a select list
// -------------------------------------------------------------------
function swapOptions(obj,i,j) {
var o = obj.options;
var i_selected = o[i].selected;
var j_selected = o[j].selected;
var temp = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
var temp2= new Option(o[j].text, o[j].value, o[j].defaultSelected, o[j].selected);
o[i] = temp2;
o[j] = temp;
o[i].selected = j_selected;
o[j].selected = i_selected;
}
// -------------------------------------------------------------------
// moveOptionUp(select_object)
// Move selected option in a select list up one
// -------------------------------------------------------------------
function moveOptionUp(obj) {
if (!hasOptions(obj)) { return; }
for (i=0; i<obj.options.length; i++) {
if (obj.options[i].selected) {
if (i != 0 && !obj.options[i-1].selected) {
swapOptions(obj,i,i-1);
obj.options[i-1].selected = true;
}
}
}
}
// -------------------------------------------------------------------
// moveOptionDown(select_object)
// Move selected option in a select list down one
// -------------------------------------------------------------------
function moveOptionDown(obj) {
if (!hasOptions(obj)) { return; }
for (i=obj.options.length-1; i>=0; i--) {
if (obj.options[i].selected) {
if (i != (obj.options.length-1) && ! obj.options[i+1].selected) {
swapOptions(obj,i,i+1);
obj.options[i+1].selected = true;
}
}
}
}
// -------------------------------------------------------------------
// removeSelectedOptions(select_object)
// Remove all selected options from a list
// (Thanks to Gene Ninestein)
// -------------------------------------------------------------------
function removeSelectedOptions(from) {
if (!hasOptions(from)) { return; }
if (from.type=="select-one") {
from.options[from.selectedIndex] = null;
}
else {
for (var i=(from.options.length-1); i>=0; i--) {
var o=from.options[i];
if (o.selected) {
from.options[i] = null;
}
}
}
from.selectedIndex = -1;
}
// -------------------------------------------------------------------
// removeAllOptions(select_object)
// Remove all options from a list
// -------------------------------------------------------------------
function removeAllOptions(from) {
if (!hasOptions(from)) { return; }
for (var i=(from.options.length-1); i>=0; i--) {
from.options[i] = null;
}
from.selectedIndex = -1;
}
// -------------------------------------------------------------------
// addOption(select_object,display_text,value,selected)
// Add an option to a list
// -------------------------------------------------------------------
function addOption(obj,text,value,selected) {
if (obj!=null && obj.options!=null) {
obj.options[obj.options.length] = new Option(text, value, false, selected);
}
}
');
END selectbox_js;
PROCEDURE nepg_css IS
BEGIN
--
htp.p('
#p_customer_id {
width : 250px;
}
#p_customer_name {
width : 250px;
}
#p_contract_number {
width : 250px;
}
#p_template_name {
width : 250px;
}
#p_template_desc {
width : 400px;
}
.contact {
width : 250px;
}
.datefield {
width : 80px;
}
.selectItemsDiv {
position : relative;
top : 10px;
float : left;
width : 270px;
border : 1px solid;
}
.selectBoxDiv {
height : 87px;
overflow : hide;
border : 1px solid;
}
.inheritedCat {
background-color : #E6E6E6;
}
.inheritedPar {
background-color : #E6E6E6;
}
.listTableHeadRow {
background-color : #D9D9D9;
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;
}
.selectListWidth {
width : 264px;
}
.selectListWidthTH {
background-color : #D9D9D9;
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;
}
.selectListButtonTD {
text-align : center
}
.selectListButton {
font-size : smaller;
}
');
--
END nepg_css;
PROCEDURE display_message( p_success IN VARCHAR2
, p_error IN VARCHAR2
, p_err_msg IN VARCHAR2
, p_ins_or_upd IN VARCHAR2 )
IS
BEGIN
--
IF p_success = 'Y' THEN
-- Success!
htp.p('<b><font size="+2" color="#008000"><i>'||caco_utilities.get_module_text(876)||'</i></font><br /></b><p></p>');
ELSIF p_error = 'Y' THEN
htp.p('<b><font size="+2" color="#840201"><i>');
IF p_ins_or_upd = 'INSERT' THEN
htp.p(caco_utilities.get_module_text(2334)); -- Insert failed
ELSE
htp.p(caco_utilities.get_module_text(2340)); -- Update failed
END IF;
htp.p('</i></font><br /></b>');
htp.p('<b>'||p_err_msg||'<br /></b><p></p>');
END IF;
--
END display_message;
PROCEDURE display_buttons( p_ins_or_upd IN VARCHAR2 )
IS
l_url VARCHAR2(255) := NULL;
BEGIN
-- Insert or Update Button
htp.p('<input type="button" ');
IF p_ins_or_upd = 'INSERT'
OR p_ins_or_upd IS NULL
THEN
htp.p('value="'||caco_utilities.get_module_text(840)||'" '); -- Insert
ELSE
htp.p('value="'||caco_utilities.get_module_text(837)||'" '); -- Update
END IF;
--
htp.p('onclick="submitPage1()" />');
--
l_url := dad_path||'efnow250$.startup';
--
htp.p('<input type="button" value="'||caco_utilities.get_module_text(993)||'" onclick="location.href='''||l_url||'''" />'); -- Cancel
--
END display_buttons;
PROCEDURE display_nepg_code( p_code IN VARCHAR2,
p_ins_or_upd IN VARCHAR2 )
IS
BEGIN
--
htp.p('
<tr>
<td>
<b>'||caco_utilities.get_module_text(3901)||' *</b>'); -- Network Point Group ID
htp.p(' </td>
<td>');
IF p_ins_or_upd = 'INSERT' THEN
htp.p('<input id="p_nepg_code" name="p_nepg_code" type="text" value="'||p_code||'" onchange="setChanged();" maxlength="12" />');
ELSE
-- make the field non updatable by diverting focus to nepg name
htp.p('<input id="p_nepg_code" name="p_nepg_code" type="text" value="'||p_code||'" onFocus="document.getElementById(''p_nepg_name'').focus()" />');
END IF;
htp.p(' </td>
<td>&nbsp;</td>
</tr>');
--
END display_nepg_code;
PROCEDURE display_nepg_name( p_name IN VARCHAR2 )
IS
BEGIN
--
htp.p('
<tr>
<td>
<b>'||caco_utilities.get_module_text(116)||' *</b>'); -- Name
htp.p(' </td>
<td>
<input id="p_nepg_name" name="p_nepg_name" type="text" value="'||p_name||'" onchange="setChanged();" maxlength="30" />
</td>
<td>&nbsp;</td>
</tr>');
--
END display_nepg_name;
PROCEDURE display_nepg_status( p_status IN VARCHAR2 )
IS
BEGIN
-- Status
htp.p(' <td>'||caco_utilities.get_module_text(2114)||' *</td>'); -- Status
htp.p(' <td>
<select id="p_nepg_status" name="p_nepg_status" size="1" onchange="setChanged();"> ');
--
IF UPPER(p_status) = 'A'
OR p_status IS NULL
THEN
htp.p('<option selected value="A">'||caco_utilities.get_module_text(2116)||'</option>'); -- Active
htp.p('<option value="I">'||caco_utilities.get_module_text(2117)||'</option>'); -- Inactive
ELSE
htp.p('<option value="A">'||caco_utilities.get_module_text(2116)||'</option>'); -- Active
htp.p('<option selected value="I">'||caco_utilities.get_module_text(2117)||'</option>'); -- Inactive
END IF;
--
htp.p(' </select>
</td>');
--
END display_nepg_status;
PROCEDURE display_network_points( p_network_point_array IN network_point_array
, p_avail_net_points IN network_point_array )
IS
BEGIN
-- Output the Network Points lists
htp.p('
<div class="selectItemsDiv" id="networkPointsDiv" >
<table>
<tr class="listTableHeadRow">
<th class="selectListWidthTH">'||caco_utilities.get_module_text(2277)||'</th>'); -- Network Points
htp.p(' </tr>
<tr>
<td>
<div class="selectBoxDiv">
<select class="selectListWidth" id="p_nepo_id" name="p_nepo_id" size="5" multiple
ondblclick="opt.transferLeft();setChanged();" >');
--
-- Now output the options we already found from the compiled arrays
IF NVL(p_network_point_array.COUNT,0) > 0 THEN
FOR i IN 1..p_network_point_array.COUNT LOOP
htp.p('<option value="'||p_network_point_array(i).nepo_id||'">'||p_network_point_array(i).name||'</option>');
END LOOP;
END IF;
--
htp.p('
</select>
</div>
</td>
</tr>
<tr>
<td class="selectListButtonTD">
<input class="selectListButton" type="button" value="'||caco_utilities.get_module_text(2294)||'"'); -- Remove Selected Network Points
htp.p(' onclick="opt.transferLeft();setChanged();" />
</td>
</tr>
<tr>
<td>
<div class="selectBoxDiv">
<select class="selectListWidth" id="add_nepo_id" name="add_nepo_id" size="5" multiple
ondblclick="opt.transferRight();setChanged();" >');
--
-- Output the remaining available Network Points that could be selected for this Contract
IF NVL(p_avail_net_points.COUNT,0) > 0 THEN
FOR i IN 1..p_avail_net_points.COUNT LOOP
htp.p('<option value="'||p_avail_net_points(i).nepo_id||'">'||p_avail_net_points(i).name||'</option>');
END LOOP;
END IF;
--
htp.p('
</select>
</div>
</td>
</tr>
<tr>
<td class="selectListButtonTD">
<input type="text" id="networkPointFilter"
onKeyUp="autoComplete( document.getElementById(''networkPointFilter'')
, document.getElementById(''add_nepo_id''), ''text'', true);" />
<input class="selectListButton" type="button" value="'||caco_utilities.get_module_text(2209)||'"'); -- Add Network Points
htp.p(' onclick="opt.transferRight();setChanged();clearNetworkPointFilter();moveFocusTo(''networkPointFilter'');" />
</td>
</tr>
</table>
</div>');
--
END display_network_points;
PROCEDURE startup( p_ins_or_upd IN VARCHAR2 DEFAULT 'INSERT'
, p_success IN VARCHAR2 DEFAULT NULL
, p_nepg_id IN network_point_groups.nepg_id%TYPE DEFAULT 0
, p_nepg_name IN VARCHAR2 DEFAULT NULL
, p_nepg_code IN VARCHAR2 DEFAULT NULL
, p_nepg_status IN contracts.status%TYPE DEFAULT NULL
, p_error IN VARCHAR2 DEFAULT NULL
, p_err_msg IN VARCHAR2 DEFAULT NULL
, p_nepo_id IN owa_util.vc_arr DEFAULT g_vc_arr
)
IS
--
l_ins_or_upd VARCHAR2(6) := 'INSERT';
l_network_point_array network_point_array;
l_avail_net_points network_point_array;
--
l_onload_options VARCHAR2(255) := NULL;
--
l_code_position VARCHAR2(4) := '0000';
--
l_nepg_record network_point_groups%ROWTYPE;
l_nepg_id network_point_groups.nepg_id%TYPE;
l_nepg_code VARCHAR2(2000);
l_nepg_name VARCHAR2(2000);
l_nepg_status network_point_groups.status%TYPE;
--
BEGIN
--
IF NOT caco_security.security_check(g_package_name) THEN
RETURN;
END IF;
--
-- Ensure any passed parameters are correct
--
IF p_error IS NOT NULL
AND p_error = 'Y'
THEN
l_code_position := '0010';
--
-- Here we have to build the screen from the originally submitted data
-- that has NOT been saved to the DB
--
-- get the bits required for a nepg
-- Lets deal with Network Points
-- There are probably many so lets create an array by searching the array
find_passed_net_points( p_nepo_id -- this is the passed in array of nepo_id's
, l_network_point_array );
--
-- Put all other nepg parameters into local variables
l_ins_or_upd := p_ins_or_upd;
l_nepg_id := p_nepg_id;
l_nepg_name := p_nepg_name;
l_nepg_code := p_nepg_code;
l_nepg_status := p_nepg_status;
--
ELSE
-- Was this a successful Insert or Update?
IF p_success = 'Y' THEN
l_code_position := '0500';
-- Just grab the data from the DB using the Contract ID or Template Id
IF p_nepg_id IS NOT NULL
AND p_nepg_id > 0
THEN
l_code_position := '0510';
--
l_ins_or_upd := 'UPDATE';
--
-- Get the details for the contract from the DB
--
get_nepg_details( p_nepg_id
, l_nepg_record
, l_network_point_array );
--
l_code_position := '0520';
-- More work required here to set the variables correctly...
l_nepg_id := p_nepg_id;
l_nepg_name := l_nepg_record.name;
l_nepg_code := l_nepg_record.code;
l_nepg_status := l_nepg_record.status;
--
ELSE
l_code_position := '0550';
-- What happens if neither have been sent?
-- This shouldn't happen as success can only
-- come from the efno_contracts program units
NULL;
END IF;
--
ELSE
l_code_position := '0800';
-- Template not changed - real new or update.
--
IF p_nepg_id IS NOT NULL
AND p_nepg_id > 0
THEN
l_code_position := '0820';
--
l_ins_or_upd := 'UPDATE';
--
-- Get the details for the contract from the DB
get_nepg_details( p_nepg_id
, l_nepg_record
, l_network_point_array );
--
l_code_position := '0830';
--
l_nepg_id := p_nepg_id;
l_nepg_name := l_nepg_record.name;
l_nepg_code := l_nepg_record.code;
l_nepg_status := l_nepg_record.status;
--
END IF;
--
--
END IF; -- end of successful insert/update IF
--
END IF; -- end of error screen build or ins/upd
--
l_code_position := '0900';
--
-- Get all network points and then filter list to ensure that only
-- the unselected ones are left in the resultant array
l_code_position := '1000';
--
get_avail_net_points( l_network_point_array -- array of already selected network points
, l_avail_net_points ); -- returning list of remaining net points
--
l_code_position := '2000';
--
wsgl.openpagehead(caco_utilities.get_module_text(3900)); -- Maintain Network Point Groups
--
--wsgl.metatag;
--htp.p('<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><LINK REL=stylesheet HREF="caco_system.css?p_type=content" >');
caco_system.content_type;
htp.p('<LINK REL=stylesheet HREF="caco_system.css?p_type=content" >');
htp.p(' <script type="text/javascript" src="efnow251$.selectbox_js"></script>');
htp.p(' <script type="text/javascript" src="efnow251$.optiontransfer_js"></script>');
htp.p(' <script type="text/javascript" src="efnow251$.autocomplete_js"></script>');
htp.p(' <script type="text/javascript" src="efnow251$.nepg_js"></script>');
htp.p(' <link rel="stylesheet" media="all" type="text/css" href="efnow251$.nepg_css" />');
--
htp.p(wsgjsl.openscript);
wsgjsl.output_invoke_cal_js('efnow251$'
,'scrollbars=no,resizable=no,width=320,height=350');
htp.p(wsgjsl.closescript);
--
-- initialise javascript object
htp.p(' <SCRIPT LANGUAGE="JavaScript">');
--
htp.p('
var opt = new OptionTransfer("add_nepo_id","p_nepo_id");
opt.setAutoSort(true);
opt.setDelimiter(",");
');
htp.p(' </SCRIPT>');
--
l_onload_options := 'onload="';
l_onload_options := l_onload_options||'opt.init(document.getElementById(''nepgForm''));"';
--
wsgl.closepagehead;
wsgl.openpagebody(FALSE, l_onload_options );
htp.p(caco_system.menu);
--
--
l_code_position := '2100';
--
-- Now we get to actually build the page.....
htp.p('
<div id="nepg_border_div" style="margin:15px;">
<form id="nepgForm" name="nepgForm" method="POST" ');
--
htp.p('action="efno_nepg.ins_or_upd_nepg">');
--
htp.p('<div>');
--
l_code_position := '2010';
--
-- Output a hidden input to track if changes have been made to any of the parameters
IF p_error = 'Y'
THEN
htp.p('<input id="p_changes" type="hidden" value="changed" />');
ELSE
htp.p('<input id="p_changes" type="hidden" value="none" />');
END IF;
--
l_code_position := '2020';
--
-- Put out all remaining hidden fields
htp.p('<input id="p_ins_or_upd" name="p_ins_or_upd" type="hidden" value="'||l_ins_or_upd||'" />');
--
htp.p('<input id="p_nepg_id" name="p_nepg_id" type="hidden" value="'||l_nepg_id||'" />');
--
l_code_position := '2030';
--
htp.p('<h1>'||caco_utilities.get_module_text(3900)||'</h1>'); -- Maintain Network Point Groups
--
l_code_position := '2040';
--
-- Put out success or error messages from completed or failed insert/update
display_message( p_success => p_success
, p_error => p_error
, p_err_msg => p_err_msg
, p_ins_or_upd => p_ins_or_upd );
--
l_code_position := '2050';
--
htp.p('
<table>');
--
l_code_position := '2500';
--
display_nepg_code( l_nepg_code, l_ins_or_upd );
--
display_nepg_name( l_nepg_name );
--
display_nepg_status( l_nepg_status );
-- Horizontal line - to separate the above from the other minutae
htp.p(' <tr>
<td colspan="3"><hr /></td>
</tr>');
--
htp.p('</tr>');
--
-- Close the details table
htp.p(' </table>');
--
htp.p('<i>''*'''||caco_utilities.get_module_text(2202)||'</i>'); -- '*' Denotes a mandatory field
--
l_code_position := '2800';
--
-- Top level details done
-- Now write out the select list
--
--htp.p('<p style="text-decoration:underline;"><b>'||caco_utilities.get_module_text(2277)||'</b></p>'); -- Network Points
--
htp.nl;
htp.nl;
l_code_position := '2810';
-- We need some buttons....required here due to CSS problems below the select lists.
display_buttons(l_ins_or_upd);
--
l_code_position := '2820';
--
display_network_points( l_network_point_array
, l_avail_net_points );
--
l_code_position := '2900';
--
htp.p(chr(10)||'</div>'); -- Close of div just inside <form>
--
-- Close nepgForm
htp.p('</form>');
-- Close nepg_border_div
htp.p('</div>');
--
-- Close centrecontent div
htp.p('</div>');
--
wsgl.closepagebody;
--
EXCEPTION
WHEN others THEN
caco_debug.putline('efnow251$.startup: '
||'Position in Code : '||l_code_position||' : '||chr(10)
||sqlerrm(sqlcode));
-- Write an error and carry on
cout_err.report_and_go( p_exception_number => sqlcode
, p_exception_message => 'Position in Code : '||l_code_position
||' : '||chr(10)||sqlerrm(sqlcode)
, p_source => 'efnow251$.startup');
--
RAISE;
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
--
NULL;
--
END EFNOW251$;
/