Initial commit

This commit is contained in:
2021-04-20 07:16:22 +02:00
commit 588032b1dc
1709 changed files with 6660083 additions and 0 deletions

View File

@@ -0,0 +1,126 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
/**
* ArgumentNormalizer names and transforms function arguments based upon a
* set of rules provided by the user.
*/
if (typeof bobj == 'undefined') {
bobj = {};
}
bobj.ArgumentNormalizer = function() {
this._rules = [];
};
bobj.ArgumentNormalizer.prototype = {
/**
* Add a rule for naming and transforming arguments.
* When arguments are normalized each rule is applied until a match is
* found. A rule is a set of elements of the following form:
*
* {
* test: [function, null],
* name: [string],
* xform: [function - optional]
* }
*
* There should be one element of the above form for each argument expected
* by the rule. A rule is a match if and only if true is returned by every
* element's test function when passed its corresponding argument. A null
* test function is considered to return true. Rules are tested in the order
* they were added until one matches or there are no more to test.
*
* When a rule matches, it applies the optional xform (transform) functions
* to it arguments and saves the results in a return object with properties
* specified by the names in the rule elements.
*
* Example:
*
* n.addRule({test:isString, name:'description', xform:trim},
* {test:isNumber, name:'id'});
* n.addRule({test:isString, name:'description', xform:trim},
* {test:isString, name:'id', xform:parseInt});
*
* n.normalize(" Blue car", 11); // First rule matches
* -> {description: "Blue car", id: 11}
*
* n.normalize("Green car ", "55"); // Second rule matches
* -> {description: "Green car", id: 55}
*
* Rule elements may be passed as arrays for brevity. The first rule
* from the example above would be added as follows:
*
* n.addRule([isString, 'description', trim], [isNumber, 'id']);
*
* When an element simply names an argument (no test or transform is
* desired), it may be specified as a string. For example:
*
* n.addRule([isString, 'description', trim], 'id');
*/
addRule: function() {
this._rules.push(arguments);
},
/**
* Normalize the arguments based upon the rules that have been added
*
* @param arguments Arguments to be normalized
*
* @return An object with a property for each transformed argument or null
*/
normalize: function() {
for (var rIdx = 0, nRules = this._rules.length; rIdx < nRules; ++rIdx) {
var rule = this._rules[rIdx];
if (rule.length == arguments.length) {
var normalArgs = {};
for (var aIdx = 0, nArgs = rule.length; aIdx < nArgs; ++aIdx) {
var argVal = arguments[aIdx];
var element = rule[aIdx];
if (bobj.isString(element)) { // No test specified, just name the argument
var argTest = null;
var argName = element;
var argXform = null;
}
else if (bobj.isArray(element)) {
var argTest = element[0];
var argName = element[1];
var argXform = element[2];
}
else {
var argTest = element.test;
var argName = element.name;
var argXform = element.xform;
}
if (!argTest || argTest(argVal)) {
normalArgs[argName] = argXform ? argXform(argVal) : argVal;
if (aIdx+1 == nArgs) { // if no more args to check
return normalArgs; // Rule matched, return normalized args
}
}
else {
break; // Rule didn't match, try the next one
}
}
}
}
return null;
},
/**
* Applies an array of arguments to normalize()
*
* @param argsArray [Array] Array of arguments to normalize
*
* @return Normalized arguments or null
*/
normalizeArray: function(argsArray) {
return this.normalize.apply(this, argsArray);
}
};

View File

@@ -0,0 +1,244 @@
//** ButtonList Widget *************************************************************
/**
* ButtonList Constructor
*/
bobj.crv.newButtonList = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId(),
numLines: null, // null allows the height to grow (will fit within the viewport)
buttonWidth: 24,
buttonTooltip: L_bobj_crv_TabList,
changeCB: null,
label: null,
tabIndex: 0,
multiSelect: false,
menuWidth: null,
menuTooltip: null
}, kwArgs);
var o = newButtonWidget(
kwArgs.id,
kwArgs.label,
bobj.crv.ButtonList._onClick,
kwArgs.buttonWidth,
null,
kwArgs.buttonTooltip,
kwArgs.tabIndex,
0, _skin+"menus.gif", 7, 16, 0, 81, true, 0, 97);
o._menu = newListWidget(
kwArgs.id + "_menu",
MochiKit.Base.bind(bobj.crv.ButtonList._onChange, o),
kwArgs.multiSelect,
kwArgs.menuWidth,
kwArgs.numLines || 2,
kwArgs.menuTooltip,
null, //dblClickCB
null); //keyUpCB
o._listItems = [];
o._blOldInit = o.init;
o._blOldGetHTML = o.getHTML;
o._menuDiv = null;
o._captureClicks = MenuWidget_captureClicks;
o._releaseClicks = MenuWidget_releaseClicks;
bobj.fillIn(o, kwArgs);
o.widgetType = 'ButtonList';
MochiKit.Base.update(o, bobj.crv.ButtonList);
return o;
};
bobj.crv.ButtonList = {
/**
* @return [Widget] Menu/list widget associated with this button.
*/
getMenu : function() {
return this._menu;
},
/**
* Add an item to the menu
*
* @param label [String] The text to display in the menu
* @param value [any - opt.] The value associated with the new menu item
* @param isSelected [bool - opt.] True if item should be selected after being added
* @param id [String - opt.] DHTML id associated with menu item;
*/
add : function(label, value, isSelected, id) {
if (this._menu && this._menu.layer)
this._menu.add (label, value, isSelected, id);
else
this._listItems.push ( {
lbl : label,
val : value,
sel : isSelected,
id : id
});
},
init : function() {
var menu = this._menu;
this._blOldInit ();
menu.init ();
this._menuDiv = getLayer (this.id + '_menuDiv');
var listItems = this._listItems;
for ( var i = 0, len = listItems.length; i < len; ++i) {
var it = listItems[i];
menu.add (it.lbl, it.val, it.sel, it.id);
}
this._listItems = [];
},
getHTML : function() {
var h = bobj.html;
var menuDivAtts = {
id : this.id + '_menuDiv',
onmousedown : 'event.cancelBubble=true',
'class' : 'menuFrame',
style : {
visibility : 'hidden',
position : 'absolute',
'z-index' : 5000
}
};
return this._blOldGetHTML () + h.DIV (menuDivAtts, this._menu.getHTML ());
},
/**
* @return [bool] True if and only if the menu is visible
*/
isMenuShowing : function() {
return this._menuDiv && this._menuDiv.style.visibility != 'hidden';
},
/**
* Hide the menu
*/
hideMenu : function() {
if (this._menuDiv) {
this._menuDiv.style.visibility = 'hidden';
}
},
/**
* Position and show the menu
*/
showMenu : function() {
if (this._menuDiv) {
this._captureClicks ();
var body = document.body;
if (this._menuDiv.parentNode !== body) {
body.appendChild (this._menuDiv);
}
var divStyle = this._menuDiv.style;
divStyle.left = '-1000px';
divStyle.top = '-1000px';
divStyle.visibility = 'visible';
var winDim = MochiKit.Style.getViewportDimensions ();
var w = this._menu.layer.offsetWidth;
var h = this._menu.getHeight ();
/*
* If numLines wasn't specified, use as much space as necessary while remaining within the viewport
*/
if (!this.numLines) {
h = Math.min (this._menu.layer.scrollHeight + 10, winDim.h - 10);
this._menu.resize (null, h);
}
/* Place the menu below the button and aligned with the left edge */
var btnPos = getPosScrolled (this.layer);
var x = btnPos.x;
var y = btnPos.y + this.getHeight ();
/* Change coordinates so the whole menu is on the screen */
var xRight = x + w + 4;
var yBottom = y + h + 4;
var xMax = winDim.w + body.scrollLeft - Math.max (0, (winDim.w - body.offsetWidth));
if (xRight > xMax) {
x = Math.max (0, x - (xRight - xMax));
}
var yMax = winDim.h + body.scrollTop;
if (yBottom > yMax) {
y = Math.max (0, y - (yBottom - yMax));
}
divStyle.left = x + 'px';
divStyle.top = y + 'px';
}
},
/**
* Private. Capture clicks in the current document so that the menu can be hidden automatically.
*/
_captureClicks : function() {
var BIND = MochiKit.Base.bind;
try {
this.layer.onmousedown = BIND (this._onCaptureClick, this, true);
this._oldMousedown = document.onmousedown;
document.onmousedown = BIND (this._onCaptureClick, this, false);
} catch (ex) {
if (bobj.crv.config.isDebug) {
throw ex;
}
}
},
/**
* Private. Stop capturing clicks.
*/
_releaseClicks : function() {
if (this.layer.onmousedown) { /* non-null if clicks are being captured */
this.layer.onmousedown = null;
document.onmousedown = this._oldMousedown;
}
},
/**
* Private. Button click callback.
*/
_onClick : function() {
if (!this._cancelNextClick)
this.showMenu ();
this._cancelNextClick = false;
},
/**
* Private. Menu change callback.
*/
_onChange : function() {
this._releaseClicks ();
this.hideMenu ();
if (this.changeCB)
this.changeCB ();
},
/**
* Private. Called when a click is captured (after _captureClicks has been called)
*/
_onCaptureClick : function(cancelNext, e) {
this._cancelNextClick = cancelNext;
eventCancelBubble (e);
this.hideMenu ();
this._releaseClicks ();
}
};

View File

@@ -0,0 +1,539 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
if (typeof bobj == 'undefined') {
bobj = {};
}
if (typeof bobj.crv == 'undefined') {
bobj.crv = {};
}
if (typeof bobj.crv.Calendar == 'undefined') {
bobj.crv.Calendar = {};
}
/*
================================================================================
Calendar Widget
================================================================================
*/
/**
* Get a shared calendar instance
*/
bobj.crv.Calendar.getInstance = function() {
if (!bobj.crv.Calendar.__instance) {
bobj.crv.Calendar.__instance = bobj.crv.newCalendar();
}
return bobj.crv.Calendar.__instance;
};
bobj.crv.Calendar.Signals = {
OK_CLICK: 'okClick',
CANCEL_CLICK: 'cancelClick',
ON_HIDE: 'onHide'
};
bobj.crv.newCalendar = function(kwArgs) {
var UPDATE = MochiKit.Base.update;
kwArgs = UPDATE({
id: bobj.uniqueId() + "_calendar",
showTime: false,
date: new Date(),
// List of formats to match in order of preference. Once a format is
// matched, the time field will be displayed in that format.
timeFormats: ["HH:mm:ss", "H:mm:ss", "H:m:s", "HH:mm", "H:mm", "H:m",
"h:mm:ss a", "h:m:s a", "h:mm:ssa", "h:m:sa", "h:mm a", "h:m a",
"h:mma", "h:ma"]
}, kwArgs);
var o = newMenuWidget( );
o.widgetType = 'Calendar';
// Update instance with constructor arguments
bobj.fillIn(o, kwArgs);
// Update instance with member functions
o._menuJustInTimeInit = o.justInTimeInit;
UPDATE(o, bobj.crv.Calendar);
o._curTimeFormat = o.timeFormats[0];
o._cells = [];
o._firstDay = 0;
o._numDays = 0;
return o;
};
bobj.crv.Calendar._createHeaderButtons = function() {
var w = 8;
var h = 4;
var dx = 46;
var dyUp = 0;
var dyDown = 12;
var bind = MochiKit.Base.bind;
this._prevMonthBtn = newIconWidget(this.id+"_pm",_skin+'../lov.gif',bind(this._onPrevMonthClick, this),"",_calendarPrevMonthLab,w,h,dx,dyDown);
this._prevYearBtn = newIconWidget(this.id+"_py",_skin+'../lov.gif',bind(this._onPrevYearClick, this),"",_calendarPrevYearLab,w,h,dx,dyDown);
this._nextMonthBtn = newIconWidget(this.id+"_nm",_skin+'../lov.gif',bind(this._onNextMonthClick, this),"",_calendarNextMonthLab,w,h,dx,dyUp);
this._nextYearBtn = newIconWidget(this.id+"_ny",_skin+'../lov.gif',bind(this._onNextYearClick, this),"",_calendarNextYearLab,w,h,dx,dyUp);
};
bobj.crv.Calendar._createTimeTextField = function() {
var bind = MochiKit.Base.bind;
this._timeField = newTextFieldWidget(
this.id + '_time',
bind(this._onTimeChange, this), //changeCB
null, //maxChar
null, //keyUpCB
null, //enterCB
true, //noMargin
null, //tooltip
null, //width
null, //focusCB
null); //blurCB
};
bobj.crv.Calendar._createOKCancelButtons = function() {
var bind = MochiKit.Base.bind;
this._okBtn = newButtonWidget(this.id + "_ok", L_bobj_crv_OK, bind(this._onOKClick, this));
this._cancelBtn = newButtonWidget(this.id + "_cancel", L_bobj_crv_Cancel, bind(this._onCancelClick, this));
};
/**
* Widget will auto-initialize the first time its show method is called.
* Client code shoud not call this method.
*/
bobj.crv.Calendar.justInTimeInit = function() {
this._menuJustInTimeInit();
this._prevMonthBtn.init();
this._prevYearBtn.init();
this._nextMonthBtn.init();
this._nextYearBtn.init();
this._okBtn.init();
this._cancelBtn.init();
this._timeField.init();
this._timeField.layer.style.width = '100%';
this._timeField.setValue(bobj.external.date.formatDate(this.date, this._curTimeFormat));
this._timeRow = getLayer(this.id + '_timeRow');
this._timeSep = getLayer(this.id + '_timeSep');
this._month = getLayer(this.id + "_month");
this._year = getLayer(this.id + "_year");
var numCells = 6 * 7; // six rows in the calendar with 7 days each
for (var i = 0; i < numCells; i++) {
this._cells[i] = getLayer(this.id + '_c' + i);
}
this._update();
};
/**
* Widget will be written into the document the first time its show method is called.
* Client code shoud not call this method.
*/
bobj.crv.Calendar.getHTML = function() {
var h = bobj.html;
var TABLE = h.TABLE;
var TBODY = h.TBODY;
var TR = h.TR;
var TD = h.TD;
var DIV = h.DIV;
var SPAN = h.SPAN;
var A = h.A;
this._createHeaderButtons();
this._createTimeTextField();
this._createOKCancelButtons();
var onkeydown = "MenuWidget_keyDown('" + this.id + "', event); return true";
var onmousedown = "eventCancelBubble(event)";
var onmouseup = "eventCancelBubble(event)";
var onkeypress = "eventCancelBubble(event)";
var dayHeaderAtt = {'class':"calendarTextPart"};
var html = TABLE({dir: 'ltr', id: this.id, border:"0", cellpadding:"0", cellspacing:"0",
onkeydown: onkeydown, onmousedown: onmousedown, onmouseup: onmouseup, onkeypress: onkeypress,
'class':"menuFrame", style:{cursor:"default", visibility:"hidden",'z-index': 10000}},
TBODY(null,
TR(null, TD(null, this._getMonthYearHTML())),
TR(null, TD({align:"center"},
TABLE({border:"0", cellspacing:"0", cellpadding:"0", style:{margin:"2px", 'margin-top': "6px"}},
TR({align:"center"},
TD(dayHeaderAtt, L_bobj_crv_SundayShort),
TD(dayHeaderAtt, L_bobj_crv_MondayShort),
TD(dayHeaderAtt, L_bobj_crv_TuesdayShort),
TD(dayHeaderAtt, L_bobj_crv_WednesdayShort),
TD(dayHeaderAtt, L_bobj_crv_ThursdayShort),
TD(dayHeaderAtt, L_bobj_crv_FridayShort),
TD(dayHeaderAtt, L_bobj_crv_SaturdayShort)),
TR(null, TD({colspan:"7", style:{padding:"2px"}}, this._getSeparatorHTML())),
this._getDaysHTML(),
TR(null, TD({colspan:"7", style:{padding:"2px"}}, this._getSeparatorHTML())),
TR({id:this.id + '_timeRow', style:{display:this.showTime ? '' : 'none'}},
TD({colspan:"7", style:{'padding-top':"3px", 'padding-bottom':"3px", 'padding-right':"10px", 'padding-left':"10px"}},
this._timeField.getHTML())),
TR({id:this.id + '_timeSep',style:{display:this.showTime ? '' : 'none'}},
TD({colspan:"7", style:{padding:"2px"}}, this._getSeparatorHTML())),
TR(null, TD({colspan:"7", align:"right", style:{'padding-bottom':"3px", 'padding-top':"3px"}},
TABLE(null, TBODY(null, TR(null,
TD(null, this._okBtn.getHTML()),
TD(null, this._cancelBtn.getHTML())))))))))));
return this._getLinkHTML('startLink_' + this.id) + html + this._getLinkHTML('endLink_' + this.id);
};
bobj.crv.Calendar._getMonthYearHTML = function() {
var h = bobj.html;
var TABLE = h.TABLE;
var TBODY = h.TBODY;
var TR = h.TR;
var TD = h.TD;
var DIV = h.DIV;
var SPAN = h.SPAN;
return TABLE({'class':"dialogzone", width:"100%", cellpadding:"0", cellspacing:"0"},
TBODY(null,
TR(null,
TD({style:{'padding-top':"1px"}}, this._nextMonthBtn.getHTML()),
TD({rowspan:"2", width:"100%", align:"center", 'class':"dialogzone"},
SPAN({id:this.id + "_month", tabIndex:"0"}, _month[this.date.getMonth()]),
"&nbsp;&nbsp;",
SPAN({id:this.id + "_year", tabIndex:"0"}, this.date.getFullYear())),
TD({style:{'pading-top':"1px"}}, this._nextYearBtn.getHTML())),
TR({valign:"top"},
TD({style:{'padding-bottom':"1px"}}, this._prevMonthBtn.getHTML()),
TD({style:{'padding-bottom':"1px"}}, this._prevYearBtn.getHTML()))));
};
bobj.crv.Calendar._getSeparatorHTML = function() {
var h = bobj.html;
var TABLE = h.TABLE;
var TBODY = h.TBODY;
var TR = h.TR;
var TD = h.TD;
return TABLE({width:"100%",
height:"3",
cellpadding:"0",
cellspacing:"0",
border:"0",
style:backImgOffset(_skin+"menus.gif",0,80)},
TBODY(null, TR(null, TD())));
};
bobj.crv.Calendar._getLinkHTML = function(id) {
return bobj.html.A({
id: id,
href: "javascript:void(0)",
onfocus: "MenuWidget_keepFocus('"+this.id+"')",
style:{
visibility:"hidden",
position:"absolute"
}});
};
bobj.crv.Calendar._getDaysHTML = function() {
var TD = bobj.html.TD;
var DIV = bobj.html.DIV;
var html = '';
for (i = 0; i < 6; ++i) {
html += '<tr align="right">';
for (j = 0; j < 7; ++j) {
var cellNum = j + (i * 7);
var eventArgs = "(this," + cellNum + "," + "event);";
html += TD({id: this.id + '_c' + (i * 7 + j),
'class':"calendarTextPart",
onmousedown: "bobj.crv.Calendar._onDayMouseDown" + eventArgs,
onmouseover: "bobj.crv.Calendar._onDayMouseOver" + eventArgs,
onmouseout: "bobj.crv.Calendar._onDayMouseOut" + eventArgs,
ondblclick: "bobj.crv.Calendar._onDayDoubleClick" + eventArgs,
onkeydown: "bobj.crv.Calendar._onDayKeyDown" + eventArgs},
DIV({'class':"menuCalendar"}));
}
html += '</tr>';
}
return html;
};
/**
* Update the calendar's display using the current date value
*/
bobj.crv.Calendar._update = function() {
var numCells = 6 * 7; // six rows in the calendar with 7 days each
var curDate = this.date.getDate();
var info = this._getMonthInfo(this.date.getMonth(), this.date.getFullYear());
var firstCellInMonth = info.firstDay;
this._firstDay = info.firstDay;
this._numDays = info.numDays;
var year = "" + this.date.getFullYear();
while (year.length < 4) {
year = "0" + year;
}
this._year.innerHTML = year;
this._month.innerHTML = _month[this.date.getMonth()];
this._selectedDate = null;
for (var cellNum = 0; cellNum < numCells; cellNum++) {
var cell = this._cells[cellNum].firstChild;
var cssClass = "menuCalendar";
var cellDate = this._getDateFromCellNum(cellNum);
if (cellDate < 1 || cellDate > info.numDays) {
cell.innerHTML = "";
cell.tabIndex = "-1";
}
else {
cell.innerHTML = "" + cellDate;
cell.tabIndex = "0";
if (cellDate == curDate) {
cssClass = "menuCalendarSel";
this._selectedDay = cell;
}
}
cell.className = cssClass;
}
};
bobj.crv.Calendar._getMonthInfo = function(month, year) {
var date = new Date();
date.setDate(1);
date.setFullYear(year);
date.setMonth(month);
var firstDay = date.getDay(); // First day of the week in this month
date.setDate(28);
var lastDate = 28; // Last date in this month
for (var i = 29; i < 32; i++) {
date.setDate(i);
if (date.getMonth() != month) {
break;
}
lastDate = i;
}
return {firstDay: firstDay, numDays: lastDate};
};
bobj.crv.Calendar._setDayOfMonth = function(date) {
if (date > 0 && date <= this._numDays) {
var prevDate = this.date.getDate();
if (date != prevDate) {
var prevCell = this._getCellFromDate(prevDate);
if (prevCell) {
prevCell.firstChild.className = "menuCalendar";
}
this._getCellFromDate(date).firstChild.className = "menuCalendarSel";
this.date.setDate(date);
}
}
};
bobj.crv.Calendar._getCellFromDate = function(date) {
var cellNum = date + this._firstDay - 1;
return this._cells[cellNum];
};
bobj.crv.Calendar._getDateFromCellNum = function(cellNum) {
return cellNum - this._firstDay + 1;
};
bobj.crv.Calendar._onDayMouseOver = function(node, cellNum, event) {
var o = getWidget(node);
var div = node.firstChild;
var date = cellNum - o._firstDay + 1;
if (date < 1 || date > o._numDays) {
div.className = "menuCalendar";
}
else {
div.className = "menuCalendarSel";
}
};
bobj.crv.Calendar._onDayMouseOut = function(node, cellNum, event) {
var o = getWidget(node);
var div = node.firstChild;
var date = cellNum - o._firstDay + 1;
if (date != o.date.getDate()) {
div.className = "menuCalendar";
}
};
bobj.crv.Calendar._onDayMouseDown = function(node, cellNum, event) {
var o = getWidget(node);
var date = cellNum - o._firstDay + 1;
o._setDayOfMonth(date);
};
bobj.crv.Calendar._onDayDoubleClick = function(node, cellNum, event) {
var o = getWidget(node);
o._onOKClick();
};
bobj.crv.Calendar._onDayKeyDown = function(node, cellNum, event) {
event = new MochiKit.Signal.Event(node, event);
var key = event.key().string;
if (key === "KEY_ENTER") {
var o = getWidget(node);
var date = cellNum - o._firstDay + 1;
o._setDayOfMonth(date);
}
};
bobj.crv.Calendar._onPrevMonthClick = function() {
var d = this.date;
var oldMonth = d.getMonth();
if(d.getMonth() === 0) {
d.setYear(d.getFullYear() -1);
d.setMonth(11);
}
else {
d.setMonth(d.getMonth() - 1);
if (oldMonth === d.getMonth()) {
// that means we have decremented 0 month instead of 1. This happens if the current date is Oct 31, for eg. Since there's no Sept 31, it jumps to October 1.
d.setMonth(oldMonth-1);
}
}
this._update();
};
bobj.crv.Calendar._onPrevYearClick = function() {
this.date.setFullYear(this.date.getFullYear() - 1);
this._update();
};
bobj.crv.Calendar._onNextMonthClick = function() {
var d = this.date;
var oldMonth = d.getMonth();
d.setMonth(d.getMonth() + 1);
if ((oldMonth+1) < d.getMonth()) {
// that means we have incremented 2 months instead of 1. This happens if the current date is Oct 31, for eg. Since there's no Nov 31, it jumps to Dec 1.
// For Dec 31, we don't need to worry because there's Jan 31.
d.setMonth(oldMonth+1);
}
this._update();
};
bobj.crv.Calendar._onNextYearClick = function() {
this.date.setFullYear(this.date.getFullYear() + 1);
this._update();
};
bobj.crv.Calendar._onOKClick = function() {
this.restoreFocus();
MochiKit.Signal.signal(this, this.Signals.OK_CLICK, this._copyDate(this.date));
this.show(false);
};
bobj.crv.Calendar._copyDate = function(date) {
if (date) {
return new Date(date.getFullYear(),
date.getMonth(),
date.getDate(),
date.getHours(),
date.getMinutes(),
date.getSeconds(),
date.getMilliseconds());
}
return new Date();
};
bobj.crv.Calendar._onCancelClick = function() {
this.restoreFocus();
this.show(false);
MochiKit.Signal.signal(this, this.Signals.CANCEL_CLICK);
};
bobj.crv.Calendar._onTimeChange = function() {
var text = this._timeField.getValue();
var date = null;
var format = null;
for (var i = 0; i < this.timeFormats.length && date === null; ++i) {
format = this.timeFormats[i];
date = bobj.external.date.getDateFromFormat(text, format);
}
if (date) {
this._curTimeFormat = format;
this.date.setHours(date.getHours());
this.date.setMinutes(date.getMinutes());
this.date.setSeconds(date.getSeconds());
this.date.setMilliseconds(date.getMilliseconds());
}
else {
this._timeField.setValue(bobj.external.date.formatDate(this.date, this._curTimeFormat));
}
};
bobj.crv.Calendar.setShowTime = function(isShow) {
var disp = isShow ? '' : 'none';
this.showTime = isShow;
if (this.layer) {
this._timeRow.style.display = disp;
this._timeSep.style.display = disp;
}
};
bobj.crv.Calendar.setDate = function(date) {
this.date = date;
if (this.layer) {
this._timeField.setValue(bobj.external.date.formatDate(this.date, this._curTimeFormat));
this._update();
}
};
/**
* Show the calendar. Will write out the HTML and init the widget also.
*
* @param isShow [bool] Show calendar if true. Hide it if false.
* @param x [int] x coordinate for left of calendar
* @param y [int] y coordinate for top of calendar
* @param isAlignRight [bool, optional] When true, the x coordinate applies to
* the right edge of the calendar
* @param isAlignBottom [bool, optional] When true, the y coordinate applies to
* the bottom edge of the calendar
*/
bobj.crv.Calendar.show = function(isShow, x, y, isAlignRight, isAlignBottom) {
ScrollMenuWidget_show.call(this, isShow, x, y);
if(isShow) {
this.focus();
}
else {
MochiKit.Signal.signal(this, this.Signals.ON_HIDE);
}
};
/**
* Set focus on the Calendar. The currently selected day will receive focus.
*/
bobj.crv.Calendar.focus = function() {
if (this._selectedDay) {
this._selectedDay.focus();
}
};

View File

@@ -0,0 +1,8 @@
if (typeof bobj == 'undefined') {
bobj = {};
};
bobj.Colors = {
BLACK :'#000000',
GRAY :'#a5a5a5'
};

View File

@@ -0,0 +1,930 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
if (typeof bobj.crv.PrintUI == 'undefined') {
bobj.crv.PrintUI = {};
}
if (typeof bobj.crv.ExportUI == 'undefined') {
bobj.crv.ExportUI = {};
}
if (typeof bobj.crv.ErrorDialog == 'undefined') {
bobj.crv.ErrorDialog = {};
}
if (typeof bobj.crv.ReportProcessingUI == 'undefined') {
bobj.crv.ReportProcessingUI = {};
}
/*
================================================================================
PrintUI
================================================================================
*/
bobj.crv.newPrintUI = function(kwArgs) {
if (!kwArgs.id) {
kwArgs = MochiKit.Base.update({id: bobj.uniqueId()}, kwArgs);
}
var lbl = kwArgs.submitBtnLabel;
if (!lbl) {
lbl = L_bobj_crv_submitBtnLbl;
}
var infoTitle = kwArgs.infoTitle;
if (!infoTitle) {
infoTitle = L_bobj_crv_PrintInfoTitle;
}
var dialogTitle = kwArgs.dialogTitle;
if (!dialogTitle) {
if (kwArgs.isActxPrinting) {
dialogTitle = L_bobj_crv_ActiveXPrintDialogTitle;
}
else {
dialogTitle = L_bobj_crv_PDFPrintDialogTitle;
}
}
var infoMsg = kwArgs.infoMsg;
if (!infoMsg) {
infoMsg = L_bobj_crv_PrintInfo1;
infoMsg += '\n';
infoMsg += L_bobj_crv_PrintInfo2;
}
var o = newDialogBoxWidget(kwArgs.id + '_dialog',
dialogTitle,
300,
100,
null,
bobj.crv.PrintUI._cancel,
false);
o.infoMsg = infoMsg;
o.infoTitle = infoTitle;
o.actxId = o.id + '_actx';
o.actxContainerId = o.id + '_actxdiv';
o._processingPrinting = false;
o._initOld = o.init;
o._showOld = o.show;
if (!kwArgs.isActxPrinting) {
o._fromBox = newIntFieldWidget(o.id + "_fromBox",
null,
null,
null,
null,
true,
'',
50);
o._fromBox.setDisabled = bobj.crv.PrintUI.disabledTextFieldWidget;
o._toBox = newIntFieldWidget(o.id + "_toBox",
null,
null,
null,
null,
true,
'',
50);
o._toBox.setDisabled = bobj.crv.PrintUI.disabledTextFieldWidget;
o._submitBtn = newButtonWidget(o.id + "_submitBtn",
lbl,
MochiKit.Base.bind(bobj.crv.PrintUI._submitBtnCB, o));
o._submitBtn.setDelayCallback(false);
o._allRadio = newRadioWidget(o.id + "_allRadio",
o.id + "_grp",
L_bobj_crv_PrintAllLbl,
MochiKit.Base.bind(bobj.crv.PrintUI.disabledPageRange ,o, true));
o._allRadio.layerClass= "dlgContent";
o._rangeRadio = newRadioWidget(o.id + "_rangeRadio",
o.id + "_grp",
L_bobj_crv_PrintPagesLbl,
MochiKit.Base.bind(bobj.crv.PrintUI.disabledPageRange ,o, false));
o._rangeRadio.layerClass= "dlgContent";
}
o.widgetType = 'PrintUI';
// Update instance with constructor arguments
bobj.fillIn(o, kwArgs);
// Update instance with member functions
MochiKit.Base.update(o, bobj.crv.PrintUI);
return o;
};
bobj.crv.PrintUI.disabledTextFieldWidget = function(disabled)
{
TextFieldWidget_setDisabled.call(this,disabled);
if(disabled)
{
MochiKit.DOM.addElementClass(this.layer, "textDisabled");
}
else {
MochiKit.DOM.removeElementClass(this.layer, "textDisabled");
}
}
bobj.crv.PrintUI.disabledPageRange = function(bool)
{
if(this._fromBox && this._toBox)
{
this._fromBox.setDisabled(bool);
this._toBox.setDisabled(bool);
}
}
bobj.crv.PrintUI._submitBtnCB = function() {
var start = null;
var end = null;
if (this._rangeRadio.isChecked()) {
start = parseInt(this._fromBox.getValue(), 10);
end = parseInt(this._toBox.getValue(), 10);
if (!start || !end || (start < 0) || (start > end)) {
alert(L_bobj_crv_PrintPageRangeError);
return;
}
}
if (this.widgetType == 'PrintUI') {
MochiKit.Signal.signal(this, 'printSubmitted', start, end);
}
else {
MochiKit.Signal.signal(this, 'exportSubmitted', start, end, this._comboBox.getSelection().value);
}
this.show(false);
};
bobj.crv.PrintUI._getRPSafeURL = function(url) {
if (!url) {
return;
}
if (url.indexOf('/') === 0) {
return url;
}
var winLoc = window.location.href;
var qPos = winLoc.lastIndexOf('?');
if (qPos > 0) {
winLoc = winLoc.substring(0, qPos)
}
var lPos = winLoc.lastIndexOf('/');
if (lPos < 0) {
return url;
}
winLoc = winLoc.substring(0, lPos);
return winLoc + '/' + url;
};
bobj.crv.PrintUI._getObjectTag = function(postData) {
var oa = [];
oa.push('<OBJECT width="0" height="0" ID="');
oa.push(this.actxId);
oa.push('" CLASSID="CLSID:');
oa.push(bobj.crv.ActxPrintControl_CLSID);
oa.push('" CODEBASE="');
oa.push(this._getRPSafeURL(this.codeBase));
oa.push('#Version=');
oa.push(bobj.crv.ActxPrintControl_Version);
oa.push('" VIEWASTEXT>');
oa.push('<PARAM NAME="PostBackData" VALUE="');
oa.push(postData);
oa.push('">');
oa.push('<PARAM NAME="ServerResourceVersion" VALUE="');
oa.push(bobj.crv.ActxPrintControl_Version);
oa.push('">');
if (this.lcid) {
oa.push('<PARAM NAME="LocaleID" VALUE="');
oa.push(this.lcid);
oa.push('">');
}
if (this.url) {
oa.push('<PARAM NAME="URL" VALUE="');
oa.push(this._getRPSafeURL(this.url));
oa.push('">');
}
if (this.title) {
oa.push('<PARAM NAME="Title" VALUE="');
oa.push(this.title);
oa.push('">');
}
if (this.maxPage) {
oa.push('<PARAM NAME="MaxPageNumber" VALUE="');
oa.push(this.maxPage);
oa.push('">');
}
if (this.paperOrientation) {
oa.push('<PARAM NAME="PageOrientation" VALUE="');
oa.push(this.paperOrientation);
oa.push('">');
}
if (this.paperSize) {
oa.push('<PARAM NAME="PaperSize" VALUE="');
oa.push(this.paperSize);
oa.push('">');
}
if (this.paperWidth) {
oa.push('<PARAM NAME="PaperWidth" VALUE="');
oa.push(this.paperWidth);
oa.push('">');
}
if (this.paperLength) {
oa.push('<PARAM NAME="PaperLength" VALUE="');
oa.push(this.paperLength);
oa.push('">');
}
if (this.driverName) {
oa.push('<PARAM NAME="PrinterDriverName" VALUE="');
oa.push(this.driverName);
oa.push('">');
}
if (this.useDefPrinter) {
oa.push('<PARAM NAME="UseDefaultPrinter" VALUE="');
oa.push(this.useDefPrinter);
oa.push('">');
}
if (this.useDefPrinterSettings) {
oa.push('<PARAM NAME="UseDefaultPrinterSettings" VALUE="');
oa.push(this.useDefPrinterSettings);
oa.push('">');
}
if (this.sendPostDataOnce) {
oa.push('<PARAM NAME="SendPostDataOnce" VALUE="');
oa.push(this.sendPostDataOnce);
oa.push('">');
}
oa.push('</OBJECT>');
// Add waiting UI while the control is loading
oa.push('<table id="')
oa.push(this.actxId);
oa.push('_wait" border="0" cellspacing="0" cellpadding="0" width="100%" ><tbody>');
oa.push('<tr><td align="center" valign="top">');
// Frame Zone
var o = this;
var zoneW=o.getContainerWidth()-10;
var zoneH=o.getContainerHeight()-(2*o.pad+21+10);
oa.push('<table style="');
oa.push(sty("width",zoneW));
oa.push(sty("height",zoneH));
oa.push('" id="frame_table_');
oa.push(o.id);
oa.push('" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" class="dlgFrame" style="padding:5px" id="frame_cont_');
oa.push(o.id);
oa.push('">');
oa.push('<table border="0" cellspacing="0" cellpadding="0" width="100%"><tbody>');
oa.push('<tr><td align="center" style="padding-top:5px;">');
oa.push(img(_skin+'wait01.gif',200,40));
oa.push('</td></tr>');
oa.push('<tr><td align="left" style="padding-left:2px;padding-right:2px;padding-top:5px;">');
oa.push('<div class="icontext" style="wordWrap:break_word;">');
oa.push(convStr(L_bobj_crv_PrintControlProcessingMessage,false,true));
oa.push('</div></td></tr></tbody></table>');
oa.push('</td></tr></tbody></table>');
oa.push('</td></tr></tbody></table>');
return oa.join('');
};
bobj.crv.PrintUI._cancel = function () {
if (this.isActxPrinting) {
document.getElementById(this.actxContainerId).innerHTML = '';
this._processingPrinting = false;
}
};
bobj.crv.PrintUI._processPrinting = function(){
if (!this._processingPrinting){
var o = document.getElementById(this.actxId);
var w = document.getElementById(this.actxId + '_wait');
if (o && w){
o.width = "100%";
o.height = "100%";
w.style.display="none";
}
this._processingPrinting = true;
}
};
bobj.crv.PrintUI.show = function(visible, postBackData) {
this._processingPrinting = false;
if (visible) {
if (!this.layer) {
targetApp(this.getHTML());
this.init();
}
if (this.isActxPrinting) {
document.getElementById(this.actxContainerId).innerHTML = this._getObjectTag(postBackData);
}
this._showOld(true);
}
else if (this.layer) {
this._showOld(false);
}
};
bobj.crv.PrintUI.init = function() {
this._initOld();
if (!this.isActxPrinting) {
this._fromBox.init();
this._toBox.init();
this._submitBtn.init();
this._allRadio.init();
this._rangeRadio.init();
this._allRadio.check(true);
this._toBox.setDisabled(true);
this._fromBox.setDisabled(true);
if (this.widgetType == 'ExportUI') {
this._updateExportList();
}
}
};
bobj.crv.PrintUI.getHTML = function(){
var h = bobj.html;
var o = this;
var html = o.beginHTML();
if (!this.isActxPrinting) {
html += "<table cellspacing=0 cellpadding=0 border=0>" +
"<tr>" +
"<td>" +
"<div class='dlgFrame'>" +
"<table cellspacing=0 cellpadding=0 border=0 style='height:" + (this.height * 0.9) +"px;width:" + this.width + "px;'>" +
"<tr>" +
"<td valign='top' class='naviBarFrame naviFrame'>" +
(this.isExporting ? this._getExportList() : "") +
"<fieldset style='border:0px;padding:0px'>" +
"<legend style='position:relative;"+(_ie?"margin:0px -7px":"")+"'>" +
"<table datatable='0' style='width:100%;line-height:10px;'>" +
"<tr>" +
(_ie?"<td class='dialogTitleLevel2'><label>":"<td class='dialogTitleLevel2'><label>") +
L_bobj_crv_PrintRangeLbl + "</label></td>" +
"</tr>" +
"</table>" +
"</legend>" +
"<div style='margin:10px 25px;'>" +
o._allRadio.getHTML() +
o._rangeRadio.getHTML() +
"<div style='padding-left:25px'>" +
"<table class=dlgContent datatable='0'>" +
"<tr>" +
"<td align=right>" +
"<label for='" + o._fromBox.id + "'> " + L_bobj_crv_PrintFromLbl + "</label>" +
"</td>" +
"<td align=left> " +
o._fromBox.getHTML() +
"</td>" +
"</tr>" +
"<tr>" +
"<td align=right>" +
"<label for='" + o._toBox.id + "'> " + L_bobj_crv_PrintToLbl + "</label>" +
"</td>" +
"<td align=left>" +
o._toBox.getHTML() +
"</td>" +
"</tr>" +
"</table>" +
"</div>" +
"</div>" +
"</fieldset>" +
(!this.isExporting ?
"<table style='width:100%;line-height:10px;'>" +
"<tr>" +
"<td class='dialogTitleLevel2' tabIndex=0><label>" + this.infoTitle + "</label></td>" +
"</tr>" +
"</table>" +
"<div style='margin:10px 0px 10px 25px;' class='dlgHelpText'>" +
this.infoMsg +
"</div>"
: '') +
"</td>" +
"</tr>" +
"</table>" +
"</div>" +
"</td>" +
"</tr>" +
"<tr>" +
"<td align='right' valign='top'>" +
"<table style='margin:6px 9px 0px 0px' cellspacing=0 cellpadding=0 border=0><tbody><tr>" +
"<td>" +
this._submitBtn.getHTML() +
"</td></tbody></tr>" +
"</table>" +
"</td>" +
"</tr>" +
"</table>";
}
else {
html += "<div id='" + this.actxContainerId + "'></div>" +
'<script for="' + this.actxId + '" EVENT="Finished(status, statusText)" language="javascript">' +
'getWidgetFromID("' + this.id + '").show(false);' +
'</script>' +
'<script for="' + this.actxId + '" EVENT="PrintingProgress(pageNumber)" language="javascript">' +
'getWidgetFromID("' + this.id + '")._processPrinting();' +
'</script>' ;
}
html += o.endHTML();
html += bobj.crv.getInitHTML(this.widx);
return html;
};
/*
================================================================================
ExportUI
================================================================================
*/
bobj.crv.newExportUI = function(kwArgs) {
kwArgs = MochiKit.Base.update({ submitBtnLabel:L_bobj_crv_ExportBtnLbl,
dialogTitle:L_bobj_crv_ExportDialogTitle,
infoTitle:L_bobj_crv_ExportInfoTitle,
infoMsg:L_bobj_crv_PrintInfo1,
isExporting:true}, kwArgs);
var o = bobj.crv.newPrintUI(kwArgs);
o._comboBox = newCustomCombo(
o.id + "_combo",
MochiKit.Base.bind(bobj.crv.ExportUI._onSelectFormat, o),
false,
270,
L_bobj_crv_ExportFormatLbl,
_skin + "../transp.gif", // Screen reader can't read its text without transp.gif
0,
14);
//Adjustment to combo box after adding transp.gif as icon
if(o._comboBox) {
o._comboBox.icon.border=0;
o._comboBox.icon.h=14;
o._comboBox.arrow.h=12;
o._comboBox.arrow.dy+=2
o._comboBox.arrow.disDy+=2
}
o.widgetType = 'ExportUI';
MochiKit.Base.update(o, bobj.crv.ExportUI);
return o;
};
bobj.crv.ExportUI._onSelectFormat = function() {
var format = this._comboBox.getSelection().value;
if (format == 'CrystalReports' || format == 'RPTR' || format == 'RecordToMSExcel' || format == 'RecordToMSExcel2007' || format == 'CharacterSeparatedValues' || format == 'XML') {
this._fromBox.setDisabled(true);
this._toBox.setDisabled(true);
this._rangeRadio.check(false);
this._rangeRadio.setDisabled(true);
this._allRadio.check(true);
}
else {
this._rangeRadio.setDisabled(false);
}
};
bobj.crv.ExportUI.update = function (update) {
if (!update || update.cons !== "bobj.crv.newExportUI") {
return;
}
this.availableFormats = update.args.availableFormats;
if(this._comboBox.initialized()) {
/*
* Uninitialized combobox is not required to be updated as it will
* be updated during initialization
*/
this._updateExportList();
}
};
bobj.crv.ExportUI._updateExportList = function() {
if(!this._comboBox.initialized()) {
this._comboBox.init();
}
this._updateComboItems();
var item0 = this._comboBox.getItemByIndex(0);
if(item0 != null)
this._comboBox.selectItem(item0);
this._onSelectFormat();
};
bobj.crv.ExportUI._updateComboItems = function () {
this._comboBox.removeAllMenuItems();
var itemsCount = (bobj.isArray(this.availableFormats) ? this.availableFormats.length : 0);
for (var i = 0; i < itemsCount; i++) {
var item = this.availableFormats[i];
this._comboBox.add(item.name, item.value, item.isSelected);
}
};
bobj.crv.ExportUI._getExportList = function() {
return "<table datatable='0' style='width:100%;line-height:10px;'>" +
"<tr>" +
(_ie?"<td class='dialogTitleLevel2'><label>":"<td class='dialogTitleLevel2'><label>") +
L_bobj_crv_ExportFormatLbl + "</label></td>" +
"</tr>" +
"</table>" +
"<div style='margin:10px 25px;'>" +
this._comboBox.getHTML() +
"</div>";
};
/*
================================================================================
ErrorDialog
TODO Dave: If time permits, make dialog resizable with mouse
================================================================================
*/
/**
* Static function.
* @returns [ErrorDialog] Returns a shared Error Dialog
*/
bobj.crv.ErrorDialog.getInstance = function() {
if (!bobj.crv.ErrorDialog.__instance) {
bobj.crv.ErrorDialog.__instance = bobj.crv.newErrorDialog();
}
return bobj.crv.ErrorDialog.__instance;
};
bobj.crv.newErrorDialog = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId(),
title: L_bobj_crv_Error,
text: null,
detailText: null,
okLabel: L_bobj_crv_OK,
promptType: _promptDlgCritical
}, kwArgs);
var o = newPromptDialog(
kwArgs.id,
kwArgs.title,
kwArgs.text,
kwArgs.okLabel,
null, // cancelLabel
kwArgs.promptType,
null, // yesCB
null, // noCB,
true, // noCloseButton
true); // isAlert
o.widgetType = 'ErrorDialog';
// Update instance with constructor arguments
bobj.fillIn(o, kwArgs);
// Update instance with member functions
o._promptDlgInit = o.init;
o._promptDialogSetText = o.setText;
o._promptDialogShow = o.show;
o._promptDialogSetTitle = o.setTitle;
o._promptDialogSetPromptType = o.setPromptType;
MochiKit.Base.update(o, bobj.crv.ErrorDialog);
o.noCB = MochiKit.Base.bind(o._onClose, o);
o.yesCB = o.noCB;
o._detailBtn = newIconWidget(
o.id + "_detailBtn",
bobj.skinUri('../help.gif'),
MochiKit.Base.bind(bobj.crv.ErrorDialog._onDetailBtnClick, o),
L_bobj_crv_showDetails, // Text
L_bobj_crv_showDetails, // Tooltip
16,16,0,0,22,0,
true); // Tabbing is enabled
return o;
};
bobj.crv.ErrorDialog.init = function() {
this._promptDlgInit();
this._detailBtn.init();
this._detailRow = document.getElementById(this.id + '_detRow');
this._detailArea = document.getElementById(this.id + '_detArea');
if (!this.detailText) {
this._detailBtn.show(false);
}
};
bobj.crv.ErrorDialog.getHTML = function() {
var TABLE = bobj.html.TABLE;
var TBODY = bobj.html.TBODY;
var TR = bobj.html.TR;
var TD = bobj.html.TD;
var PRE = bobj.html.PRE;
var DIV = bobj.html.DIV;
var imgPath = PromptDialog_getimgPath(this.promptType);
var imgAlt = PromptDialog_getimgAlt(this.promptType);
var width = "320";
var detailWidth = "300px";
var detailHeight = "100px";
var contentHTML =
TABLE({'class':"dlgBody", width: width, cellpadding:"0", cellspacing:"5", border:"0"},
TBODY(null,
TR(null, TD(null,
TABLE({'class':"dlgBody", cellpadding:"5", cellspacing:"0", border:"0"},
TBODY(null,
TR(null,
TD({align:"right", width:"32"},
img(imgPath, 32, 32, null, 'id="dlg_img_' + this.id + '"', imgAlt)),
TD(),
TD({id:"dlg_txt_" + this.id, align:"left"},
DIV({tabindex:"0"}, convStr(this.text, false, true)))))))),
TR({id: this.id + '_detRow', style: {display: "none"}},
TD(null, DIV({'class': "infozone", style: {width: detailWidth, 'height': detailHeight, overflow: "auto"}},
PRE({id: this.id + '_detArea'}, this.detailText)))),
TR(null, TD(null, getSep())),
TR(null, TD(null,
TABLE({cellpadding:"5", cellspacing:"0", border:"0", width:"100%"},
TBODY(null,
TR(null,
TD({align:"left"}, this._detailBtn.getHTML()),
TD({align:"right"}, this.yes.getHTML()))))))));
return this.beginHTML() + contentHTML + this.endHTML();
};
/**
* Set the error message and detail text.
*
* @param text [String] Error message
* @param detailText [String] Detailed error message or technical info
*/
bobj.crv.ErrorDialog.setText = function (text, detailText) {
this.text = text;
this.detailText = detailText;
if (this.layer) {
this._promptDialogSetText(text || '');
if (this._detailArea) {
this._detailArea.innerHTML = detailText || '';
}
var showDetails = detailText ? true : false;
this._detailBtn.show(showDetails);
if (!showDetails) {
this.showDetails(false);
}
}
};
bobj.crv.ErrorDialog.setTitle = function (title) {
this.title = title;
if (this.layer) {
this._promptDialogSetTitle(title || '');
}
};
bobj.crv.ErrorDialog.setPromptType = function (promptType) {
this.promptType = promptType;
if (this.layer) {
this._promptDialogSetPromptType(promptType);
}
};
/**
* Show/Hide the dialog
*
* @param isShow [bool(=true)] True value displays the dialog, false hides it.
* @param closeCB [function] Callback to call after the next close event
*/
bobj.crv.ErrorDialog.show = function(isShow, closeCB) {
if (typeof isShow == 'undefined') {
isShow = true;
}
if (isShow) {
this._closeCB = closeCB;
if (!this.layer) {
targetApp(this.getHTML());
this.init();
}
this.layer.onkeyup = DialogBoxWidget_keypress;
DialogBoxWidget_keypress = MochiKit.Base.noop;
this._promptDialogShow(true);
}
else if (this.layer){
this._closeCB = null;
this._promptDialogShow(false);
}
};
/**
* Show/Hide the detailed error message
*
* @param isShow [bool(=true)] True value displays the details, false hides them.
*/
bobj.crv.ErrorDialog.showDetails = function(isShow) {
if (typeof isShow == 'undefined') {
isShow = true;
}
if (this._detailRow && this._detailBtn) {
if (isShow) {
this._detailRow.style.display = '';
this._detailBtn.changeText(L_bobj_crv_hideDetails);
}
else {
this._detailRow.style.display = 'none';
this._detailBtn.changeText(L_bobj_crv_showDetails);
}
}
};
/**
* Private. Handles detail button clicks.
*/
bobj.crv.ErrorDialog._onDetailBtnClick = function() {
if (this._detailRow) {
this.showDetails(this._detailRow.style.display == 'none');
}
};
/**
* Private. Notifies listener that dialog has closed;
*/
bobj.crv.ErrorDialog._onClose = function() {
if (this._closeCB) {
this._closeCB();
this._closeCB = null;
}
DialogBoxWidget_keypress = this.layer.onkeyup;
this.layer.onkeyup = null;
};
/*
================================================================================
Report Processing Dialog
================================================================================
kwArgs
delay - the wait time prior to showing the dialog.
message - a customized message to display in the dialog.
*/
bobj.crv.newReportProcessingUI = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId(),
delay: 250,
message: L_bobj_crv_ReportProcessingMessage
}, kwArgs);
/* Since JSON escapes the '\' in unicode character references (\uXXXX) in Viewer
* process indicator text is converted to html numeric referece (&#ddddd) which Javascript
* don't display as expected. Little hack here to it as HTML string */
var d = document.createElement('div');
d.style.visibility = 'hidden';
d.innerHTML = kwArgs.message;
var newMsg = d.innerHTML;
d = null;
var o = newWaitDialogBoxWidget(
kwArgs.id, // id
0, // width
0, // height
'', // title
false, // show cancel
bobj.crv.ReportProcessingUI.cancelCB, // cancel callback
true, // show label
newMsg, // label text
true // no close button
);
o.widgetType = 'ReportProcessingUI';
o.delay = kwArgs.delay;
// Update instance with member functions
MochiKit.Base.update(o, bobj.crv.ReportProcessingUI);
return o;
};
bobj.crv.reportProcessingDialog = null;
bobj.crv.timerID = null;
bobj.crv.ReportProcessingUI.cancelCB = function ()
{
bobj.crv.reportProcessingDialog.cancelled = true;
if (bobj.crv.reportProcessingDialog.deferred !== null) {
bobj.crv.reportProcessingDialog.deferred.cancel ();
}
bobj.crv.reportProcessingDialog.cancelShow ();
};
bobj.crv.ReportProcessingUI.wasCancelled = function ()
{
return bobj.crv.reportProcessingDialog.cancelled;
};
bobj.crv.ReportProcessingUI._prepareToShow = function () {
// cleanup any existing dialog?
if (bobj.crv.reportProcessingDialog !== null) {
bobj.crv.reportProcessingDialog.cancelShow ();
}
if (!this.layer) {
append2(document.body, this.getHTML());
this.init();
}
this.deferred = null;
bobj.crv.reportProcessingDialog = this;
};
bobj.crv.ReportProcessingUI.Show = function () {
this._prepareToShow();
bobj.crv.reportProcessingDialog.show(true);
};
bobj.crv.ReportProcessingUI.delayedShow = function () {
this._prepareToShow();
bobj.crv.timerID = setTimeout("bobj.crv._showReportProcessingDialog ()", bobj.crv.reportProcessingDialog.delay);
};
bobj.crv.ReportProcessingUI.cancelShow = function () {
if (bobj.crv.timerID) {
clearTimeout (bobj.crv.timerID);
}
if (bobj.crv.reportProcessingDialog){
bobj.crv.reportProcessingDialog.show (false);
}
bobj.crv.reportProcessingDialog = null;
bobj.crv.timerID = null;
};
bobj.crv.ReportProcessingUI.setDeferred = function (deferred) {
bobj.crv.reportProcessingDialog.deferred = deferred;
if (bobj.crv.reportProcessingDialog.wasCancelled () === true) {
deferred.cancel ();
}
};
bobj.crv._showReportProcessingDialog = function () {
if (bobj.crv.reportProcessingDialog && bobj.crv.reportProcessingDialog.delay !== 0) {
bobj.crv.logger.info('ShowReportProcessingDialog');
bobj.crv.reportProcessingDialog.show (true);
}
};

View File

@@ -0,0 +1,270 @@
/*
================================================================================
GroupTree
================================================================================
*/
/**
* GroupTree constructor.
*
* @param kwArgs.id [String] DOM node id
* @param kwArgs.icns [String] URL to magnifying glass icon
* @param kwArgs.minIcon [String] URL to min.gif
* @param kwArgs.plusIcon [String] URL to plus.gif
*/
bobj.crv.newGroupTree = function(kwArgs) {
var UPDATE = MochiKit.Base.update;
kwArgs = UPDATE ( {
id : bobj.uniqueId (),
visualStyle : {
className : null,
backgroundColor : null,
borderWidth : null,
borderStyle : null,
borderColor : null,
fontFamily : null,
fontWeight : null,
textDecoration : null,
color : null,
width : null,
height : null,
fontStyle : null,
fontSize : null
},
icns : bobj.crvUri ('images/magnify.gif'),
minIcon : bobj.crvUri ('images/min.gif'),
plusIcon : bobj.crvUri ('images/plus.gif')
}, kwArgs);
var o = newTreeWidget (kwArgs.id + '_tree', '100%', '100%', kwArgs.icns, null, null, 'groupTree',
bobj.crv.GroupTree._expand, bobj.crv.GroupTree._collapse, null, kwArgs.minIcon, kwArgs.plusIcon);
o._children = [];
o._modalChildren = [];
o._lastNodeIdInitialized = -1;
o._lastNodeInitialized = null;
o._curSigs = [];
bobj.fillIn (o, kwArgs);
o.widgetType = 'GroupTree';
o.initOld = o.init;
UPDATE (o, bobj.crv.GroupTree);
return o;
};
bobj.crv.GroupTree = {
/**
* Disposes group tree
*/
dispose : function() {
/* removes all the signals */
while (this._curSigs.length > 0) {
bobj.crv.SignalDisposer.dispose (this._curSigs.pop ());
}
/* disposes all the children*/
while (this._children.length > 0) {
var child = this._children.pop ();
child.dispose ();
bobj.deleteWidget (child);
delete child;
}
this._lastNodeIdInitialized = -1;
this._lastNodeInitialized = null;
this.sub = [];
bobj.removeAllChildElements(this.treeLyr);
},
getModalChildren : function () {
return this._modalChildren;
},
/**
* Adds a child widget as a group tree node.
*
* @param widget
* [Widget] Child tree node widget
*/
addChild : function(widget) {
var Base = MochiKit.Base;
var Signal = MochiKit.Signal;
var connect = Signal.connect;
widget.expandPath = this._children.length + '';
this._children.push (widget);
widget._updateProperty (this.enableDrilldown, this.enableNavigation);
this.add (widget);
widget.delayedAddChild (this.enableDrilldown, this.enableNavigation);
this._curSigs.push (connect (widget, 'grpDrilldown', Base.partial (Signal.signal, this, 'grpDrilldown')));
this._curSigs.push (connect (widget, 'grpNodeRetrieveChildren', Base.partial (Signal.signal, this, 'grpNodeRetrieveChildren')));
},
/**
* Since GroupTree nodes are delay loaded, we would have to store the timeout ids to cancel them in case user drill down to another views
*/
delayedBatchAdd : function(children) {
if (!children || children.length == 0)
return;
this._modalChildren = children;
var childrenHTML = "";
var numChildrenToRender = children.length > 100 ? 100 : children.length;
if(numChildrenToRender > 0) {
for(var i = 0 ; i < numChildrenToRender ; i++) {
var child = bobj.crv.createWidget (this._modalChildren[i]);
this.addChild(child);
if(this.initialized())
childrenHTML += child.getHTML(0);
}
}
if(this.initialized()) {
this.appendChildrenHTML (childrenHTML);
this.initChildren ();
}
},
appendChildrenHTML : function (childrenHTML) {
append (this.treeLyr, childrenHTML);
},
init : function() {
this.initOld ();
bobj.setVisualStyle (this.layer, this.visualStyle);
this.css.verticalAlign = "top";
this.initChildren ();
this._groupTreeListener = new bobj.crv.GroupTreeListener(this);
},
update : function(update) {
if (update.cons == "bobj.crv.newGroupTree") {
var args = update.args;
var path = args.lastExpandedPath;
/* if path specified, then update specific path, otherwise recreate grouptree */
// if user has expands a node after session timeout -> the whole gt must be rerendered
if (path.length > 0 && this._children.length > 0) {
this.updateNode (path, update);
} else {
this.refreshChildNodes (update)
}
}
},
delayedAddChild : function(widget) {
this.addChild (widget);
append (this.treeLyr, widget.getHTML (this.initialIndent));
},
initChildren : function () {
while(this._lastNodeIdInitialized < this._children.length - 1)
this.initNextChild ();
},
initNextChild : function () {
var nextNode = null;
var nextNodeId = -1;
if(this._lastNodeIdInitialized == -1) {
var treeSpanLayer = getLayer("treeCont_" + this.id);
nextNode = treeSpanLayer.firstChild;
nextNodeId = 0;
}
else {
nextNode = this._lastNodeInitialized.nextSibling;
while(!(nextNode.id && nextNode.id.indexOf("TWe_") > -1))
nextNode = nextNode.nextSibling;
nextNodeId = this._lastNodeIdInitialized + 1;
}
if(nextNodeId < this._children.length && nextNode != null) {
this._children[nextNodeId].init(nextNode);
this._lastNodeInitialized = nextNode;
this._lastNodeIdInitialized = nextNodeId;
}
},
getBestFitHeight : function () {
return bobj.getHiddenElementDimensions (this.layer).h;
/**
* Since container of tree could be invisible, getHiddenElementDimensions has to be called
* instead of element.getHeight()
*/
},
/**
* refreshes group tree by removing all nodes and adding new ones
*/
refreshChildNodes : function(update) {
this.dispose ();
this.delayedBatchAdd (update.children);
MochiKit.Signal.signal(this, "refreshed");
},
/**
* @param path
* path to the node that should be updated eg) 0-1-2
* @param newTree
* the new tree sent in update
*
* Updates children of node specified by path
*/
updateNode : function(path, newTree) {
if (path && path.length > 0) {
var pathArray = path.split ('-');
var node = this;
var newNode = newTree;
/* Navigating to the node that requires update */
for ( var i = 0, len = pathArray.length; i < len; i++) {
if (node && newNode) {
var childIndex = parseInt (pathArray[i]);
newNode = newNode.children[childIndex];
node = node._children[childIndex];
} else {
break;
}
}
/* if we found the node that requires update, then update its children */
if (node && newNode && newNode.args.groupPath == node.groupPath && node._children.length == 0) {
for ( var nodeNum in newNode.children) {
var newChildnode = bobj.crv.createWidget (newNode.children[nodeNum]);
node.addChild (newChildnode);
}
node.delayedAddChild (this.enableDrilldown, this.enableNavigation);
node.expand ();
}
}
},
getChildrenCount : function () {
return this.sub.length;
},
/**
* Private. Callback function when a (complete) group tree node is collapsed.
*/
_collapse : function(expandPath) {
MochiKit.Signal.signal (this, 'grpNodeCollapse', expandPath);
},
/**
* Private. Callback function when a (complete) group tree node is expanded.
*/
_expand : function(expandPath) {
MochiKit.Signal.signal (this, 'grpNodeExpand', expandPath);
},
resize : function(width, height) {
bobj.setOuterSize (this.layer, width, height);
MochiKit.Signal.signal(this, "resized");
}
};

View File

@@ -0,0 +1,165 @@
bobj.crv.GroupTreeListener = function(groupTree) {
this._groupTree = groupTree;
this._groupTreePrevState = this.getTreeState ();
this._lastNodeRendererd = this.getNumberOfNodesRendered () - 1;
this._nodeHeight = -1;
this._futreNodesPlaceHolder = null;
this.actionIDs = [];
this.addFutureNodesPlaceHolder ();
MochiKit.Signal.connect(groupTree.layer, "onscroll", bobj.bindFunctionToObject(this.detectTreeChanges, this));
MochiKit.Signal.connect(groupTree, "refreshed", this, this.reset);
MochiKit.Signal.connect(groupTree, "resized", this, this.detectTreeChanges);
};
bobj.crv.GroupTreeListener.prototype = {
/**
*
* @return number of nodes rendered by group tree
*/
getNumberOfNodesRendered : function() {
return this._groupTree.getChildrenCount ();
},
/**
*
* @return number of nodes that have not been rendered yet
*/
getNumberOfNodesMissing : function() {
return this._groupTree.getModalChildren ().length - this._lastNodeRendererd - 1;
},
getTreeState : function() {
var gt = this._groupTree;
return {
height :gt.getHeight (),
scrollTop :gt.layer.scrollTop
};
},
/**
*
* @return number of nodes required to be rendered to fill up the group tree height
*/
getNumberOfNodesToRender : function() {
if (this.getNumberOfNodesMissing() == 0)
return 0;
var lastNodeRendered = this._groupTree.sub[this._lastNodeRendererd];
var treeNewState = this.getTreeState ();
if (lastNodeRendered != null) {
var offsetY = lastNodeRendered.layer.offsetTop;
if (offsetY < treeNewState.scrollTop + treeNewState.height) {
var freeSpace = treeNewState.scrollTop + treeNewState.height - offsetY;
return Math.floor (freeSpace / this.getNodeHeight ());
}
}
return 0;
},
/**
*
* @return a single node height
*/
getNodeHeight : function() {
if (this._nodeHeight > -1)
return this._nodeHeight;
else if (this.getNumberOfNodesRendered () > 0) {
var node = this._groupTree.sub[0];
this._nodeHeight = bobj.getHiddenElementDimensions (node.layer).h;
return this._nodeHeight;
}
return 0;
},
/**
*
* Adds as many nodes as it can to fill up the grouptree's height
*/
updateTreeChildren : function() {
var numNodesToRender = this.getNumberOfNodesToRender ();
var groupTreeModalChildren = this._groupTree.getModalChildren ();
if (numNodesToRender > 0) {
var childrenHTML = "";
for ( var i = this._lastNodeRendererd + 1, lastNode = this._lastNodeRendererd + numNodesToRender; i <= lastNode; i++) {
var modalChild = groupTreeModalChildren[i];
if (modalChild != null) {
var treeNode = bobj.crv.createWidget (modalChild);
this._groupTree.addChild (treeNode);
childrenHTML += treeNode.getHTML(0);
this._lastNodeRendererd = i;
}
}
this._groupTree.appendChildrenHTML(childrenHTML);
this._groupTree.initChildren();
}
this.updateFutureNodesPlaceHolderHeight ();
},
/**
* Detects if the tree UI has changed and calls update function
*
*/
detectTreeChanges : function() {
if (this.isTreeStateChanged ())
this.actionIDs.push(setTimeout(bobj.bindFunctionToObject(this.updateTreeChildren, this), 200));
this._groupTreePrevState = this.getTreeState ();
},
isTreeStateChanged : function() {
var currentState = this.getTreeState ();
if (currentState.height != this._groupTreePrevState.height)
return true;
if (currentState.scrollTop != this._groupTreePrevState.scrollTop)
return true;
return false;
},
/**
*
* Results listener's internal state when grouptree is refreshed
*/
reset : function() {
this._groupTreePrevState = this.getTreeState ();
this._lastNodeRendererd = this.getNumberOfNodesRendered () - 1;
this.clearActions ();
this.updateFutureNodesPlaceHolderHeight ();
},
clearActions : function () {
while(this.actionIDs.length > 0) {
clearTimeout(this.actionIDs.pop());
}
},
updateFutureNodesPlaceHolderHeight : function() {
var futurePlaceHolderLayer = this.getFutureNodesPlaceHolderLayer ();
if (futurePlaceHolderLayer != null) {
futurePlaceHolderLayer.style.height = (this.getNumberOfNodesMissing () * this.getNodeHeight ()) + "px";
}
},
getFutureNodesPlaceHolderLayer : function() {
return this._futreNodesPlaceHolder;
},
addFutureNodesPlaceHolder : function() {
this._futreNodesPlaceHolder = MochiKit.DOM.DIV ( {
id :bobj.uniqueId () + "_futureHolder",
style : {
width :'0px',
height :(this.getNumberOfNodesMissing () * this.getNodeHeight ()) + "px"
}
});
this._groupTree.layer.appendChild (this._futreNodesPlaceHolder);
}
}

View File

@@ -0,0 +1,203 @@
/**
* GroupTreeNode constructor.
*
* @param kwArgs.id [String] DOM node id
* @param kwArgs.groupName [String] Name of the group
* @param kwArgs.groupPath [String] Path of the group
*/
bobj.crv.newGroupTreeNode = function(kwArgs) {
var UPDATE = MochiKit.Base.update;
kwArgs = UPDATE ( {
id : bobj.uniqueId ()
}, kwArgs);
var iconAlt = null;
var iconId = -1; // by default, no icon
if (!kwArgs.isVisible) {
iconId = 0;
iconAlt = L_bobj_crv_Tree_Drilldown_Node.replace ('%1', kwArgs.groupName);
}
var o = newTreeWidgetElem (iconId, kwArgs.groupName, kwArgs.groupPath, null, null, null, iconAlt, null, null, false);
o._children = [];
o._curSigs = [];
bobj.fillIn (o, kwArgs);
o.widgetType = 'GroupTreeNode';
o.initOld = o.init;
o.selectOld = o.select;
o.select = bobj.crv.GroupTreeNode._drilldown;
if (!kwArgs.isVisible) {
o.setCursorClass('drill_cursor');
}
UPDATE (o, bobj.crv.GroupTreeNode);
return o;
};
bobj.crv.GroupTreeNode = {
/**
* Diposes grouptree node. Deletes all signals and children
*/
dispose : function() {
while (this._curSigs.length > 0) {
bobj.crv.SignalDisposer.dispose (this._curSigs.pop ());
}
while (this._children.length > 0) {
var child = this._children.pop ();
child.dispose ();
bobj.deleteWidget (child);
delete child;
}
this.sub = [];
//layers of all GroupTreeNodes are disposed in GroupTree.dispose in one batch for performance reason
},
init : function(layer) {
this.initOld (layer);
this._setVisualStyle ();
if (this.isStatic) {
/*"treeNormal" is the default css class for tree node text */
var spans = MochiKit.DOM.getElementsByTagAndClassName ("span", "treeNormal", this.layer);
if (spans && spans.length > 0)
spans[0].style.cursor = 'text';
}
},
/**
* @return boolean true if node is expanded
*/
isExpanded : function() {
var elemId = TreeIdToIdx (this.layer);
return _TreeWidgetElemInstances[elemId].expanded;
},
/**
* expands node and shows its children
*/
expand : function() {
var elemId = TreeIdToIdx (this.layer);
_TreeWidgetElemInstances[elemId].expanded = false
TreeWidget_toggleCB (elemId);
},
collapse : function() {
var elemId = TreeIdToIdx (this.layer);
_TreeWidgetElemInstances[elemId].expanded = true
TreeWidget_toggleCB (elemId);
},
_setVisualStyle : function() {
try {
var textNode = this.layer.lastChild;
var parentNode = this.treeView;
} catch (err) {
return;
}
var pvStyle = parentNode.visualStyle;
var tStyle = textNode.style;
if (pvStyle.fontFamily)
tStyle.fontFamily = pvStyle.fontFamily;
if (pvStyle.fontWeight)
tStyle.fontWeight = pvStyle.fontWeight;
if (pvStyle.textDecoration)
tStyle.textDecoration = pvStyle.textDecoration;
if (pvStyle.color)
tStyle.color = pvStyle.color;
if (pvStyle.fontStyle)
tStyle.fontStyle = pvStyle.fontStyle;
if (pvStyle.fontSize)
tStyle.fontSize = pvStyle.fontSize;
},
/**
* Delay add the child nodes to a node recursively.
* The addition of nodes has to happen in a top-down fashion because each node has a reference to the tree
* and this reference is retrieved from the parent node.
*/
delayedAddChild : function(enableDrilldown, enableNavigation) {
var CONNECT = MochiKit.Signal.connect;
var SIGNAL = MochiKit.Signal.signal;
var PARTIAL = MochiKit.Base.partial;
var childCount = this._children.length;
if (childCount > 0) {
this.expanded = true;
} else {
this.expanded = false;
if (!this.leaf) {
this.setIncomplete (bobj.crv.GroupTreeNode._getChildren);
}
}
var children = this._children;
for ( var i = 0; i < childCount; i++) {
var childNode = children[i];
childNode.expandPath = this.expandPath + '-' + i;
childNode._updateProperty (enableDrilldown, enableNavigation);
this.add (childNode);
this._curSigs.push (CONNECT (childNode, 'grpDrilldown', PARTIAL (SIGNAL, this, 'grpDrilldown')));
this._curSigs.push (CONNECT (childNode, 'grpNodeRetrieveChildren', PARTIAL (SIGNAL, this, 'grpNodeRetrieveChildren')));
childNode.delayedAddChild (enableDrilldown, enableNavigation);
}
},
addChild : function(widget) {
this._children.push (widget);
},
getLevel : function() {
return this.expandPath.split('-').length;
},
/**
* Private. Callback function when a group tree node is clicked, which is a group drilldown.
*/
_drilldown : function() {
this.selectOld ();
MochiKit.Signal.signal (this, 'grpDrilldown', this.groupName, this.groupPath, this.isVisible, this.groupNamePath);
},
/**
* Private. Callback function when an incomplete group tree node is expanded.
*/
_getChildren : function() {
this.plusLyr.src = _skin + '../loading.gif';
MochiKit.Signal.signal (this, 'grpNodeRetrieveChildren', this.expandPath);
},
/**
* Private. Change the select event handler and text style class based on the two given flags.
*/
_updateProperty : function(enableDrilldown, enableNavigation) {
var isStatic = false;
if (this.isVisible && !enableNavigation) {
isStatic = true;
} else if (!this.isVisible && !enableDrilldown) {
isStatic = true;
}
if (isStatic) {
this.select = MochiKit.Base.noop;
}
this.isStatic = isStatic;
}
};

View File

@@ -0,0 +1,599 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
/**
* Abstract base class. IOAdapters allow the ViewerListener to request data from
* a server without knowing the details of how a particular framework requires
* the request to be made.
*/
bobj.crv.IOAdapterBase = {
/**
* Send a viewer request to the Server.
*
* @param pageState [Object] The composite view state for all viewers on the page
* @param viewerName [String] The name of the viewer that should handle the request
* @param eventArgs [Object] Event arguements
* @param allowAsynch [bool] True if asynchronous requests are allowed
*
* @return [MochiKit.Async.Deferred] Returns a Deferred if an asynchronous
* request is pending.
*/
request: function() {},
/**
* Add a parameter to server requests.
*
* @param fldName [String] Name of the parameter
* @param fldValue [String] Value of the parameter
*/
addRequestField: function(fldName, fldValue) {},
/**
* Remove a parameter from server requests.
*
* @param fldName [String] Name of the parameter
*/
removeRequestField: function(fldName) {},
/**
* Save the page state. Persist the state in a manner apropriate
* for the framework.
*
* @param pageState [Object] The composite view state for all viewers on the page
* @param viewerName [String] The name of the viewer that making the request
*/
saveViewState: function(pageState, viewerName) {},
/**
* Get the postback data queryString to use for Active X print control
*
* @param pageState [Object] The composite view state for all viewers on the page
* @param viewerName [String] The name of the viewer that making the request
* @return [String] the postback data in a query string format
*/
getPostDataForPrinting: function(pageState, viewerName) {},
/**
* Allows the IOAdapter to manipulate the error before the Viewer processes it for display to the user.
*/
processError: function(response) {return response;},
canUseAjax: function() {
try {
return (MochiKit.Async.getXMLHttpRequest() !== null);
}
catch (e) {
return false;
}
},
/**
* Ensures that there is a hidden iframe to be used for postbacks.
*/
_getPostbackIframe: function() {
if (!this._iframe) {
ifrm = document.createElement("IFRAME");
ifrm.id = bobj.uniqueId();
ifrm.name = ifrm.id;
ifrm.style.width = '0px';
ifrm.style.height = '0px';
ifrm.style.position = 'absolute';
ifrm.style.top = '0px';
ifrm.style.left = '0px';
ifrm.style.visibility = 'hidden';
document.body.appendChild(ifrm);
// in IE, we need to set the window name again
if (!ifrm.contentWindow.name) {
ifrm.contentWindow.name = ifrm.id;
}
this._iframe = ifrm;
}
return this._iframe;
}
};
/*
================================================================================
ServletAdapter. ServletAdapter issues requests to the Java DHTML viewer.
================================================================================
*/
/**
* Constructor for ServletAdapter.
*
* @param pageUrl [string] URL of the page
* @param servletUrl [string] URL to which requests to a servlet should be made
* It doubles as the url for all asyncronous requests
*/
bobj.crv.ServletAdapter = function(pageUrl, servletUrl) {
this._pageUrl = pageUrl;
this._servletUrl = servletUrl;
this._form = null;
};
bobj.crv.ServletAdapter._requestParams = {
STATE: 'CRVCompositeViewState',
TARGET: 'CRVEventTarget',
ARGUMENT: 'CRVEventArgument'
};
bobj.crv.ServletAdapter.prototype = MochiKit.Base.merge(bobj.crv.IOAdapterBase, {
request: function(pageState, viewerName, eventArgs, allowAsync, useIframe) {
if (!this._form) {
this._createForm();
}
var rp = bobj.crv.ServletAdapter._requestParams;
var toJSON = MochiKit.Base.serializeJSON;
this._form[rp.STATE].value = encodeURIComponent(toJSON(pageState));
this._form[rp.TARGET].value = encodeURIComponent(viewerName);
this._form[rp.ARGUMENT].value = encodeURIComponent(toJSON(eventArgs));
var deferred = null;
if (allowAsync && this._servletUrl) {
var req = MochiKit.Async.getXMLHttpRequest();
req.open("POST", this._servletUrl, true);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
req.setRequestHeader('Accept','application/json');
deferred = MochiKit.Async.sendXMLHttpRequest(req, MochiKit.Base.queryString(this._form));
}
else {
if (useIframe) {
this._form.target = this._getPostbackIframe().id;
}
this._form.submit();
}
// once the form is submitted it is not intended to be reused.
MochiKit.DOM.removeElement(this._form);
this._form = null;
return deferred;
},
redirectToServlet: function () {
if (!this._form) {
this._createForm();
}
this._form.action = this._servletUrl;
},
_createForm: function() {
var d = MochiKit.DOM;
var rp = bobj.crv.ServletAdapter._requestParams;
this._form = d.FORM({
name: bobj.uniqueId(),
style: 'display:none',
method: 'POST',
enctype: 'application/x-www-form-urlencoded;charset=utf-8',
action: this._pageUrl},
d.INPUT({type: 'hidden', name: rp.STATE}),
d.INPUT({type: 'hidden', name: rp.TARGET}),
d.INPUT({type: 'hidden', name: rp.ARGUMENT}));
document.body.appendChild(this._form);
},
addRequestField: function(fldName, fldValue) {
if (fldName && fldValue) {
if (!this._form) {
this._createForm();
}
var existingElem = this._form[fldName];
if (existingElem) {
existingElem.value = fldValue;
}
else {
this._form.appendChild(MochiKit.DOM.INPUT({type: 'hidden', name:fldName, value:fldValue}));
}
}
},
removeRequestField: function(fldName) {
if (fldName) {
var form = this._form;
if (form) {
var existingElem = form[fldName];
if (existingElem) {
MochiKit.DOM.removeElement(existingElem);
if(form[fldName]) { // Fix for FF
form[fldName] = null;
}
}
existingElem = null;
}
}
},
getPostDataForPrinting: function(pageState, viewerName) {
var toJSON = MochiKit.Base.serializeJSON;
var rp = bobj.crv.ServletAdapter._requestParams;
var state = toJSON(pageState);
var postData = {};
postData[rp.STATE] = encodeURIComponent(state);
postData[rp.TARGET] = encodeURIComponent(viewerName);
postData[rp.ARGUMENT] = encodeURIComponent('"axprint="');
if(document.getElementById('com.sun.faces.VIEW')) {
postData['com.sun.faces.VIEW'] = encodeURIComponent(document.getElementById('com.sun.faces.VIEW').value);
}
return MochiKit.Base.queryString(postData);
},
processError: function(response) {
if (!(typeof(response.number) == 'undefined') && response.number == 404) {
return L_bobj_crv_ServletMissing;
}
return response;
}
});
/*
================================================================================
AspDotNetAdapter. AspDotNetAdapter issues requests to the WebForm DHTML viewer.
================================================================================
*/
/**
* Constructor for AspDotNetAdapter.
*
* @param postbackEventReference [string] The full functiona call to the ASP.NET dopostback function
* @param replacementParameter [string] the string to replace in the dopostback function
* @param stateID [string] the name of the input field to save the state to
*/
bobj.crv.AspDotNetAdapter = function(postbackEventReference, replacementParameter, stateID, callbackEventReference, aspnetVersion) {
this._postbackEventReference = postbackEventReference;
this._replacementParameter = replacementParameter;
this._stateID = stateID;
this._aspnetVersion = aspnetVersion;
this._form = null;
this._callbackEventReference = callbackEventReference;
this._additionalReqFlds = null;
var tmpState = bobj.getElementByIdOrName(this._stateID);
if (tmpState) {
this._form = tmpState.form;
}
if(this._isAspNetVersionPriorToVersion4()) {
WebForm_CallbackComplete = this.WebForm_CallbackComplete;
}
};
bobj.crv.AspDotNetAdapter.prototype = MochiKit.Base.merge(bobj.crv.IOAdapterBase, {
request: function(pageState, viewerName, eventArgs, allowAsync, useIframe, callbackHandler, errbackHandler) {
var toJSON = MochiKit.Base.serializeJSON;
if (eventArgs && this._additionalReqFlds) {
eventArgs = MochiKit.Base.update(eventArgs, this._additionalReqFlds);
}
this._additionalReqFlds = null;
var jsonEventArgs = toJSON(eventArgs);
this.saveViewState(pageState, viewerName);
if (allowAsync) {
if(typeof WebForm_InitCallback == "function") {
__theFormPostData = ""; //Used by WeForm_InitCallback
__theFormPostCollection = []; //Used by WeForm_InitCallback
WebForm_InitCallback(); //Need to call this to work around a problem where ASP.NET2 callback does not collect form data prior to request
}
var callback = this._callbackEventReference.replace("'arg'", "jsonEventArgs");
callback = callback.replace("'cb'", "callbackHandler");
callback = callback.replace("'errcb'", "errbackHandler");
callback = callback.replace("'frmID'", "this._form.id");
return eval(callback);
}
else {
if (useIframe) {
this._form.target = this._getPostbackIframe().id;
}
var postbackCall;
if(this._postbackEventReference.indexOf("'" + this._replacementParameter + "'") >= 0){
postbackCall = this._postbackEventReference.replace("'" + this._replacementParameter + "'", "jsonEventArgs");
}
else {
postbackCall = this._postbackEventReference.replace('"' + this._replacementParameter + '"', "jsonEventArgs");
}
eval(postbackCall);
this._clearEventFields();
this._form.target = ""; //Give back the target of the form after using, or the form cannot get focused
}
},
/**
* @return true if aspnet verion is prior to version 4
*/
_isAspNetVersionPriorToVersion4 : function () {
if(this._aspnetVersion != null) {
var sep = this._aspnetVersion.split(".");
if(eval(sep[0]) < 4)
return true;
}
return false;
},
saveViewState: function(pageState, viewerName) {
var toJSON = MochiKit.Base.serializeJSON;
var viewState = pageState[viewerName];
var state = bobj.getElementByIdOrName(this._stateID);
if (state) {
state.value = toJSON(viewState);
}
},
getPostDataForPrinting: function(pageState, viewerName) {
this.saveViewState(pageState, viewerName);
var nv = MochiKit.DOM.formContents(this.form);
var names = nv[0];
var values = nv[1];
names.push('crprint');
values.push(viewerName);
var queryString = MochiKit.Base.queryString(names, values);
return queryString;
},
addRequestField: function(fldName, fldValue) {
if (!this._additionalReqFlds) {
this._additionalReqFlds = {};
}
this._additionalReqFlds[fldName] = fldValue;
/*if (fldName && fldValue) {
var existingElem = this._form[fldName];
if (existingElem) {
existingElem.value = fldValue;
}
else {
this._form.appendChild(MochiKit.DOM.INPUT({type: 'hidden', name:fldName, value:fldValue}));
}
}*/
},
_clearRequestField: function(fldName) {
if (fldName) {
if (this._form) {
var existingElem = this._form[fldName];
if (existingElem) {
existingElem.value = "";
}
}
}
},
_clearEventFields: function() {
this._clearRequestField("__EVENTTARGET");
this._clearRequestField("__EVENTARGUMENT");
},
/*
* Overriding WebForm_CallbackComplete provided by .Net framework 2(WebResource.asx) as it was incorrect.
* The code below is taken from .Net 4 copy of this function
* This code can be removed once the support for .Net 2 is terminated
*/
WebForm_CallbackComplete : function () {
for (var i = 0; i < __pendingCallbacks.length; i++) {
callbackObject = __pendingCallbacks[i];
if (callbackObject && callbackObject.xmlRequest && (callbackObject.xmlRequest.readyState == 4)) {
if (!__pendingCallbacks[i].async) {
__synchronousCallBackIndex = -1;
}
__pendingCallbacks[i] = null;
var callbackFrameID = "__CALLBACKFRAME" + i;
var xmlRequestFrame = document.getElementById(callbackFrameID);
if (xmlRequestFrame) {
xmlRequestFrame.parentNode.removeChild(xmlRequestFrame);
}
WebForm_ExecuteCallback(callbackObject);
}
}
}
});
/*
================================================================================
FacesAdapter. FacesAdapter issues requests to a JSF viewer component.
================================================================================
*/
/**
* Constructor for FacesAdapter.
*
* @param formName [string] Name of the form to submit
* @param servletUrl [string] URL to which requests to a servlet should be made
* It doubles as the url for all asyncronous requests
*/
bobj.crv.FacesAdapter = function(formName, servletUrl) {
this._formName = formName;
this._servletUrl = servletUrl;
this._useServlet = false;
if (!bobj.crv.FacesAdapter._hasInterceptedSubmit) {
this._interceptSubmit();
bobj.crv.FacesAdapter._hasInterceptedSubmit = true;
}
};
bobj.crv.FacesAdapter._requestParams = {
STATE: 'CRVCompositeViewState',
TARGET: 'CRVEventTarget',
ARGUMENT: 'CRVEventArgument'
};
bobj.crv.FacesAdapter.prototype = MochiKit.Base.merge(bobj.crv.IOAdapterBase, {
request: function(pageState, viewerName, eventArgs, allowAsync, useIframe) {
var rp = bobj.crv.FacesAdapter._requestParams;
var toJSON = MochiKit.Base.serializeJSON;
var INPUT = MochiKit.DOM.INPUT;
var deferred = null;
var form = this._getForm();
if (!form) {
return;
}
if (!form[rp.TARGET]) {
form.appendChild( INPUT({type: 'hidden', name: rp.TARGET}) );
}
form[rp.TARGET].value = encodeURIComponent(viewerName);
if (!form[rp.ARGUMENT]) {
form.appendChild( INPUT({type: 'hidden', name: rp.ARGUMENT}) );
}
form[rp.ARGUMENT].value = encodeURIComponent(toJSON(eventArgs));
if (!form[rp.STATE]) {
form.appendChild( INPUT({type: 'hidden', name: rp.STATE}) );
}
form[rp.STATE].value = encodeURIComponent(toJSON(pageState));
if (allowAsync && this._servletUrl) {
var req = MochiKit.Async.getXMLHttpRequest();
req.open("POST", this._servletUrl, true);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
req.setRequestHeader('Accept','application/json');
deferred = MochiKit.Async.sendXMLHttpRequest(req, MochiKit.Base.queryString(form));
}
else {
var pageUrl = form.action;
if (this._useServlet === true) {
form.action = this._servletUrl;
}
var origTarget = form.target;
if (useIframe) {
form.target = this._getPostbackIframe().id;
}
form.submit();
form.action = pageUrl;
form.target = origTarget;
this._useServlet = false;
}
// clear out the request fields so that the form can be reused
form[rp.TARGET].value = "";
form[rp.ARGUMENT].value = "";
form[rp.STATE].value = "";
// TODO Post Titan: we shouldn't need to have explicit knowledge of this parameter
this.removeRequestField ('ServletTask');
return deferred;
},
redirectToServlet: function () {
this._useServlet = true;
},
addRequestField: function(fldName, fldValue) {
if (fldName && fldValue) {
var form = this._getForm();
if (form) {
var existingElem = form[fldName];
if (existingElem) {
existingElem.value = fldValue;
}
else {
form.appendChild(MochiKit.DOM.INPUT({type: 'hidden', name:fldName, value:fldValue}));
}
}
}
},
removeRequestField: function(fldName) {
if (fldName) {
var form = this._getForm();
if (form) {
var existingElem = form[fldName];
if (existingElem) {
MochiKit.DOM.removeElement(existingElem);
if(form[fldName]) { // Fix for FF
form[fldName] = null;
}
}
existingElem = null;
}
}
},
saveViewState: function(pageState, viewerName) {
if (!bobj.crv.FacesAdapter._isStateSaved) {
var form = this._getForm();
if (form) {
var rp = bobj.crv.FacesAdapter._requestParams;
var toJSON = MochiKit.Base.serializeJSON;
var INPUT = MochiKit.DOM.INPUT;
if (!form[rp.STATE]) {
form.appendChild( INPUT({type: 'hidden', name: rp.STATE}) );
}
form[rp.STATE].value = encodeURIComponent(toJSON(pageState));
}
bobj.crv.FacesAdapter._isStateSaved = true;
}
},
_getForm: function() {
return document.forms[this._formName];
},
_interceptSubmit: function() {
var form = this._getForm();
if (form) {
var oldSubmit = form.submit;
form.submit = function() {
bobj.event.publish('saveViewState');
form.submit = oldSubmit; // IE needs this
form.submit(); // Can't apply args because IE misbehaves
};
}
},
getPostDataForPrinting: function(pageState, viewerName) {
var toJSON = MochiKit.Base.serializeJSON;
var rp = bobj.crv.ServletAdapter._requestParams;
var state = toJSON(pageState);
var postData = {};
postData[rp.STATE] = encodeURIComponent(state);
postData[rp.TARGET] = encodeURIComponent(viewerName);
postData[rp.ARGUMENT] = encodeURIComponent('"axprint="');
if(document.getElementById('com.sun.faces.VIEW')) {
postData['com.sun.faces.VIEW'] = encodeURIComponent(document.getElementById('com.sun.faces.VIEW').value);
}
return MochiKit.Base.queryString(postData);
},
processError: function(response) {
if (!(typeof(response.number) == 'undefined') && response.number == 404) {
return L_bobj_crv_ServletMissing;
}
return response;
}
});

View File

@@ -0,0 +1,37 @@
// allInOne.gif - icon images with different width and heights - disabled states are on the right
bobj.crv.allInOne = (function () {
var o = new Object();
o.uri = bobj.crvUri('images/allInOne.gif');
var iconHeight22 = 22;
var offset = 0;
// Toolbar icons are 22 pixels height and have 3 pixels place holder
offset += 3;
offset = o.toolbarExportDy = offset;
offset = o.toolbarPrintDy = offset + iconHeight22;
offset = o.toolbarRefreshDy = offset + iconHeight22;
offset = o.toolbarSearchDy = offset + iconHeight22;
offset = o.toolbarUpDy = offset + iconHeight22;
// Rest of the images don't need the place holder
offset -= 3;
// These are 22 pixels height
offset = o.groupTreeToggleDy = offset + iconHeight22;
offset = o.paramPanelToggleDy = offset + iconHeight22;
// These two are 20 pixels height
offset = o.toolbarPrevPageDy = offset + iconHeight22; // 22x20
offset = o.toolbarNextPageDy = offset + 20; // 22x20
offset = o.paramRunDy = offset + 20; // 22x22
offset = o.paramDataFetchingDy = offset + 22; // 16x16
offset = o.closePanelDy = offset + 16; // 8x7
offset = o.openParameterArrowDy = offset + 7; // 15x15
offset = o.plusDy = offset + 15; // 13x12
offset = o.minusDy = offset + 12; // 13x12
offset = o.undoDy = offset + 12; // 16x16
return o;
})();

View File

@@ -0,0 +1,289 @@
/**
* LeftPanel is a container class managing PanelNavigator and ToolPanel classes
*/
bobj.crv.newLeftPanel = function(kwArgs) {
kwArgs = MochiKit.Base.update ( {
id : bobj.uniqueId () + "_leftPanel",
hasToggleGroupTreeButton : true,
hasToggleParameterPanelButton : true,
paramIconImg : null,
treeIconImg : null
}, kwArgs);
return new bobj.crv.LeftPanel (kwArgs.id, kwArgs.hasToggleGroupTreeButton, kwArgs.hasToggleParameterPanelButton, kwArgs.paramIconImg, kwArgs.treeIconImg);
};
bobj.crv.LeftPanel = function(id, hasToggleGroupTreeButton, hasToggleParameterPanelButton, paramIconImg, treeIconImg) {
this._panelNavigator = null;
this._panelHeader = null;
this._toolPanel = null;
this.id = id;
this.widgetType = 'LeftPanel';
this.hasToggleParameterPanelButton = hasToggleParameterPanelButton;
this.hasToggleGroupTreeButton = hasToggleGroupTreeButton;
this.paramIconImg = paramIconImg;
this.treeIconImg = treeIconImg;
this._lastViewedPanel = null;
};
bobj.crv.LeftPanel.prototype = {
getHTML : function() {
var toolPanelHTML = this._toolPanel ? this._toolPanel.getHTML () : '';
var panelHeaderHTML = this._panelHeader ? this._panelHeader.getHTML () : '';
var navigatorHTML = this._panelNavigator ? this._panelNavigator.getHTML () : '';
return bobj.html.DIV ( {
'class' : 'leftPanel',
id : this.id
}, navigatorHTML, panelHeaderHTML, toolPanelHTML);
},
/**
* @return width that would best fit both navigator and toolpanel
*/
getBestFitWidth : function() {
var w = 0;
if (this._panelNavigator)
w += this._panelNavigator.getWidth ();
if (this._toolPanel && this._toolPanel.isDisplayed())
w += this._toolPanel.getWidth();
else
w += 5; //The padding between navigator and reportAlbum when no toolpanel exist
return w;
},
getBestFitHeight : function () {
var toolPanelHeight = 0;
var panelNavigatorHeight = 0;
if(this._panelHeader)
toolPanelHeight += this._panelHeader.getHeight()
if(this._toolPanel)
toolPanelHeight += this._toolPanel.getBestFitHeight();
if(this._panelNavigator)
panelNavigatorHeight = this._panelNavigator.getBestFitHeight();
return Math.max (toolPanelHeight, panelNavigatorHeight);
},
/**
* AJAX update flow
* @param update
* @return
*/
update : function(update) {
if (!update || update.cons != "bobj.crv.newLeftPanel") {
return;
}
for ( var childNum in update.children) {
var child = update.children[childNum];
if (child && child.cons == "bobj.crv.newToolPanel") {
if (this._toolPanel)
this._toolPanel.update (child);
break;
}
}
},
/**
* Initializes widgets and connects signals
*/
init : function() {
this.layer = getLayer (this.id);
this.css = this.layer.style;
if (this._toolPanel)
this._toolPanel.init ();
if (this._panelHeader) {
this._panelHeader.init ();
if(!this.isToolPanelDisplayed())
this._panelHeader.setDisplay(false);
}
if (this._panelNavigator)
this._panelNavigator.init ();
},
/**
* Connects signals
* @return
*/
_initSignals : function() {
var partial = MochiKit.Base.partial;
var signal = MochiKit.Signal.signal;
var connect = MochiKit.Signal.connect;
if (this._toolPanel) {
MochiKit.Iter.forEach ( [ 'grpDrilldown', 'grpNodeRetrieveChildren', 'grpNodeCollapse', 'grpNodeExpand', 'resetParamPanel',
'resizeToolPanel' ], function(sigName) {
connect (this._toolPanel, sigName, partial (signal, this, sigName));
}, this);
}
if (this._panelNavigator)
connect (this._panelNavigator, "switchPanel", this, '_switchPanel');
if(this._panelHeader)
connect (this._panelHeader, "switchPanel", this, '_switchPanel');
},
/**
* @return true if toolpanel is displayed
*/
isToolPanelDisplayed : function() {
return this._toolPanel && this._toolPanel.isDisplayed ();
},
/**
* Do not Remove, Used by WebElements Public API
*/
displayLastViewedPanel : function () {
if(this._toolPanel) {
switch(this._lastViewedPanel)
{
case bobj.crv.ToolPanelType.GroupTree:
this._switchPanel (bobj.crv.ToolPanelType.GroupTree);
break;
case bobj.crv.ToolPanelType.ParameterPanel:
this._switchPanel (bobj.crv.ToolPanelType.ParameterPanel);
break;
default :
this._switchPanel (bobj.crv.ToolPanelType.GroupTree);
}
}
},
/**
* Do not Remove, Used by WebElements Public API
*/
hideToolPanel : function () {
this._switchPanel (bobj.crv.ToolPanelType.None);
},
/**
*
* @param panelType [bobj.crv.ToolPanelType]
* @return
*/
_switchPanel : function(panelType) {
if (this._toolPanel) {
this._toolPanel.setView (panelType);
if(panelType == bobj.crv.ToolPanelType.None) {
this._toolPanel.setDisplay(false);
this._panelHeader.setDisplay(false);
}
else {
this._toolPanel.setDisplay(true);
this._panelHeader.setDisplay(true);
this._lastViewedPanel = panelType;
}
}
if (this._panelHeader)
var title = bobj.crv.ToolPanelTypeDetails[panelType].title;
this._panelHeader.setTitle (title);
if (this._panelNavigator)
this._panelNavigator.selectChild (panelType);
MochiKit.Signal.signal (this, 'switchPanel', panelType);
},
/**
* Do not Remove, Used by WebElements Public API
*/
getPanelNavigator : function () {
return this._panelNavigator;
},
getToolPanel : function() {
return this._toolPanel;
},
addChild : function(child) {
if (child.widgetType == "ToolPanel") {
this._toolPanel = child;
this.updateChildren ();
this._initSignals ();
}
},
/**
* Update Navigator and Header with toolPanel's children
* @return
*/
updateChildren : function() {
if (this._toolPanel) {
this._panelNavigator = new bobj.crv.PanelNavigator ();
this._panelHeader = new bobj.crv.PanelHeader ();
var newChild = null;
if (this._toolPanel.hasParameterPanel () && this.hasToggleParameterPanelButton) {
newChild = {
name : bobj.crv.ToolPanelType.ParameterPanel,
img : this.paramIconImg ? this.paramIconImg : bobj.crv.ToolPanelTypeDetails.ParameterPanel.img,
title : bobj.crv.ToolPanelTypeDetails.ParameterPanel.title
};
this._panelNavigator.addChild (newChild);
}
if (this._toolPanel.hasGroupTree () && this.hasToggleGroupTreeButton) {
newChild = {
name : bobj.crv.ToolPanelType.GroupTree,
img : this.treeIconImg ? this.treeIconImg : bobj.crv.ToolPanelTypeDetails.GroupTree.img,
title : bobj.crv.ToolPanelTypeDetails.GroupTree.title
};
this._panelNavigator.addChild (newChild);
}
this._lastViewedPanel = this._toolPanel.initialViewType;
this._panelNavigator.selectChild (this._toolPanel.initialViewType);
this._panelHeader.setTitle (bobj.crv.ToolPanelTypeDetails[this._toolPanel.initialViewType].title);
if (!this._panelNavigator.hasChildren())
{
this._panelHeader.hideCloseButton();
this._toolPanel.addLeftBorder();
}
}
},
resize : function(w, h) {
bobj.setOuterSize (this.layer, w, h);
this._doLayout ();
},
/**
* Layouts children where PanelHeader appears on top of toolPanel and panelNavigator to left of both header and toolpanel
* @return
*/
_doLayout : function() {
if(!this._toolPanel || !this._panelNavigator || !this._panelHeader)
return;
var w = this.getWidth ();
var h = this.getHeight ();
var navigatorW = this._panelNavigator.getWidth ();
var newToolPanelWidth = w - navigatorW;
var newToolPanelHeight = h - this._panelHeader.getHeight ();
if (this._toolPanel.isDisplayed()) {
this._toolPanel.resize (newToolPanelWidth, newToolPanelHeight);
this._toolPanel.move (navigatorW, this._panelHeader.getHeight ());
}
this._panelHeader.resize (newToolPanelWidth, null);
this._panelHeader.move (navigatorW, 0);
this._panelNavigator.resize(navigatorW, h);
},
move : Widget_move,
getWidth : Widget_getWidth,
getHeight : Widget_getHeight
};

View File

@@ -0,0 +1,35 @@
/**
* OptionalParameterUI extends ParameterUI
*/
bobj.crv.params.newOptionalParameterUI = function(kwArgs) {
kwArgs = MochiKit.Base.update( {
noValueDisplayText :'',
isEmptyStringNoValue: true,
clearValuesCB : null
}, kwArgs);
var o = bobj.crv.params.newParameterUI(kwArgs);
/*
* The reason I'm using bobj.extendClass is that it would populate all functions defined in ParameterUI
* in this.superClass so I can call any function on parent class
*/
bobj.extendClass(o, bobj.crv.params.OptionalParameterUI, bobj.crv.params.ParameterUI);
return o;
};
bobj.crv.params.OptionalParameterUI = {
_getNewValueRowConstructor : function() {
return bobj.crv.params.newOptionalParameterValueRow;
},
_getNewValueRowArgs : function(value) {
var args = this.superClass._getNewValueRowArgs(value);
args.noValueDisplayText = this.noValueDisplayText;
args.isEmptyStringNoValue = this.isEmptyStringNoValue;
args.clearValuesCB = this.clearValuesCB;
return args;
}
};

View File

@@ -0,0 +1,143 @@
/**
* OptionalParameterValueRow extends ParamterValueRow. This class displays a info message for 'undefined' value and
* clears the info message when its control get focus
*/
bobj.crv.params.newOptionalParameterValueRow = function(kwArgs) {
kwArgs = MochiKit.Base.update( {
noValueDisplayText :'',
isEmptyStringNoValue : true,
clearValuesCB : null
}, kwArgs);
var o = bobj.crv.params.newParameterValueRow(kwArgs);
bobj.extendClass(o, bobj.crv.params.OptionalParameterValueRow, bobj.crv.params.ParameterValueRow);
if (o.canChangeOnPanel) {
o._clearValueButton = newIconWidget(
o.id + '_clearBtn',
bobj.crvUri('images/clear_x.gif'),
o.clearValuesCB,
null, //text
L_bobj_crv_ParamsClearValues,//tooltip,
10, 10, 2, 2); //width, height, dx, dy, disDx, disDy, cancelEventPropagation
o._clearValueButton.setClasses("", "iconcheck", "", "iconcheckhover");
o._clearValueButton.margin = 2;
}
return o;
};
bobj.crv.params.OptionalParameterValueRow = {
/**
* Returns arguments required for creating new ValueWidget(TextField, TextCombo, RangeField)
*/
getNewValueWidgetArgs : function() {
var args = this.superClass.getNewValueWidgetArgs();
if (this.value == undefined) {
//If value is undefined, the valueWidget should display noValueDisplayText
args.cleanValue = this.noValueDisplayText;
args.foreColor = bobj.Colors.GRAY;
}
return args;
},
init : function () {
this.superClass.init();
if(this._clearValueButton) {
this._clearValueButton.init();
}
this.updateUI ();
},
getHTML : function () {
var rowHTML = this.superClass.getHTML();
if (this.canChangeOnPanel) {
var h = bobj.html;
rowHTML = h.DIV({style : {position : 'relative'}}, rowHTML , h.DIV({'class' : 'clearValueBtnCtn'},this._clearValueButton.getHTML()));
}
return rowHTML;
},
/**
* When receiving focus if noValueDisplayText is being displayed (happens when current value is undefined and param is editable on panel),
* it must be cleared so user can type something
*/
onFocus : function() {
this.superClass.onFocus();
if (this.canChangeOnPanel) {
if(this.value == undefined)
this._valueWidget.setValue('');
}
},
onBlur : function() {
this.superClass.onBlur();
if (this.canChangeOnPanel) {
if (this.value == undefined)
this._valueWidget.setValue(this.noValueDisplayText);
}
},
/**
* When user changes value, value stored in OptionalParmeterUI gets updated and
*/
_onChange : function() {
this.value = this._valueWidget.getValue();
if(this.isEmptyStringNoValue && this.value != null && this.value.length == 0)
this.value = undefined;
this.updateUI();
if (this.changeCB)
this.changeCB();
},
updateUI: function() {
if (this._valueWidget) {
if(this.isReadOnlyParam) {
this._valueWidget.setForeColor(bobj.Colors.GRAY);
this._valueWidget.setTextItalic(false);
}
else {
if(this.value == undefined) {
this._valueWidget.setForeColor(bobj.Colors.GRAY);
if(this._clearValueButton)
this._clearValueButton.setDisplay(false);
}
else {
this._valueWidget.setForeColor(bobj.Colors.BLACK);
if(this._clearValueButton)
this._clearValueButton.setDisplay(true);
}
}
}
},
getValueWidgetDisplayValue: function(value) {
return (value == undefined) ? this.noValueDisplayText : value;
},
setValue : function(value) {
this.value = value;
this._valueWidget.setValue(this.getValueWidgetDisplayValue(value));
this.updateUI();
this.setWarning(null); //Since value is set through parameterController it cannot contain any errors
},
reset : function(value) {
this.superClass.reset(value);
if(this._valueWidget) {
this._valueWidget.reset(this.getValueWidgetDisplayValue(value));
}
this.updateUI();
}
};

View File

@@ -0,0 +1,99 @@
/**
* The header that appears above toolPanel. It consists of a title and close button.
*/
bobj.crv.PanelHeader = function() {
this.id = bobj.uniqueId () + "_panelHeader";
this._closeButton = newIconWidget (this.id + "_close", bobj.crv.allInOne.uri, bobj
.bindFunctionToObject (this._closeButtonOnClick, this), null, L_bobj_crv_Close, 8, 7, 0, bobj.crv.allInOne.closePanelDy,null,null,true);
this.normalCssClass = "panelHeaderCloseButton";
this.highlightedCssClass = "panelHeaderCloseButtonHighlighted";
this._closeButton.setClasses (this.normalCssClass, this.normalCssClass, this.highlightedCssClass, this.highlightedCssClass);
this._title = "";
};
bobj.crv.PanelHeader.prototype = {
getHTML : function() {
var DIV = bobj.html.DIV;
var style = {height : bobj.isBorderBoxModel() ? '21px' : '20px'};
return DIV ( {
'class' : 'panelHeader',
id : this.id,
style : style
}, DIV ( {
'class' : 'panelHeaderTitle',
id : this.id + "_title"
}, this._title), DIV ( {
'class' : 'panelHeaderButtonCtn'
}, this._closeButton.getHTML ()));
},
init : function() {
this.layer = getLayer (this.id);
this.css = this.layer.style;
this._closeButton.init ();
var cbLayer = this._closeButton.layer
if (cbLayer) {
MochiKit.Signal.connect (cbLayer, "onfocus", this, this._closeButtonOnFocus);
MochiKit.Signal.connect (cbLayer, "onblur", this, this._closeButtonOnBlur);
}
},
/**
*
* @return [DOM element] of title
*/
_getTitleLayer : function() {
return getLayer (this.id + "_title");
},
/**
* Sets title on panel header
* @param title
* @return
*/
setTitle : function(title) {
this._title = title;
this._closeButton.changeTooltip(L_bobj_crv_Close + " " + title);
var l = this._getTitleLayer ();
if (l)
l.innerHTML = title;
},
_closeButtonOnFocus : function() {
if (this._closeButton && this._closeButton.layer)
MochiKit.DOM.addElementClass (this._closeButton.layer, this.highlightedCssClass);
},
_closeButtonOnBlur : function() {
if (this._closeButton && this._closeButton.layer)
MochiKit.DOM.removeElementClass (this._closeButton.layer, this.highlightedCssClass);
},
_closeButtonOnClick : function() {
MochiKit.Signal.signal (this, 'switchPanel', bobj.crv.ToolPanelType.None);
},
resize : function(w, h) {
if (this.layer)
bobj.setOuterSize (this.layer, w, h);
var titleLayer = this._getTitleLayer ();
if(titleLayer)
bobj.setOuterSize (titleLayer, w - 30);
},
hideCloseButton : function() {
if (this._closeButton)
this._closeButton.setDisplay(false);
},
getWidth : Widget_getWidth,
getHeight : Widget_getHeight,
move : Widget_move,
setDisplay : Widget_setDisplay
};

View File

@@ -0,0 +1,124 @@
/**
* Navigator on left of viewer, controlling which panel is shown
*/
bobj.crv.PanelNavigator = function() {
this._children = [];
this.widgetType = "PanelNavigator";
this.id = bobj.uniqueId () + "_panelNav";
};
bobj.crv.PanelNavigator.prototype = {
getHTML : function() {
var childrenHTML = "";
for ( var i = 0; i < this._children.length; i++)
childrenHTML += this._children[i].getHTML ();
var DIV = bobj.html.DIV;
var style = { width : bobj.isBorderBoxModel() ? '37px' : '35px'};
return DIV ( {
'class' : 'panelNavigator',
id : this.id,
style : style
}, DIV ( { id : this.id + "_innerBorder",
'class' : 'panelNavigatorInnerBorder'
}, childrenHTML));
},
/**
* Initializes its layer and calls init on children
* @return
*/
init : function() {
this.layer = getLayer (this.id);
this._innerBorder = getLayer(this.id + "_innerBorder");
this.css = this.layer.style;
if(this._children.length == 0) {
this.css.display = "none";
}
else {
for ( var i = 0; i < this._children.length; i++)
this._children[i].init ();
}
},
/**
* Sets selection on specified child and removes selection from any other child
* @return
*/
selectChild : function(childName) {
for ( var i = 0; i < this._children.length; i++) {
var child = this._children[i];
child.setSelected (child.getName () == childName);
}
},
getChild : function (childName) {
for ( var i = 0; i < this._children.length; i++) {
var child = this._children[i];
if(child.getName () == childName)
return child;
}
return null;
},
hasChildren : function () {
return (this._children.length > 0);
},
/**
* Do not Remove, Used by WebElements Public API
*/
getGroupTreeButton : function () {
return this.getChild (bobj.crv.ToolPanelType.GroupTree);
},
/**
* Do not Remove, Used by WebElements Public API
*/
getParamPanelButton : function () {
return this.getChild (bobj.crv.ToolPanelType.ParameterPanel);
},
/**
*
* @param kwArgs [JSON] creates PanelNavigatorItem with properties specified in kwArgs and connects signals
* @return
*/
addChild : function(kwArgs) {
kwArgs = MochiKit.Base.update ( {
name : '',
title : '',
img : { uri: '', dx: 0, dy: 0 }
}, kwArgs);
var partial = MochiKit.Base.partial;
var signal = MochiKit.Signal.signal;
var connect = MochiKit.Signal.connect;
var navItem = new bobj.crv.PanelNavigatorItem (kwArgs.name, kwArgs.img, kwArgs.title, 35 * this._children.length);
connect (navItem, "switchPanel", partial (signal, this, "switchPanel"));
this._children.push (navItem);
},
resize : function(w, h) {
bobj.setOuterSize (this.layer, w, h);
bobj.setOuterSize (this._innerBorder, w -2, h -2); //Since border size is 1px for all edges
},
getBestFitHeight : function () {
var height = 0;
for ( var i = 0; i < this._children.length; i++)
height += this._children[i].getHeight();
return height;
},
move : Widget_move,
getWidth : Widget_getWidth
};

View File

@@ -0,0 +1,105 @@
/**
*
* @param name [String] Name of itme
* @param img [String] uri location of icon image
* @param title [String] tooltip
*/
bobj.crv.PanelNavigatorItem = function(name, img, title, topOffset) {
this._name = name;
this._img = img;
this._isSelected = false;
this._title = title;
this.topOffset = topOffset;
this.widgetType = 'PanelNavigatorItem';
this.id = bobj.uniqueId () + "_navItem_" + name;
};
bobj.crv.PanelNavigatorItem.prototype = {
getHTML : function() {
var h = bobj.html;
var img = this._img;
return h.DIV ( {
id : this.id,
'class' : 'panelNavigatorItem',
'tabindex' : '0',
style : {top : this.topOffset + "px"},
title : this._title,
role : 'button'
}, imgOffset(img.uri, 22, 22, img.dx, img.dy, null, 'class="panelNavigatorItemImage" title="' + this._title + '"')
);
},
getName : function() {
return this._name;
},
init : function() {
this.layer = getLayer (this.id);
this.css = this.layer.style;
var connect = MochiKit.Signal.connect;
connect (this.layer, "onclick", this, this._onClick);
connect (this.layer, "onkeydown", this, this._onKeyDown);
connect (this.layer, "onmouseover", this, this._onMouseOver);
connect (this.layer, "onmouseout", this, this._onMouseOut);
connect (this.layer, "onfocus", this, this._onFocus);
connect (this.layer, "onblur", this, this._onBlur);
this.setSelected (this._isSelected);
},
_onFocus : function () {
MochiKit.DOM.addElementClass (this.layer, "highlighted");
},
_onBlur : function () {
MochiKit.DOM.removeElementClass (this.layer, "highlighted");
},
_onMouseOver : function () {
MochiKit.DOM.addElementClass (this.layer, "highlighted");
},
_onMouseOut : function () {
MochiKit.DOM.removeElementClass (this.layer, "highlighted");
},
_onKeyDown : function(ev) {
if (ev && ev.key () && (ev.key ().code == 13 || ev.key ().code == 32)) // On Enter or spacebar, signal swith panel
this._signalSwitchPanel();
},
_onClick : function() {
this._signalSwitchPanel ();
},
/**
* Signals switch panel if it's not currently selected
* @return
*/
_signalSwitchPanel : function () {
if(!this._isSelected)
MochiKit.Signal.signal (this, "switchPanel", this._name);
},
/**
* @param isSelected [Boolean] is item selected or not selected
*/
setSelected : function(isSelected) {
this._isSelected = isSelected;
var DOM = MochiKit.DOM;
if (this.layer) {
if (isSelected)
DOM.addElementClass (this.layer, "selected");
else
DOM.removeElementClass (this.layer, "selected");
}
},
getWidth : Widget_getWidth,
getHeight: Widget_getHeight,
setDisplay : Widget_setDisplay,
isDisplayed : Widget_isDisplayed
};

View File

@@ -0,0 +1,517 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
if (typeof bobj.crv.params == 'undefined') {
bobj.crv.params = {};
}
bobj.crv.params.DataTypes = {
DATE: "d",
DATE_TIME: "dt",
TIME: "t",
STRING: "s",
NUMBER: "n",
CURRENCY: "c",
BOOLEAN: "b"
};
bobj.crv.params.RangeBoundTypes = {
UNBOUNDED: 0,
EXCLUSIVE: 1,
INCLUSIVE: 2
};
bobj.crv.params.DefaultDisplayTypes = {
Description: 0,
DescriptionAndValue: 1
};
bobj.crv.params.CompareResults = {
TOO_BIG: 1,
TOO_SMALL: -1,
EQUAL: 0
};
/*
================================================================================
Parameter
================================================================================
*/
/**
* Constructor.
*/
bobj.crv.params.Parameter = function(paramInfo) {
var PARAMS = bobj.crv.params;
var displayTypes = PARAMS.DefaultDisplayTypes;
MochiKit.Base.update(this, {
paramName: null,
reportName: null,
description: null,
valueDataType: null,
value: null,
modifiedValue: null,
defaultValues: null,
defaultDisplayType : displayTypes.DescriptionAndValue,
maxValue: null,
minValue: null,
allowCustomValue: true,
allowDiscreteValue: true,
allowMultiValue: false,
allowNullValue: false,
allowRangeValue: false,
editMask: null,
isOptionalPrompt: false,
isEditable: true,
isHidden: false,
isDataFetching: false,
attributes: null,
isInUse : false,
isShowOnPanel : false
}, paramInfo);
};
/**
* IMPORTANT! Use getValue and setValue to access the value of the parameter, instead of the property itself.
*/
bobj.crv.params.Parameter.prototype = {
getTitle: function() {
return (this.description || this.paramName);
},
isInteractive : function () {
return this.isInUse && (this.isShowOnPanel || this.isEditable);
},
getName: function () {
return this.paramName;
},
hasLOV: function() {
return (this.defaultValues != null && this.defaultValues.length > 0);
},
hasDescription: function() {
return this.description != null;
},
isPassword: function() {
return (this.editMask !== null && this.editMask.toLowerCase() == "password");
},
getValue: function() {
this._initModifiedValue();
return this.modifiedValue;
},
/*
* Undos any modifications done on parameter that have not been commited
*/
reset: function() {
delete this.modifiedValue;
},
removeValueAt: function(index) {
this._initModifiedValue();
var value = this.modifiedValue[index];
this.modifiedValue.splice(index, 1);
},
// setValue accepts either an array, or an int + an object.
setValue: function (i, newValue) {
this._initModifiedValue();
if (arguments.length == 1 && bobj.isArray(arguments[0])) {
var value= arguments[0];
this.modifiedValue = value;
}
else if (arguments.length == 2) {
var oldValue = this.modifiedValue[i];
this.modifiedValue[i] = newValue;
}
},
clearValue: function() {
this._initModifiedValue();
this.modifiedValue = [];
},
// commitValue will actually apply the changes made so far
commitValue: function() {
this._initModifiedValue();
this.value = this.modifiedValue.slice(0);
},
_initModifiedValue: function() {
if (!this.modifiedValue) {
if (bobj.isArray(this.value)) {
this.modifiedValue = this.value.slice(0); // make a deep copy of "value"
}
else {
this.modifiedValue = [];
}
}
},
isDCP: function () {
if (this.attributes != null) {
if (this.attributes['IsDCP'] === true) {
return true;
}
}
return false;
}
};
/*
================================================================================
Validator for Parameters
================================================================================
*/
bobj.crv.params.Validator = function(){};
bobj.crv.params.Validator.ValueStatus = {
OK: 0,
ERROR: 1,
VALUE_MISSING: 2, // Required value is missing
VALUE_INVALID_TYPE: 3, // Value has the wrong data type
VALUE_TOO_LONG: 4, // Value's length is less than the minimum
VALUE_TOO_SHORT: 5, // Value's length is greater than the maximum
VALUE_TOO_BIG: 6, // Value is greater than the maximum
VALUE_TOO_SMALL: 7, // Value is less than the minimum
VALUE_DUPLICATE: 8
};
bobj.crv.params.Validator.getInstance = function(){
if (!bobj.crv.params.Validator.__instance) {
bobj.crv.params.Validator.__instance = new bobj.crv.params.Validator();
}
return bobj.crv.params.Validator.__instance;
};
bobj.crv.params.Validator.prototype = {
/**
* Validate a Parameter instance and return a status object
*/
validateParameter: function(param) {
var PARAMS = bobj.crv.params;
if (!param) {return null;}
var Status = PARAMS.Validator.ValueStatus;
if (!bobj.isArray(param.value) || !param.value.length) {
return {
isValid: false,
reason: Status.VALUE_MISSING
};
}
var isValid = true;
var statusList = [];
for (var i = 0, len = param.values.length; i < len; ++i) {
var status = PARAMS.validateValue(param, i);
statusList.push(status);
isValid = isValid && (status === ValueStatus.OK);
}
return {
isValid: isValid,
statusList: statusList
};
},
/**
* Validate a parameter value and return a status code
*/
validateValue: function(param, value) {
var Status = bobj.crv.params.Validator.ValueStatus;
if (!param || !bobj.isArray(param.value) || (value === undefined)) {
return Status.ERROR;
}
var validatorFunc = this._getTypeValidatorFunc(param.valueDataType);
if (!validatorFunc) {
return Status.ERROR;
}
var actualValue = bobj.crv.params.getValue(value);
return validatorFunc(param, actualValue);
},
_getTypeValidatorFunc: function(type) {
var Type = bobj.crv.params.DataTypes;
switch (type) {
case Type.STRING:
return this._validateString;
case Type.NUMBER:
case Type.CURRENCY:
return this._validateNumber;
case Type.DATE:
case Type.TIME:
case Type.DATE_TIME:
return this._validateDateTime;
case Type.BOOLEAN:
return this._validateBoolean;
default:
return null;
}
},
_validateString: function(param, value) {
var Status = bobj.crv.params.Validator.ValueStatus;
if (!bobj.isString(value)) {
return Status.VALUE_INVALID_TYPE;
}
var maxValue = param.maxValue;
var minValue = param.minValue;
if (bobj.isNumber(maxValue) && value.length > maxValue) {
return Status.VALUE_TOO_LONG;
}
if (bobj.isNumber(minValue) && value.length < minValue) {
return Status.VALUE_TOO_SHORT;
}
return Status.OK;
},
_validateNumber: function(param, value) {
//the "value" passed in here is a number that has at most one decimal separator and no group separator
var Status = bobj.crv.params.Validator.ValueStatus;
var regNumber = /^(\+|-)?(\d+((\.\d+)|(\.))?|\.\d+)$/;
if(bobj.isString(value) && regNumber.test(value)) {
value = parseFloat(value);
}
else if(!bobj.isNumber(value)) {
return Status.VALUE_INVALID_TYPE;
}
var maxValue = param.maxValue;
var minValue = param.minValue;
if(maxValue !== null && value > maxValue) {
return Status.VALUE_TOO_BIG;
}
else if(minValue !== null && value < minValue) {
return Status.VALUE_TOO_SMALL;
}
else {
return Status.OK;
}
},
_validateDateTime: function(param, value) {
var Result = bobj.crv.params.CompareResults;
var Status = bobj.crv.params.Validator.ValueStatus;
if (bobj.isObject(value)) {
var isNumber = function(sel) {return bobj.isNumber(value[sel]);};
if (MochiKit.Iter.every(['d','m', 'y', 'h', 'min', 's', 'ms'], isNumber)) {
var compareFunc = bobj.crv.params.getDateCompareFunc(param.valueDataType);
if(param.minValue && compareFunc(param.minValue,value) == Result.TOO_BIG) {
return Status.VALUE_TOO_SMALL;
}
else if(param.maxValue && compareFunc(param.maxValue,value) == Result.TOO_SMALL) {
return Status.VALUE_TOO_BIG;
}
else {
return Status.OK;
}
}
}
return Status.VALUE_INVALID_TYPE;
},
_validateBoolean: function(param, value) {
return bobj.crv.params.Validator.ValueStatus.OK;
}
};
/*
================================================================================
Utility Functions
================================================================================
*/
/**
* Get an object that represents a Date and can be serialized to a json string
*
* @param date [Date] The Date instance that should be represented as json
*
* @return [Object] Object representing the date with (key, value) pairs
*/
bobj.crv.params.dateToJson = function(date) {
return {
d: date.getDate(),
m: date.getMonth(),
y: date.getFullYear(),
h: date.getHours(),
min: date.getMinutes(),
s: date.getSeconds(),
ms: date.getMilliseconds()
};
};
bobj.crv.params.getDateCompareFunc = function(type) {
var PARAMS = bobj.crv.params;
var Type = PARAMS.DataTypes;
switch (type) {
case Type.DATE:
return PARAMS.compareDate;
case Type.TIME:
return PARAMS.compareTime;
case Type.DATE_TIME:
return PARAMS.compareDateTime;
default:
return null;
}
};
bobj.crv.params.compareDateTime = function(dateTimeA, dateTimeB) {
var PARAMS = bobj.crv.params;
var Result = PARAMS.CompareResults;
var dateResult = PARAMS.compareDate(dateTimeA,dateTimeB);
var timeResult = PARAMS.compareTime(dateTimeA,dateTimeB);
if(dateResult == Result.EQUAL && timeResult == Result.EQUAL) {
return Result.EQUAL;
}
if(dateResult != Result.EQUAL) {
return dateResult;
}
else {
return timeResult;
}
};
/*
* Compares two dates
* @param dateA [JSON DateTime {y,m,d,h,m,s,ms}] first date value
* @param dateB [JSON DateTime {y,m,d,h,m,s,ms}] second date value
*
* @return
* 0: dateA = dateB
* 1: dateA > dateB
* -1: dateA < dateB
*/
bobj.crv.params.compareDate = function(dateTimeA, dateTimeB) {
var Result = bobj.crv.params.CompareResults;
if( dateTimeA.d == dateTimeB.d && dateTimeA.m == dateTimeB.m && dateTimeA.y == dateTimeB.y){
return Result.EQUAL;
}
if( dateTimeA.y > dateTimeB.y) {
return Result.TOO_BIG;
}
else if(dateTimeA.y < dateTimeB.y) {
return Result.TOO_SMALL;
}
if(dateTimeA.m > dateTimeB.m) {
return Result.TOO_BIG;
}
else if(dateTimeA.m < dateTimeB.m) {
return Result.TOO_SMALL;
}
if(dateTimeA.d > dateTimeB.d) {
return Result.TOO_BIG;
}
else if(dateTimeA.d < dateTimeB.d) {
return Result.TOO_SMALL;
}
};
/*
* Compares two times
* @param timeA [JSON DateTime {y,m,d,h,m,s,ms}] first time value
* @param timeB [JSON DateTime {y,m,d,h,m,s,ms}] second time value
*
* @return
* 0: dateA = dateB
* 1: dateA > dateB
* -1: dateA < dateB
*/
bobj.crv.params.compareTime = function(dateTimeA,dateTimeB) {
var Result = bobj.crv.params.CompareResults;
if(dateTimeA.h == dateTimeB.h && dateTimeA.min == dateTimeB.min && dateTimeA.s == dateTimeB.s && dateTimeA.ms == dateTimeB.ms) {
return Result.EQUAL;
}
if(dateTimeA.h > dateTimeB.h) {
return Result.TOO_BIG;
}
else if(dateTimeA.h < dateTimeB.h){
return Result.TOO_SMALL;
}
if(dateTimeA.min > dateTimeB.min) {
return Result.TOO_BIG;
}
else if(dateTimeA.min < dateTimeB.min) {
return Result.TOO_SMALL;
}
if(dateTimeA.s > dateTimeB.s) {
return Result.TOO_BIG;
}
else if(dateTimeA.s < dateTimeB.s) {
return Result.TOO_SMALL;
}
if(dateTimeA.ms > dateTimeB.ms) {
return Result.TOO_BIG;
}
else if(dateTimeA.ms < dateTimeB.ms){
return Result.TOO_SMALL;
}
};
/**
* Get a Date instance from an object containing (key, value) pairs
*
* @param json [Object] Object with keys that match Date properties
*
* @return [Date] Returns a Date instance
*/
bobj.crv.params.jsonToDate = function(json) {
var date = new Date();
if (json) {
date.setFullYear(json.y || 0, json.m || 0, json.d || 1);
date.setHours(json.h || 0);
date.setMinutes(json.min || 0);
date.setSeconds(json.s || 0);
date.setMilliseconds(json.ms || 0);
}
return date;
};
bobj.crv.params.getValue = function (pair) {
if (pair === undefined || pair === null || pair.value === undefined)
return pair;
return pair.value;
};
bobj.crv.params.getDescription = function (pair) {
if (pair === undefined || pair === null || pair.desc === undefined)
return null;
return pair.desc;
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,170 @@
/*
================================================================================
ParameterDialog
Advanced Dialog for editing parameters using the prompt engine
================================================================================
*/
bobj.crv.params.newParameterDialog = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId(),
prompt: null,
showCB : null,
hideCB : null
}, kwArgs);
var o = newDialogBoxWidget(
kwArgs.id,
L_bobj_crv_ParamsDlgTitle,
kwArgs.width,
kwArgs.height /*,defaultCB,cancelCB,noCloseButton*/);
// Update instance with constructor arguments
bobj.fillIn(o, kwArgs);
// Update instance with member functions
o._showDialogBox = o.show;
o._initDialogBox = o.init;
o._resizeSignal = null;
MochiKit.Base.update(o, bobj.crv.params.ParameterDialog);
return o;
};
bobj.crv.params.ParameterDialog = {
init : function() {
this._initDialogBox ();
this._form = document.getElementById (this.id + '_form');
window.paramWindow = this;
},
_checkInitialization : function() {
if (!this.layer) {
targetApp (this.getHTML ());
this.init ();
}
},
show : function(show) {
if (show) {
this._checkInitialization ();
this.doLayout ();
this.setResize (MochiKit.Base.noop);
this._showDialogBox (true);
o._resizeSignal = MochiKit.Signal.connect(window, 'onresize', this, '_onWindowResize');
} else {
if (this.layer)
this._showDialogBox (false);
bobj.crv.SignalDisposer.dispose(o._resizeSignal, true);
}
if (show && this.showCB) {
this.showCB ();
} else if (!show && this.hideCB) {
this.hideCB ();
}
},
isVisible : function() {
return (this.initialized () && this.isDisplayed ());
},
/* if dialog's height is less than window's height, it would return dialog's height
if dialog's height is greater than window's height, it would return window's height - 100
if dialog's height is less than 100, it would return 100
*/
getPreferredHeight : function () {
return Math.min(Math.max (100, winHeight() - 100), this.getFormHeight());
},
getFormHeight : function () {
var form = this._form.cloneNode(true);
form.style.display = "none";
form.style.height ="";
document.body.appendChild(form);
var dimension = MochiKit.Style.getElementDimensions(form);
form.innerHTML = ""; // http://support.microsoft.com/kb/925014
document.body.removeChild(form);
return dimension.h;
},
_onWindowResize : function () {
window.paramWindow.doLayout();
window.paramWindow.center();
},
doLayout: function () {
if(this._form) {
this._form.style.height = this.getPreferredHeight() + "px";
}
},
updateHtmlAndDisplay : function(html) {
if (html) {
this._checkInitialization ();
if (this.isDisplayed ()) {
this.show (false);
}
var ext = bobj.html.extractHtml (html);
var styleText = "";
for ( var i = 0, len = ext.styles.length; i < len; i++) {
styleText += ext.styles[i].text + '\n';
}
var styleLayerID = this.id + '_stylesheet';
var styleLayer = getLayer(styleLayerID);
if(styleLayer) {
MochiKit.DOM.removeElement (styleLayer);
}
if(styleText.length > 0) {
bobj.addStyleSheet (styleText, styleLayerID);
}
if (this._form) {
this._form.innerHTML = '<div style="overflow:auto">' + ext.html + '</div>';
}
var callback = function (parameterDialog, scripts) {
return function () {
//Must show dialog before executing scripts as scripts could change scroll position
parameterDialog.show(true);
for ( var iScripts = 0, scriptsLen = scripts.length; iScripts < scriptsLen; ++iScripts) {
var script = scripts[iScripts];
if (!script) {
continue;
}
if (script.text) {
bobj.evalInWindow (script.text);
}
}
}
}(this, ext.scripts);
//CSS links in extracted html are first loaded, then dialog is shown to correctly calcualte
//the width and height of dialog
bobj.includeCSSLinksAndExecuteCallback ( ext.links, callback);
}
},
getHTML : function(html) {
var FORM = bobj.html.FORM;
var DIV = bobj.html.DIV;
var onsubmit = 'eventCancelBubble(event);return false;';
return this.beginHTML() +
DIV({'class' : 'dlgFrame naviBarFrame', style : { padding : '20px 15px 5px 20px'}}, FORM({id: this.id + '_form', style : {overflow : 'auto'}, onsubmit: onsubmit})) +
this.endHTML();
}
};

View File

@@ -0,0 +1,88 @@
/*
================================================================================
ParameterInfoRow
Internal class for use by ParameterUI. Draws a UI for a single info row.
This row is always displayed as last child of parameterUI
================================================================================
*/
bobj.crv.params.ParameterInfoRow = function(parentId) {
this.layer = null;
this.parentId = parentId;
this.id = bobj.uniqueId();
};
bobj.crv.params.ParameterInfoRow.prototype = {
setTabDisabled : function(dis) {
if (this.layer) {
bobj.disableTabbingKey(this.layer, dis)
}
},
init : function() {
var parent = getLayer(this.parentId);
if (parent) {
append2(parent, this.getHTML());
this.layer = getLayer(this.id);
}
if(this.layer) {
MochiKit.Signal.connect(this.layer, "onclick", this, '_onClick');
MochiKit.Signal.connect(this.layer, "onkeydown", this, '_onKeyDown');
}
},
getHTML : function() {
return bobj.html.DIV( {
'class' :'parameterInfoRow',
id :this.id,
"tabIndex" : "0"
});
},
setText : function(text) {
if (!this.layer)
this.init();
this.layer.innerHTML = text;
},
setVisible : function(isVisible) {
if (isVisible) {
if (!this.layer)
this.init();
this.shiftToLastRow();
this.layer.style.display = "block";
} else {
if (this.layer)
this.layer.style.display = "none";
}
},
/**
* ParamterInfoRow must always be displayed after all ParmeterValueRows
* @return
*/
shiftToLastRow : function() {
var parentNode = getLayer(this.parentId);
if (this.layer && parentNode) {
parentNode.removeChild(this.layer);
parentNode.appendChild(this.layer);
}
},
_onClick : function (ev) {
MochiKit.Signal.signal(this, "switch");
ev.stop();
},
_onKeyDown : function (ev) {
if(ev && ev.key() && ev.key().code == 13) {
MochiKit.Signal.signal(this, "switch");
ev.stop();
}
}
};

View File

@@ -0,0 +1,277 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
/*
================================================================================
ParameterPanel
================================================================================
*/
/**
* Constructor
*/
bobj.crv.params.newParameterPanel = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId() + '_IPPanel'
}, kwArgs);
var o = newWidget(kwArgs.id);
o.widgetType = 'ParameterPanel';
// Update instance with constructor arguments
bobj.fillIn(o, kwArgs);
// Update instance with member functions
MochiKit.Base.update(o, bobj.crv.params.ParameterPanel);
o._tabPanel = bobj.crv.newStackedPanel({
id: o.id + '_ParamtersStack'
});
//Layer that appears on top of panel when it is disabled; necessary for preventing user to select parameters/widgets
o._overlayLayer = new bobj.crv.params.ParameterPanel.OverlayLayer(o.id);
o._toolbar = bobj.crv.params.newParameterPanelToolbar({
id: o.id + '_IPToolbar'
});
return o;
};
bobj.crv.params.ParameterPanel = {
setToolbarCallBacks : function(applyClickCB, resetClickCB) {
if(this._toolbar) {
this._toolbar.applyClickCB = applyClickCB;
this._toolbar.resetClickCB = resetClickCB;
}
},
/**
* Disables panel by showing modal layer on top of panel, reducing opacity of panel, and disabling tabbing between widgets
*/
setDisabled : function(dis) {
this._overlayLayer.setVisible (dis);
this.setTabDisabled (dis);
},
/**
* Disables tabbing for toolbar and all parameters within panel
*/
setTabDisabled : function(dis) {
this._toolbar.setTabDisabled (dis);
this._tabPanel.setTabDisabled (dis);
},
init : function() {
Widget_init.call (this);
this._toolbar.init ();
if (this._tabPanel) {
this._tabPanel.init ();
}
MochiKit.Signal.signal (this, "resetParamPanel");
},
update : function (update) {
if (update && update.cons == "bobj.crv.params.newParameterPanel") {
if(update.args && update.args.isResetParamPanel)
MochiKit.Signal.signal (this, "resetParamPanel");
}
},
getHTML : function() {
var DIV = bobj.html.DIV;
var layerStyle = {
overflow : 'hidden',
width : this.width ? bobj.unitValue(this.width) : 'auto',
height : this.height ? bobj.unitValue(this.height) : 'auto'
}
var innerHTML = this._toolbar.getHTML ();
if (this._tabPanel) {
innerHTML += this._tabPanel.getHTML ();
}
return DIV ( {
id : this.id,
style : layerStyle
}, innerHTML);
},
getBestFitHeight : function () {
var height = 0;
if(this._tabPanel) {
/**
* Since container of parampanel could be invisible, getHiddenElementDimensions has to be called
* instead of element.getHeight()
*/
height += bobj.getHiddenElementDimensions(this._tabPanel.layer).h;
}
if(this._toolbar)
height += this._toolbar.getHeight ();
return height;
},
/**
* Resize the panel
*
* @param w [int - optional] Width in pixels
* @param h [int - optional] Height in pixels
*/
resize : function(w, h) {
Widget_resize.call (this, w, h);
if (this._toolbar) {
w = this.layer.clientWidth;
this._toolbar.resize (w);
if (this._tabPanel) {
h = this.layer.clientHeight - this._toolbar.getHeight ();
this._tabPanel.resize (w, h);
}
}
},
/**
* Add a ParameterUI instance to the panel
*
* @param paramUI [ParameterUI]
* @param label [String] Parameter title
* @param isDataFetching [bool] Shows the data fetching icon when true
*/
addParameter : function(kwArgs) {
kwArgs = MochiKit.Base.update ( {
paramUI : null,
label : null,
isDataFetching : false,
openAdvCB : null,
clearValuesCB : null,
id : this._tabPanel.id + '_P' + (this._tabPanel.getNumTabs () + 1)
}, kwArgs);
if (kwArgs.paramUI) {
var paramTab = bobj.crv.newStackedTab (kwArgs);
paramTab.setContent (kwArgs.paramUI);
this._tabPanel.addTab (paramTab);
}
},
/**
* Remove a ParameterUI instance from the panel
*
* @param index [int] Index of the widget
*/
removeParameter : function(index) {
this._tabPanel.removeTab(index);
},
getWidth : function() {
if (this.layer) {
return this.layer.offsetWidth;
}
return this.width;
},
setResetButtonEnabled : function(isEnabled) {
this._toolbar.resetButton.setDisabled (!isEnabled);
var tooltip = isEnabled ? L_bobj_crv_ResetTip : L_bobj_crv_ResetDisabledTip;
this._toolbar.resetButton.changeTooltip (tooltip, true);
},
setApplyButtonEnabled : function(isEnabled) {
this._toolbar.applyButton.setDisabled (!isEnabled);
var tooltip = isEnabled ? L_bobj_crv_ParamsApplyTip : L_bobj_crv_ParamsApplyDisabledTip;
this._toolbar.applyButton.changeTooltip (tooltip, true);
},
isApplyButtonEnabled : function () {
return this._toolbar != null && this._toolbar.applyButton != null && !this._toolbar.applyButton.isDisabled();
},
getIndex : function(paramUI) {
var numTabs = this._tabPanel.getNumTabs ();
for ( var idx = 0; idx < numTabs; ++idx) {
var tab = this._tabPanel.getTab (idx);
if (tab.getContent () === paramUI) {
return idx;
}
}
return -1;
},
getParameterTabByWidget : function(paramUI) {
var index = this.getIndex (paramUI);
if (index >= 0)
return this._tabPanel.getTab (index);
return null;
},
getParameter : function(index) {
var tab = this._tabPanel.getTab (index);
if (tab) {
return tab.getContent ();
}
return null;
},
/**
* @return ParameterTab, tab specified by index
*/
getParameterTab : function(index) {
return this._tabPanel.getTab (index);
},
/**
* return Number of tabs/parameters in panel
*/
getParameterCount : function() {
return this._tabPanel.getNumTabs ();
}
};
/**
* A layer that appears on top of panel when it is disabled. Prevents user from selecting widgets
* inside panel
*/
bobj.crv.params.ParameterPanel.OverlayLayer = function(paramPanelID) {
this.paramPanelId = paramPanelID;
this.layer = null;
this.id = bobj.uniqueId();
this.widx = _widgets.length
_widgets[this.widx] = this;
return this;
};
bobj.crv.params.ParameterPanel.OverlayLayer.prototype = {
setVisible: function(visible) {
if(!this.layer) {
this.init();
}
if(this.css) {
this.css.visibility = visible ? "visible" : "hidden";
}
},
isVisible: function() {
if(!this.layer) {
this.init();
}
return this.css.visibility == "visible";
},
getHTML: function() {
return '<div id = ' + this.id + ' onselectstart="return false" ondragstart="return false" onmousedown="'+_codeWinName+'.eventCancelBubble(event)" border="0" hspace="0" vspace="0" src="'+_skin+'../transp.gif" class="paramPanelOverLay">'+(_ie?img(_skin+'../transp.gif','100%','100%',null,'ISMAP'):'')+'</div>'
},
init: function() {
var paramPanelLayer = getLayer(this.paramPanelId);
if(paramPanelLayer) {
append2(paramPanelLayer, this.getHTML()); //adds overlay layer to parameter panel layer
}
Widget_init.call(this);
}
}

View File

@@ -0,0 +1,104 @@
/*
================================================================================
ParameterPanelToolbar
Contains the Delete and Run buttons
================================================================================
*/
/**
* Constructor
*/
bobj.crv.params.newParameterPanelToolbar = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId()
}, kwArgs);
var o = newPaletteContainerWidget(kwArgs.id);
bobj.fillIn(o, kwArgs);
o.widgetType = 'ParameterPanelToolbar';
// Attach member functions
o._paletteContainerInit = o.init;
MochiKit.Base.update(o, bobj.crv.params.ParameterPanelToolbar);
o._palette = newPaletteWidget(o.id + "_palette");
o.add(o._palette);
var bind = MochiKit.Base.bind;
o.applyButton = newIconWidget(
o.id + '_applyBtn',
bobj.crv.allInOne.uri,
bind(o._onApplyClick, o), //clickCB,
L_bobj_crv_ParamsApply, //text
L_bobj_crv_ParamsApplyDisabledTip,//tooltip,
16, 16, 3, 3 + bobj.crv.allInOne.paramRunDy, 25, 3 + bobj.crv.allInOne.paramRunDy, false); //width, height, dx, dy, disDx, disDy
o.applyButton.setClasses("", "", "", ""); //FIXME : saeed, Assign css class
o.resetButton = newIconWidget(
o.id + '_resetBtn',
bobj.crv.allInOne.uri,
bind(o._onResetClick, o), //clickCB,
L_bobj_crv_Reset, //text
L_bobj_crv_ResetDisabledTip,//tooltip,
16, 16, 0, bobj.crv.allInOne.undoDy, 16, bobj.crv.allInOne.undoDy, false); //width, height, dx, dy, disDx, disDy
o.resetButton.setClasses("", "", "", ""); //FIXME : saeed, Assign css class
o._palette.add(o.applyButton);
o._palette.add(); // separator
o._palette.add(o.resetButton);
return o;
};
bobj.crv.params.ParameterPanelToolbar = {
init : function() {
this._paletteContainerInit ();
this._palette.init ();
this.applyButton.setDisabled (true);
this.resetButton.setDisabled (true);
},
/**
* Disables tabbing for all buttons in toolbar
*/
setTabDisabled : function(dis) {
var items = [ this.applyButton, this.resetButton ];
for ( var i = 0, len = items.length; i < len; i++) {
var item = items[i];
if (item) {
bobj.disableTabbingKey (item.layer, dis);
}
}
},
/**
* Overrides parent. Opens the toolbar's tags.
*/
beginHTML : function() {
return bobj.html.openTag ('div', {
id : this.id,
'class' : 'parameterPanelToolbar'
});
},
getHTML : function() {
return (this.beginHTML () + this._palette.getHTML () + this.endHTML ());
},
_onApplyClick : function() {
if (this.applyClickCB) {
bobj.crv.logger.info ('UIAction ParameterPanel.Apply');
this.applyClickCB ();
}
},
_onResetClick : function() {
if (this.resetClickCB) {
this.resetClickCB ();
}
}
};

View File

@@ -0,0 +1,404 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
/*
================================================================================
ParameterUI
Widget for displaying and editing parameter values. Contains one or many
ParameterValueRows and, optionally, UI that allows rows to be added.
================================================================================
*/
bobj.crv.params.newParameterUI = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId(),
canChangeOnPanel: false,
allowCustom: false,
isPassword : false,
isReadOnlyParam: true,
allowRange : false,
values: [],
defaultValues: null,
width: '200px',
changeValueCB: null,
enterPressCB: null,
openAdvDialogCB: null,
maxNumParameterDefaultValues: 200,
tooltip : null,
calendarProperties : {displayValueFormat : '' , isTimeShown : false, hasButton : false, iconUrl : ''},
maxNumValuesDisplayed : 7,
canOpenAdvDialog : false
}, kwArgs);
var o = newWidget(kwArgs.id);
// Update instance with constructor arguments
bobj.fillIn(o, kwArgs);
o.displayAllValues = false;
// Update instance with member functions
MochiKit.Base.update(o, bobj.crv.params.ParameterUI);
o._createMenu();
o._rows = [];
o._infoRow = new bobj.crv.params.ParameterInfoRow(o.id);
return o;
};
bobj.crv.params.ParameterUI = {
/**
* Creates single menubar for all parameter value rows of current param UI
*/
_createMenu : function() {
var dvLength = this.defaultValues.length;
if (dvLength > 0) {
var kwArgs = {
originalValues : this.defaultValues
};
if (dvLength == this.maxNumParameterDefaultValues) {
kwArgs.originalValues[this.maxNumParameterDefaultValues] = L_bobj_crv_ParamsMaxNumDefaultValues;
MochiKit.Base.update (kwArgs, {
openAdvDialogCB : this.openAdvDialogCB,
maxNumParameterDefaultValues : this.maxNumParameterDefaultValues
});
}
this._defaultValuesMenu = bobj.crv.params.newScrollMenuWidget (kwArgs);
} else {
this._defaultValuesMenu = null;
}
},
setFocusOnRow : function(rowIndex) {
var row = this._rows[rowIndex];
if (row)
row.focus ();
},
/*
* Disables tabbing if dis is true
*/
setTabDisabled : function(dis) {
for(var i = 0, len = this._rows.length; i < len; i++) {
this._rows[i].setTabDisabled(dis);
}
this._infoRow.setTabDisabled(dis);
},
init : function() {
Widget_init.call (this);
var rows = this._rows;
for ( var i = 0, len = rows.length; i < len; ++i) {
rows[i].init ();
}
MochiKit.Signal.connect(this._infoRow, "switch", this, '_onSwitchDisplayAllValues');
this.refreshUI ();
},
/**
* Processes actions triggered by clicks on "x more values" or "collapse" button displayed in inforow
*/
_onSwitchDisplayAllValues: function() {
this.displayAllValues = !this.displayAllValues;
var TIME_INTERVAL = 10; /* 10 msec or 100 actions per second */
var timerIndex = 0;
if(this.displayAllValues) {
if (this.values.length > this._rows.length) {
for(var i = this._rows.length, l = this.values.length; i < l; i++) {
var addRow = function(paramUI, value) {
return function() { return paramUI._addRow(value); };
};
timerIndex++;
setTimeout(addRow(this, this.values[i]), TIME_INTERVAL * timerIndex);
}
}
}
else {
if(this._rows.length > this.maxNumValuesDisplayed) {
for(var i = this._rows.length -1; i >= this.maxNumValuesDisplayed; i--) {
var deleteRow = function(paramUI, rowIndex) {
return function() { return paramUI.deleteValue(rowIndex); };
};
timerIndex++;
setTimeout(deleteRow(this, i), TIME_INTERVAL * timerIndex);
}
}
}
var signalResize = function(paramUI) {
return function() {MochiKit.Signal.signal(paramUI, 'ParameterUIResized'); };
};
setTimeout(signalResize(this), TIME_INTERVAL * timerIndex);
},
getHTML : function() {
var rowsHtml = '';
var values = this.values;
var rows = this._rows;
var rowsCount = Math.min (values.length, this.maxNumValuesDisplayed);
for ( var i = 0; i < rowsCount; ++i) {
rows.push (this._getRow (values[i]));
rowsHtml += rows[i].getHTML ();
}
return bobj.html.DIV ( {
id : this.id,
style : {
width : bobj.unitValue (this.width),
'padding-left' : '20px'
}
}, rowsHtml);
},
_getNewValueRowArgs : function(value) {
return {
value : value,
defaultValues : this.defaultValues,
width : this.width,
isReadOnlyParam : this.isReadOnlyParam,
canChangeOnPanel : this.canChangeOnPanel,
allowCustom : this.allowCustom,
isPassword : this.isPassword,
calendarProperties : this.calendarProperties,
defaultValuesMenu : this._defaultValuesMenu,
tooltip : this.tooltip,
isRangeValue : this.allowRange,
canOpenAdvDialog : this.canOpenAdvDialog
};
},
_getNewValueRowConstructor : function() {
return bobj.crv.params.newParameterValueRow;
},
_getRow : function(value) {
var row = this._getNewValueRowConstructor()(this._getNewValueRowArgs(value));
var bind = MochiKit.Base.bind;
row.changeCB = bind(this._onChangeValue, this, row);
row.enterCB = bind(this._onEnterValue, this, row);
return row;
},
_addRow : function(value) {
var row = this._getRow (value);
this._rows.push (row);
append (this.layer, row.getHTML ());
row.init ();
this.refreshUI ();
return row;
},
_onChangeValue : function(row) {
if (this.changeValueCB) {
this.changeValueCB (this._getRowIndex (row), row.getValue ());
}
},
_onEnterValue : function(row) {
if (this.enterPressCB) {
this.enterPressCB (this._getRowIndex (row));
}
},
_getRowIndex : function(row) {
if (row) {
var rows = this._rows;
for ( var i = 0, len = rows.length; i < len; ++i) {
if (rows[i] === row) {
return i;
}
}
}
return -1;
},
getNumValues : function() {
return this._rows.length;
},
refreshUI : function() {
if (this.allowRange)
this.alignRangeRows ();
var displayInfoRow = false;
var infoRowText = "";
if (this.values.length > this.maxNumValuesDisplayed) {
displayInfoRow = true;
if(this.displayAllValues)
infoRowText = L_bobj_crv_Collapse;
else {
var hiddenValuesCount = this.values.length - this.maxNumValuesDisplayed;
infoRowText = (hiddenValuesCount == 1) ? L_bobj_crv_ParamsMoreValue : L_bobj_crv_ParamsMoreValues;
infoRowText = infoRowText.replace ("%1", hiddenValuesCount);
}
}
this._infoRow.setText (infoRowText);
this._infoRow.setVisible (displayInfoRow);
},
getValueAt : function(index) {
var row = this._rows[index];
if (row) {
return row.getValue ();
}
return null;
},
getValues : function() {
var values = [];
for ( var i = 0, len = this._rows.length; i < len; ++i) {
values.push (this._rows[i].getValue ());
}
return values;
},
setValueAt : function(index, value) {
var row = this._rows[index];
if (row) {
row.setValue (value);
}
this.refreshUI ();
},
resetValues : function(values) {
if (!values) {
return;
}
this.values = values;
var valuesLen = values.length;
var rowsLen = this._rows.length;
//Resets value
for ( var i = 0; i < valuesLen && i < rowsLen; ++i) {
this._rows[i].reset (values[i]);
}
//removes newly added values that are not commited
if (rowsLen > valuesLen) {
for ( var i = rowsLen - 1; i >= valuesLen; --i) {
// delete from the end to minimize calls to setBgColor
this.deleteValue (i);
}
}
//re-adds removed values
else if (valuesLen > rowsLen) {
for ( var i = rowsLen; i < valuesLen && (this.displayAllValues || i < this.maxNumValuesDisplayed); ++i) {
var row = this._addRow (values[i]);
}
}
MochiKit.Signal.signal(this, 'ParameterUIResized');
this.refreshUI ();
},
alignRangeRows : function() {
if (!this.allowRange)
return;
var lowerBoundWidth = 0;
for ( var i = 0, l = this._rows.length; i < l; i++) {
var row = this._rows[i];
var rangeField = row._valueWidget;
lowerBoundWidth = Math.max (lowerBoundWidth, rangeField.getLowerBoundValueWidth ());
}
for ( var i = 0, l = this._rows.length; i < l; i++) {
var row = this._rows[i];
var rangeField = row._valueWidget;
rangeField.setLowerBoundValueWidth (lowerBoundWidth);
}
},
setValues : function(values) {
if (!values)
return;
this.values = values;
var valuesLen = values.length;
var rowsLen = this._rows.length;
for ( var i = 0; i < valuesLen && i < rowsLen; ++i) {
this._rows[i].setValue (values[i]);
}
if (rowsLen > valuesLen) {
for ( var i = rowsLen - 1; i >= valuesLen; --i) {
// delete from the end to minimize calls to setBgColor
this.deleteValue (i);
}
} else if (valuesLen > rowsLen) {
for ( var i = rowsLen; i < valuesLen && (this.displayAllValues || i < this.maxNumValuesDisplayed); ++i) {
this._addRow (values[i]);
}
}
MochiKit.Signal.signal(this, 'ParameterUIResized');
this.refreshUI ();
},
setCleanValue : function(index, value) {
var row = this._rows[index];
if (row)
row.setCleanValue (value);
},
deleteValue : function(index) {
if (index >= 0 && index < this._rows.length) {
var row = this._rows[index];
row.layer.parentNode.removeChild (row.layer);
_widgets[row.widx] = null;
this._rows.splice (index, 1);
var rowsLen = this._rows.length;
}
this.refreshUI ();
},
setWarning : function(index, warning) {
var row = this._rows[index];
if (row) {
row.setWarning (warning);
}
},
getWarning : function(index) {
var row = this._rows[index];
if (row)
return row.getWarning ();
return null;
},
resize : function(w) {
if (w !== null) {
this.width = w;
if (this.layer) {
bobj.setOuterSize (this.layer, w);
}
}
}
};

View File

@@ -0,0 +1,505 @@
/*
================================================================================
ParameterValueRow
Internal class for use by ParameterUI. Darws a UI for a single parameter value.
================================================================================
*/
bobj.crv.params.newParameterValueRow = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId(),
value: '',
defaultValues: null,
isReadOnlyParam: true,
canChangeOnPanel: false,
isRangeValue : false,
allowCustom: false,
isPassword: false,
calendarProperties : {displayValueFormat : '' , isTimeShown : false, hasButton : false, iconUrl : '', clickCB : null},
changeCB: null,
enterCB: null,
defaultValuesMenu: null,
tooltip : null,
canOpenAdvDialog : false
}, kwArgs);
var o = newWidget(kwArgs.id);
o.widgetType = 'ParameterValueRow';
o._prevValueString = kwArgs.value;
o._warning = null;
// Update instance with constructor arguments
bobj.fillIn(o, kwArgs);
// Update instance with member functions
MochiKit.Base.update(o, bobj.crv.params.ParameterValueRow);
return o;
};
bobj.crv.params.ParameterValueRow = {
setTabDisabled : function(dis) {
if (this._valueWidget)
this._valueWidget.setTabDisabled (dis);
if (this._calendarButton)
bobj.disableTabbingKey (this._calendarButton.layer, dis);
},
/**
* Resets widget, Restores old value, hides warning and adv dialog icons
*/
reset : function(value) {
this.value = value;
this._prevValueString = value;
this.setWarning(null);
/* Removing Red border color if previous value was errorneous */
MochiKit.DOM.removeElementClass(this.layer, "hasError");
if(this._valueWidget) {
this._valueWidget.reset(value);
}
},
init : function() {
Widget_init.call (this);
this._valueWidget.init ();
if (this._calendarButton) {
this._calendarButton.init ();
}
this._valueCtn = getLayer (this.id + '_vc');
this._btnCtn = getLayer (this.id + '_bc');
this._valBtnCtn = getLayer (this.id + '_vab');
if (MochiKit.Base.isIE ()) {
/* IE's 100% is different than other browsers,
even in standards compliant mode.... */
var marg = parseInt (MochiKit.Style.computedStyle (this._valueCtn, 'margin-right'), 10);
if (bobj.isNumber (marg)) {
this._valueWidget.layer.style.marginRight = (-1 * marg) + 'px';
}
}
},
calendarSetValue : function(value) {
this.setValue (value);
this.changeCB ();
},
getHTML : function() {
if (!this._valueWidget) {
this._valueWidget = this._getValueWidget ();
}
if (this.calendarProperties.hasButton && !this._calendarButton) {
var getValueCB = bobj.bindFunctionToObject (this.getValue, this);
var setValueCB = bobj.bindFunctionToObject (this.calendarSetValue, this);
this._calendarButton = bobj.crv.params.newCalendarButton ( {
calendarProperties : this.calendarProperties,
getValueCB : getValueCB,
setValueCB : setValueCB
});
}
var DIV = bobj.html.DIV;
var IMG = bobj.html.IMG;
var cssClass = ' iactParamRow';
if (this.canChangeOnPanel)
cssClass += ' editable';
else
cssClass += ' readOnly';
if (MochiKit.Base.isIE () && bobj.isQuirksMode ()) {
cssClass += ' ' + 'iactParamRowIE';
}
return DIV ( {
id : this.id,
'class' : cssClass
}, this.calendarProperties.hasButton ? this._getValueAndCalendarHTML () : this._getValueHTML ());
},
/**
* @return [String] Returns HTML for the the value
*/
_getValueHTML : function() {
var DIV = bobj.html.DIV;
var style = {};
if (MochiKit.Base.isIE () && bobj.isQuirksMode ()) {
style.position = "absolute";
style.top = "0px";
style.left = "0px";
}
return DIV ( {
id : this.id + '_vc',
'class' : 'iactParamValue',
style : style
}, this._valueWidget.getHTML ());
},
/**
* @return [String] Returns HTML for the value and a button beside it
*/
_getValueAndCalendarHTML : function() {
var style = {};
if (MochiKit.Base.isIE () && bobj.isQuirksMode ()) {
style.width = '100%';
}
var DIV = bobj.html.DIV;
var buttonRightOffset = (this._valueWidget.widgetType == "TextCombo") ? 16 : 0;
buttonRightOffset += "px";
var html = DIV ( {
id : this.id + "_vab",
style : style,
'class' : "iactParamValueAndButton"
}, this._getValueHTML (), DIV ( {
id : this.id + "_bc",
'class' : "iactValueIcon",
style : {
position : "absolute",
right : buttonRightOffset,
top : "0",
cursor : _hand
}
}, this._calendarButton.getHTML ()));
return html;
},
getNewValueWidgetConstructor : function() {
var showDefVals = this.defaultValuesMenu !== null && !this.isReadOnlyParam && this.canChangeOnPanel;
if (this.isRangeValue)
return bobj.crv.params.newRangeField;
else if (showDefVals)
return bobj.crv.params.newTextCombo;
else
return bobj.crv.params.newTextField;
},
getNewValueWidgetArgs : function() {
var isEditable = this.allowCustom && this.canChangeOnPanel;
return {
password : this.isPassword,
cleanValue : this.value,
editable : isEditable,
enterCB : bobj.bindFunctionToObject (this._onEnterPress, this),
keyUpCB : isEditable ? bobj.bindFunctionToObject (this._onKeyUp, this) : null,
tooltip : this.tooltip,
foreColor : this.isReadOnlyParam ? bobj.Colors.GRAY : bobj.Colors.BLACK,
focusCB : bobj.bindFunctionToObject (this.onFocus, this),
blurCB : bobj.bindFunctionToObject (this.onBlur, this),
canOpenAdvDialog : this.canOpenAdvDialog
};
},
/**
* Creates a widget to display/edit the value.
*
* @return [Widget]
*/
_getValueWidget : function() {
var cons = this.getNewValueWidgetConstructor ();
var widget = cons (this.getNewValueWidgetArgs ());
var showDefVals = this.defaultValuesMenu !== null && !this.isReadOnlyParam && this.canChangeOnPanel;
if (showDefVals) {
widget.setMenu (this.defaultValuesMenu);
widget.changeCB = bobj.bindFunctionToObject (this._onChange, this);
}
return widget;
},
onFocus : function() {
this.refreshWarningPopup ();
MochiKit.DOM.removeElementClass (this.layer, "hasError");
},
refreshWarningPopup : function() {
if (this._warning) {
var pos = getPosScrolled (this.layer);
var fontFamily = MochiKit.Style.computedStyle (this.layer, 'fontFamily');
var fontSize = MochiKit.Style.computedStyle (this.layer, 'fontSize');
var valueWidth = bobj.getStringWidth (this.getValue (), fontFamily, fontSize);
var leftOffset = this.layer.offsetWidth < valueWidth ? this.layer.offsetWidth : valueWidth;
var topOffset = 33;
bobj.crv.WarningPopup.getInstance ().show (this._warning.message, pos.x + leftOffset, pos.y + topOffset);
} else {
bobj.crv.WarningPopup.getInstance ().hide ();
MochiKit.DOM.removeElementClass (this.layer, "hasError");
}
var tooltipText = this._warning ? this.tooltip + this._warning.message : this.tooltip;
if (this._valueWidget)
this._valueWidget.setTooltip (tooltipText);
},
onBlur : function() {
if (this._warning) {
bobj.crv.WarningPopup.getInstance ().hide ();
MochiKit.DOM.addElementClass (this.layer, "hasError");
}
},
getValue : function() {
return this.value;
},
setValue : function(value) {
this.value = value;
if (this._valueWidget)
this._valueWidget.setValue (value);
},
setCleanValue : function(value) {
if (this._valueWidget)
this._valueWidget.setCleanValue(value);
},
/**
* Set keyboard focus to the widget and mark it as selected
*/
focus : function() {
if (this._valueWidget.widgetType == "TextCombo")
this._valueWidget.text.focus ();
else
this._valueWidget.focus ();
},
/**
* Display a warning icon with a tooltip message
*
* @param warning
* [String] Tooltip message. If null, warning is hidden.
*/
setWarning : function(warning) {
this._warning = warning;
this.refreshWarningPopup ();
},
getWarning : function() {
return this._warning;
},
/**
* Change the outer dimensions of the widget
*
* @param w
* [int, optional] Width in pixels
* @param h
* [int, optional] Height in pixels
*/
resize : function(w, h) {
bobj.setOuterSize (this.layer, w, h);
},
deleteValue : function() {
this._valueWidget.setValue ('', true);
},
/**
* Handle keyUp events when editing values or using keyboard navigation.
*
* @param e
* [keyup event]
*/
_onKeyUp : function(e) {
var event = new MochiKit.Signal.Event (src, e);
var key = event.key ().string;
var newValueString = this._valueWidget.getValue ();
switch (key) {
case "KEY_ESCAPE":
this._valueWidget.setValue (this._valueWidget.cleanValue);
this._onChange ();
break;
case "KEY_ARROW_LEFT":
case "KEY_ARROW_RIGHT":
case "KEY_HOME":
case "KEY_END":
case "KEY_TAB":
break;
default:
if (newValueString !== this._prevValueString) {
this._onChange ()
this._prevValueString = newValueString;
}
break;
}
},
/**
* Delete the current value
*/
deleteValue : function() {
this._valueWidget.setValue ('', true);
},
_onChange : function() {
this.value = this._valueWidget.getValue();
if (this.changeCB)
this.changeCB();
},
/**
* Handles Enter key press events.
*/
_onEnterPress : function() {
if(this.enterCB)
this.enterCB();
}
};
/*
================================================================================
CalendarButton
Internal class. Button that fits inline with parameter values
================================================================================
*/
bobj.crv.params.newCalendarButton = function(kwArgs) {
kwArgs = MochiKit.Base.update( {
id : bobj.uniqueId(),
calendarProperties : null,
getValueCB : null,
setValueCB : null,
calendarSignals : {
okSignal : null,
hideSignal : null,
cancelSignal : null
}
}, kwArgs);
if (kwArgs.getValueCB == null || kwArgs.setValueCB == null || kwArgs.calendarProperties == null)
throw "InvalidArgumentException";
var o = newIconWidget(
kwArgs.id,
kwArgs.calendarProperties.iconUrl,
null,
null,
L_bobj_crv_ParamsCalBtn,
14,14,0,0,0,0);
o.setClasses("", "", "", "iconcheckhover");
bobj.fillIn(o, kwArgs);
// Update instance with member functions
o.margin = 0;
o.oldInit = o.init;
MochiKit.Base.update(o, bobj.crv.params.CalendarButton);
o.clickCB = bobj.bindFunctionToObject(o.onClick, o);
return o;
};
bobj.crv.params.CalendarButton = {
onClick : function() {
var calendar = bobj.crv.Calendar.getInstance ();
var date = bobj.external.date.getDateFromFormat (this.getValueCB (), this.calendarProperties.displayValueFormat);
var connect = MochiKit.Signal.connect;
if (date)
calendar.setDate (date);
this.calendarSignals = {
okSignal : connect (calendar, calendar.Signals.OK_CLICK, this, 'onClickCalendarOKButton'),
cancelSignal : connect (calendar, calendar.Signals.CANCEL_CLICK, this, 'onClickCalendarCancelButton'),
hideSignal : connect (calendar, calendar.Signals.ON_HIDE, this, 'onHideCalendar')
};
var absPos = getPosScrolled (this.layer);
var x = absPos.x + this.getWidth ();
var y = absPos.y + this.getHeight () + 1;
calendar.setShowTime (this.calendarProperties.isTimeShown);
calendar.show (true, x, y);
},
onClickCalendarOKButton : function(date) {
var strValue = bobj.external.date.formatDate (date, this.calendarProperties.displayValueFormat);
this.setValueCB (strValue);
},
onClickCalendarCancelButton : function() {
this.clearCalendarSignals ();
},
clearCalendarSignals : function() {
for ( var identName in this.calendarSignals) {
bobj.crv.SignalDisposer.dispose(this.calendarSignals[identName], true);
this.calendarSignals[identName] = null;
}
},
onHideCalendar : function() {
this.clearCalendarSignals ();
if (this.layer.focus)
this.layer.focus ();
},
init : function() {
this.oldInit ();
this.layer.onfocus = IconWidget_realOverCB;
this.layer.onblur = IconWidget_realOutCB;
},
getHTML : function() {
var imgCode;
var h = bobj.html;
if (this.src) {
imgCode = h.DIV( {
style : {
overflow : 'hidden',
height : '14px',
position : 'relative',
top : '2px',
width : this.w + 'px'
}
}, simpleImgOffset(this.src, this.w, this.h, this.dx, this.dy, 'IconImg_' + this.id, null, this.alt,
'cursor:' + _hand), this.extraHTML);
} else {
imgCode = h.DIV( {
'class' : 'iconText',
'style' : {
width : '1px',
height : (this.h + this.border) + 'px'
}
});
}
var divStyle = {
margin : this.margin + 'px',
padding : '1px'
};
if (this.width) {
divStyle.width = this.width + 'px';
}
if (!this.disp) {
divStyle.display = 'none';
}
return h.DIV( {
style : divStyle,
id : this.id,
'class' : this.nocheckClass
}, (this.clickCB && _ie) ? lnk(imgCode, null, null, null, ' tabIndex="-1"') : imgCode);
}
};

View File

@@ -0,0 +1,295 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
/**
* PromptPage constructor
*
* @param kwArgs.id [String] DOM node id
* @param kwArgs.contentId [String] DOM node id of report page content container
* @param kwArgs.bgColor [String] Background color of the page
* @param kwArgs.width [Int] Page content's width in pixels
* @param kwArgs.height [Int] Page content's height in pixels
* @param kwArgs.topMargin [Int] Top margin of report page in pixels
* @param kwArgs.rightMargin [Int] Right margin of report page in pixels
* @param kwArgs.bottomMargin [Int] Bottom margin of report page in pixels
* @param kwArgs.leftMargin [Int] Left margin of report page in pixels
*/
bobj.crv.newPromptPage = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId(),
layoutType: 'fixed',
content : null,
width: 800,
height: 600,
padding: 5,
top: 0,
left: 0
}, kwArgs);
var o = newWidget(kwArgs.id);
o.widgetType = 'PromptPage';
o._reportProcessing = null;
// Update instance with constructor arguments
bobj.fillIn(o, kwArgs);
// Update instance with member functions
o.initOld = o.init;
MochiKit.Base.update(o, bobj.crv.PromptPage);
window[o.id] = o;
return o;
};
bobj.crv.PromptPage = {
/**
* Overrides parent. Sets the content of the report page.
*
* @param content
* [String|DOM Node] Html or Node to use as report page content
*/
setHTML : function(content) {
var pageNode = this._pageNode;
if (bobj.isString (content)) {
var ext = bobj.html.extractHtml(content);
pageNode.innerHTML = ext.html;
var links = ext.links;
for(var iLinks = 0, linksLen = links.length; iLinks < linksLen; ++iLinks) {
bobj.includeLink(links[iLinks]);
}
var scripts = ext.scripts;
for (var iScripts = 0, scriptsLen = scripts.length; iScripts < scriptsLen; ++iScripts) {
var script = scripts[iScripts];
if (!script) {continue;}
if (script.text) {
bobj.evalInWindow(script.text);
}
}
} else if (bobj.isObject (content)) {
pageNode.innerHTML = '';
pageNode.appendChild (content);
var contentStyle = content.style;
contentStyle.display = 'block';
contentStyle.visibility = 'visible';
}
},
getHTML : function() {
var h = bobj.html;
var isBorderBoxModel = bobj.isBorderBoxModel ();
var pageOuterHeight = this.height + this.topMargin + this.bottomMargin;
var pageOuterWidth = this.width + this.leftMargin + this.rightMargin;
var contentHeight = isBorderBoxModel ? pageOuterHeight : this.height;
var contentWidth = isBorderBoxModel ? pageOuterWidth : this.width;
var layerStyle = {
position : 'relative',
width : contentWidth + 'px',
height : contentHeight + 'px',
top : this.top + "px",
left : this.left + "px",
border : 'none',
'z-index' : 1,
'background-color' : this.bgColor
};
/* To support the width and height */
if (this.layoutType == 'fixed') {
layerStyle.overflow = 'auto';
}
var pageStyle = {
'padding' : this.padding + 'px'
};
var html = h.DIV ( {
id : this.id,
style : layerStyle
}, h.DIV ( {
id : this.id + '_page',
style : pageStyle
}));
return html;
},
init : function() {
this._pageNode = document.getElementById (this.id + '_page');
this.initOld ();
if (this.contentId) {
var content = document.getElementById (this.contentId);
if (content) {
this.setHTML (content);
}
}
else if(this.content) {
this.setHTML(this.content);
delete this.content;
}
var connect = MochiKit.Signal.connect;
if (this.layoutType.toLowerCase () == 'client') {
connect (window, 'onresize', this, '_doLayout');
}
this._doLayout ();
},
/* TODO: fix the layout (fitreport) to behave like XIR2 */
_doLayout : function() {
var layout = this.layoutType.toLowerCase ();
if ('client' == layout) {
this.css.width = '100%';
this.css.height = '100%';
} else if ('fitreport' == layout) {
this.css.width = '100%';
this.css.height = '100%';
} else { /* fixed layout */
if(this.width != null && this.width.length > 0) {
if(this.width.indexOf("px") > 0 || this.width.indexOf("%") > 0)
this.css.width = this.width;
else
this.css.width = this.width + 'px';
}
if(this.height != null && this.height.length > 0) {
if(this.height.indexOf("px") > 0 || this.height.indexOf("%") > 0)
this.css.height = this.height;
else
this.css.height = this.height + 'px';
}
}
var rptProcessing = this._reportProcessing;
if (rptProcessing && rptProcessing.layer) {
rptProcessing.center ();
}
},
addChild : function(widget) {
if (widget.widgetType == 'ReportProcessingUI') {
this._reportProcessing = widget;
}
}
};
/**
* FlexPromptPage constructor
*
* @param kwArgs.id [String] DOM node id
* @param kwArgs.contentId [String] DOM node id of report page content container
* @param kwArgs.bgColor [String] Background color of the page
* @param kwArgs.width [Int] Page content's width in pixels
* @param kwArgs.height [Int] Page content's height in pixels
* @param kwArgs.topMargin [Int] Top margin of report page in pixels
* @param kwArgs.rightMargin [Int] Right margin of report page in pixels
* @param kwArgs.bottomMargin [Int] Bottom margin of report page in pixels
* @param kwArgs.leftMargin [Int] Left margin of report page in pixels
*/
bobj.crv.newFlexPromptPage = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId(),
layoutType: 'fixed',
width: 800,
height: 600,
padding: 5,
top: 0,
left: 0
}, kwArgs);
var o = newWidget(kwArgs.id);
o.widgetType = 'FlexPromptPage';
o._reportProcessing = null;
// Update instance with constructor arguments
bobj.fillIn(o, kwArgs);
// Update instance with member functions
o.initOld = o.init;
MochiKit.Base.update(o, bobj.crv.FlexPromptPage);
window[o.id] = o;
return o;
};
bobj.crv.FlexPromptPage = {
/**
* Overrides parent. Does nothing because the swf content will replace the DIV later
*
* @param content [String|DOM Node] Html or Node to use as report page content
*/
setHTML : MochiKit.Base.noop,
getHTML : function() {
var isBorderBoxModel = bobj.isBorderBoxModel ();
var pageOuterHeight = this.height + this.topMargin + this.bottomMargin;
var pageOuterWidth = this.width + this.leftMargin + this.rightMargin;
var contentHeight = isBorderBoxModel ? pageOuterHeight : this.height;
var contentWidth = isBorderBoxModel ? pageOuterWidth : this.width;
var useSize = this.layoutType.toLowerCase () == bobj.crv.Viewer.LayoutTypes.FIXED;
var layerStyle = {
position : 'relative',
width : useSize ? contentWidth + 'px' : '100%',
height : useSize ? contentHeight + 'px' : '100%',
top : this.top + "px",
left : this.left + "px",
border : 'none',
'z-index' : 1,
'background-color' : this.bgColor
};
var pageStyle = {
'padding': this.padding + 'px',
position: 'absolute' // Must be absolute to avoid double initialization in firefox ADAPT01260507
};
bobj.crv.params.ViewerFlexParameterAdapter.setViewerLayoutType (this.id, this.layoutType);
var h = bobj.html;
return h.DIV ( {
id : this.id,
style : layerStyle
}, h.DIV ( {
id : this.id + '_page',
style : pageStyle
}, h.DIV ( {
id : this.contentId
})));
},
init : function() {
var connect = MochiKit.Signal.connect;
if (this.layoutType.toLowerCase () == 'client') {
connect (window, 'onresize', this, '_doLayout');
}
this._doLayout ();
},
_doLayout : function() {
var rptProcessing = this._reportProcessing;
if (rptProcessing && rptProcessing.layer) {
rptProcessing.center ();
}
},
addChild : function(widget) {
if (widget.widgetType == 'ReportProcessingUI') {
this._reportProcessing = widget;
}
}
};

View File

@@ -0,0 +1,275 @@
/*
* ================================================================================
* Range Field
*
* ================================================================================
*/
bobj.crv.params.newRangeField = function(kwArgs) {
return new bobj.crv.params.RangeField(kwArgs);
};
bobj.crv.params.RangeField = function(kwArgs) {
kwArgs = MochiKit.Base.update( {
id : bobj.uniqueId(),
cleanValue : {},
foreColor : 'black',
isTextItalic: false,
tooltip : ''
}, kwArgs);
this.widgetType = 'RangeField';
this.value = kwArgs.cleanValue;
// Update instance with constructor arguments
bobj.fillIn(this, kwArgs);
};
bobj.crv.params.RangeField.prototype = {
setTabDisabled : function(dis) {
if(this.layer) {
var tds = this.layer.getElementsByTagName("TD");
for(var i = 0, len = tds.length; i < len ; i++) {
bobj.disableTabbingKey(tds[i], dis);
}
}
},
setTooltip : function(text) {
if(this.layer) {
this.layer.title = text;
}
},
setForeColor : function(color) {
if(this.layer) {
this.layer.style.color = color;
}
},
setTextItalic : function(isItalic) {
if(this.layer) {
this.layer.style.fontStyle = isItalic ? 'italic' : '';
}
},
/**
* Generates HTML for either lower or upper bound value
* @param value - the value of upper/lower bound
* @param isRightAligned - a flag for indicating whether left align or right align the generated HTML
* @return
*/
getValueHTML : function(value, isRightAligned) {
value = value ? value : '&nbsp;';
var style = {
'text-align' : isRightAligned ? (bobj.crv.config.isRTL? 'left':'right') : (bobj.crv.config.isRTL? 'right':'left')
};
var SPAN = "";
//[ADAPT01680961] In IE we should force the span to show the value in one line
if (MochiKit.Base.isIE ()) {
SPAN = bobj.html.SPAN( {
style : {"white-space" : 'nowrap'}
}, value);
}
else {
SPAN = bobj.html.SPAN(null, value);
}
return bobj.html.TD( {
style : style,
role : 'presentation'
}, SPAN);
},
isValueValidRange: function() {
return this.value != null && this.value.lowerBound != null && this.value.upperBound != null;
},
getHTML : function() {
var TR = "";
var h = bobj.html;
if(this.isValueValidRange()) {
TR = h.TR(null, this.getValueHTML(this.getValue().lowerBound.value, true), this
.getMiddleImageHTML(), this.getValueHTML(this.getValue().upperBound.value, false))
}
else {
TR = h.TR(null, this.getValueHTML(this.getValue(), false))
}
return h.TABLE( {
id : this.id,
'class' : 'iactRangeFieldTable',
role : 'group',
'title' : this.tooltip + " " + this._getRangeValueToolTip(),
style : {color : this.foreColor, "font-style" : this.isTextItalic ? 'italic' :''}
}, TR);
},
_getRangeValueToolTip : function () {
var str = "";
if(this.isValueValidRange()) {
var RangeBoundTypes = bobj.crv.params.RangeBoundTypes;
switch (this.getValue().lowerBound.type) {
case RangeBoundTypes.EXCLUSIVE:
str += "(" + this.getValue().lowerBound.value;
break;
case RangeBoundTypes.INCLUSIVE:
str += "[" + this.getValue().lowerBound.value;
break;
case RangeBoundTypes.UNBOUNDED:
str += "( " ;
break;
}
str += "..";
switch (this.getValue().upperBound.type) {
case RangeBoundTypes.EXCLUSIVE:
str += this.getValue().upperBound.value + ")" ;
break;
case RangeBoundTypes.INCLUSIVE:
str += this.getValue().upperBound.value + "]";
break;
case RangeBoundTypes.UNBOUNDED:
str += " )" ;
break;
}
}
else {
str += this.getValue();
}
return str;
},
/**
*
* @return HTML for Range type (INCLUSIVE / EXCLUSIVE / UNBOUND)
*/
getMiddleImageHTML : function() {
var lowerImageSrc = "";
var upperImageSrc = "";
var lineSrc = "images/line.gif";
switch (this.getValue().lowerBound.type) {
case bobj.crv.params.RangeBoundTypes.EXCLUSIVE:
lowerImageSrc = "images/hollowCircle.gif";
break;
case bobj.crv.params.RangeBoundTypes.INCLUSIVE:
lowerImageSrc = "images/filledCircle.gif";
break;
case bobj.crv.params.RangeBoundTypes.UNBOUNDED:
if(bobj.crv.config.isRTL){
lowerImageSrc = "images/rightTriangle.gif";
} else {
lowerImageSrc = "images/leftTriangle.gif";
}
break;
}
switch (this.getValue().upperBound.type) {
case bobj.crv.params.RangeBoundTypes.EXCLUSIVE:
upperImageSrc = "images/hollowCircle.gif";
break;
case bobj.crv.params.RangeBoundTypes.INCLUSIVE:
upperImageSrc = "images/filledCircle.gif";
break;
case bobj.crv.params.RangeBoundTypes.UNBOUNDED:
if(bobj.crv.config.isRTL){
upperImageSrc = "images/leftTriangle.gif";
} else {
upperImageSrc = "images/rightTriangle.gif";
}
break;
}
var TDStyle = {
'vertical-align' : 'middle'
};
var IMG = bobj.html.IMG;
return bobj.html.TD( {
style : TDStyle
}, IMG( {
src : bobj.crvUri(lowerImageSrc)
}), IMG( {
src : bobj.crvUri(lineSrc)
}), IMG( {
src : bobj.crvUri(upperImageSrc)
}));
},
/**
* Initializes the widget
*/
init : function() {
this.layer = getLayer(this.id);
},
/**
*
* @return the evaluated width of lower bound TD
*/
getLowerBoundValueWidth : function() {
if(!this.isValueValidRange())
return 0;
var value = this.getValue().lowerBound.value;
var fontFamily = MochiKit.Style.computedStyle(this.layer, 'fontFamily');
var fontSize = MochiKit.Style.computedStyle(this.layer, 'fontSize');
if (!fontFamily)
fontFamily = "arial , sans-serif";
if (!fontSize)
fontSize = "12px";
return bobj.getStringWidth(value, fontFamily, fontSize);
},
getLowerBoundTD : function() {
if (this.layer)
return this.layer.getElementsByTagName("TD")[0];
return null;
},
setLowerBoundValueWidth : function(w) {
if (this.getLowerBoundTD())
this.getLowerBoundTD().style.width = w+"px";
},
reset : function(value) {
this.value = value;
this.cleanValue = value;
this.updateUI();
},
updateUI : function() {
var parent = this.layer.parentNode;
MochiKit.DOM.removeElement(this.layer);
append2(parent, this.getHTML());
this.init();
},
setValue : function(rangeValue) {
this.value = rangeValue;
this.updateUI();
},
setCleanValue : function(rangeValue) {
this.cleanValue = rangeValue;
},
getValue : function() {
return this.value;
}
};

View File

@@ -0,0 +1,335 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
/**
* ReportAlbum Constructor
*/
bobj.crv.newReportAlbum = function(kwArgs) {
var mb = MochiKit.Base;
var UPDATE = mb.update;
var BIND = mb.bind;
var ALBUM = bobj.crv.ReportAlbum;
kwArgs = UPDATE({
id: bobj.uniqueId(),
initTabIdx: 0, // Index of tab to select when initializing
width: 800,
height: 500,
displayDrilldownTab : true
}, kwArgs);
// Override TabbedZone's TabBarWidget
var tabbar = newNaviBarWidget(bobj.uniqueId(), _HorizTabTopWithClose, null, null, kwArgs.width, null, null, null, false, true, false);
var o = newTabbedZone(kwArgs.id, tabbar, kwArgs.width, kwArgs.height);
tabbar.cb = BIND(ALBUM._onSelectTab, o);
tabbar.closeTab = BIND(ALBUM._removeView, o, true);
bobj.fillIn(o, kwArgs);
o.widgetType = 'ReportAlbum';
o._views = [];
o._hideFrame = false;
// Attach member functions
o.selectOld = o.select;
UPDATE(o, ALBUM);
return o;
};
bobj.crv.ReportAlbum = {
getTabBarHeight : function() {
return this.tabs.getHeight ();
},
init : function() {
/*
* This is not nice... Copied super class' init code here so that select will be called only once.
*/
this.tzOldInit ();
this.tabs.init ();
this.showDrilldownTab (this.displayDrilldownTab);
var views = this._views;
if (views.length > 0) {
for ( var i = 0, len = views.length; i < len; i++) {
/* Since views are not initializing themself (as before through
adding bobj.crv.getInitHtml to their HTML)
it is report album's responsibility to initialize its children */
views[i].init ();
}
if (this.initTabIdx < 0 || this.initTabIdx >= views.length) {
this.initTabIdx = 0;
}
this.select (this.initTabIdx);
}
},
showDrilldownTab : function (isDisplay) {
this.displayDrilldownTab = isDisplay;
try
{
/* IE supports table-row since IE8. */
var displayStyle;
if (_ie && !_ie8Up)
displayStyle = "block";
else
displayStyle = "table-row";
this.tabs.layer.parentNode.parentNode.style.display = isDisplay ? displayStyle : "none";
}
catch(e){}
},
isDisplayDrilldownTab : function () {
return this.displayDrilldownTab;
},
setHideFrame : function(hide) {
this._hideFrame = hide;
var selectedView = this.getSelectedView ();
if (selectedView && this._hideFrame)
selectedView.hideFrame();
},
update : function(update) {
if (!update || update.cons !== "bobj.crv.newReportAlbum") {
return;
}
/* Updates all views */
for ( var i = 0, len = update.children.length; i < len; i++) {
var updateView = update.children[i];
var view = this._views[i];
if (view) {
view.update (updateView); /* updates current view */
}
}
var updateChildrenLength = update.children.length;
var currentViewsLength = this._views.length;
/* Adds any new view created by drill down action */
if (updateChildrenLength > currentViewsLength) {
for ( var i = currentViewsLength, len = updateChildrenLength; i < len; i++) {
this.delayedAddChild (bobj.crv.createWidget (update.children[i]));
}
}
/* Removes views that are have been removed from viewstate */
else if (updateChildrenLength < currentViewsLength) {
for ( var i = currentViewsLength -1, len = updateChildrenLength; i >= len; i--) {
this._removeView (false, i); /* removes non-existing views */
}
}
this.initTabIdx = update.args.initTabIdx;
this.select (this.initTabIdx);
},
/**
* @return index of the tab specified by viewstateid
*/
findTabNumber : function(viewStateId) {
var views = this._views;
for ( var i = 0, len = views.length; i < len; i++)
if (views[i].viewStateId == viewStateId)
return i;
return -1;
},
/**
* Adds view to its list of views. Since this method can be called after initialization time, its HTML
* is first added to report album, and then widget is intialized.
*/
delayedAddChild : function(view) {
this._views.push (view);
var tab = this.tabs.add(view.label, view.tooltip);
var tabHTML = this.getTabHTML (this._views.length - 1);
append (getLayer (this.id + "_container"), tabHTML);
view.init ();
},
addChild : function(view) {
if (view) {
this._views.push (view);
this.add (view.label, view.tooltip);
}
},
getHTML : function() {
var html = this.beginHTML ();
var children = this._views;
for ( var i = 0, len = children.length; i < len; ++i) {
html += this.getTabHTML (i);
}
html += this.endHTML ();
return html;
},
/**
* @param index,
* index of tab to create HTML for
* @return creates HTML for tab specified by index
*/
getTabHTML : function(index) {
var tab = this.tabs.items[index];
var view = this._views[index];
html = '';
if (tab && view) {
html += this.beginTabHTML (tab);
html += view.getHTML ();
html += this.endTabHTML ();
}
return html;
},
/**
* Resize the outer dimensions of the ReportAlbum. The standard resize method, inherited from TabbedZoneWidget, resizes the container. We
* can't override it without breaking things.
*/
resizeOuter : function(w, h) {
var tabHeight = 33;
var frameWidth = 10;
if(bobj.isNumber (h)) {
if(this.displayDrilldownTab)
h -= tabHeight;
h = Math.max(h, 0);
}
if(bobj.isNumber (w)) {
if(!this._hideFrame)
w -= frameWidth;
w = Math.max(w, 0);
}
this.resize (w, h);
this.tabs.resize (w);
var selectedView = this.getSelectedView ();
if (selectedView) {
selectedView.resize (); /* Notify ReportView of resize */
}
},
/**
* @return Returns a suggested size for the widget as an object with width and height integer properties that specify the dimensions in
* pixels.
*/
getBestFitSize : function() {
var w = this._hideFrame ? 0 : 10;
var h = this.displayDrilldownTab ? 33 : 0;
var selectedView = this.getSelectedView ();
if (selectedView) {
var viewSize = selectedView.getBestFitSize ();
w += viewSize.width;
h += viewSize.height;
}
return {
width : w,
height : h
};
},
/**
* Overrides parent. Opens a tab with a positioned div. The positioning prevents
* the ReportView from disappearing in IE.
*/
beginTabHTML : function(tab) {
return bobj.html.openTag ('div', {
id : tab.zoneId,
style : {
display : 'none',
width : this.w + 'px',
height : this.h + 'px',
position : 'relative'
}
});
},
/**
* @return Returns the select ReportView or null if no view is selected
*/
getSelectedView : function() {
return this._views[this.oldIndex];
},
/**
* Overrides parent. Selects a report view to display.
*
* @param index [int] Index of the report view
*/
select : function(index) {
var partial = MochiKit.Base.partial;
if (index >= 0 && index < this._views.length && index != this.oldIndex) {
/* Disposes currently selected view */
var selectedView = this.getSelectedView ();
if (selectedView) {
selectedView.dispose ();
}
/* Creates new signals for newly selected view */
var selectedView = this._views[index];
/* Does the dirty DOM manipulation to actually change the view */
this.selectOld (index);
/*
* Notifies parameter controller that view has changes so it can enable/disable panel based on view's type
*/
MochiKit.Signal.signal (this, "viewChanged");
}
},
/**
* Removes view specified by index from view list
*
* @param autoSelectNext
* [boolean] indicates whether another view should be auto selected after view specified by index is removed
* @param index
* [Number} index of view that would be removed
*/
_removeView : function(autoSelectNext, index) {
var removedView = this._views[index];
var removedTab = this.tabs.items[index];
autoSelectNext = (removedTab != null && removedTab.isSelected && autoSelectNext);
if (removedView) {
removedView.dispose ();
bobj.deleteWidget (removedView);
MochiKit.Signal.signal (this, 'removeView', removedView);
}
if (removedTab.isSelected) {
/* oldIndex (index of currently selected view) needs to be reset so when
response for the next selected view arrives
viewer think that view has changed */
this.oldIndex = -1;
}
arrayRemove (this, '_views', index);
this.tabs.remove (index, autoSelectNext);
bobj.deleteWidget (removedTab);
},
_onSelectTab : function(index) {
if(index != this.oldIndex)
MochiKit.Signal.signal (this, 'selectView', this._views[index]);
}
};

View File

@@ -0,0 +1,280 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
/**
* ReportPage constructor
*
* @param kwArgs.id [String] DOM node id
* @param kwArgs.bgColor [String] Background color of the page
* @param kwArgs.width [Int] Page content's width in pixels
* @param kwArgs.height [Int] Page content's height in pixels
* @param kwArgs.topMargin [Int] Top margin of report page in pixels
* @param kwArgs.rightMargin [Int] Right margin of report page in pixels
* @param kwArgs.bottomMargin [Int] Bottom margin of report page in pixels
* @param kwArgs.leftMargin [Int] Left margin of report page in pixels
* @param kwArgs.extraCssFileUrl [String] The path of an extra CSS file used in report page
*/
bobj.crv.newReportPage = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId(),
bgColor: '#FFFFFF',
width: 720,
height: 984,
extraCssFileUrl: "",
documentView: bobj.crv.ReportPage.DocumentView.PRINT_LAYOUT
}, kwArgs);
var o = newWidget(kwArgs.id);
o.widgetType = 'ReportPage';
// Update instance with constructor arguments
bobj.fillIn(o, kwArgs);
// Update instance with member functions
o.initOld = o.init;
o.resizeOld = o.resize;
MochiKit.Base.update(o, bobj.crv.ReportPage);
return o;
};
bobj.crv.ReportPage = {
DocumentView : {
WEB_LAYOUT : 'weblayout',
PRINT_LAYOUT : 'printlayout'
},
/**
* Disposes report page by removing its layer and stylesheet from DOM
*/
dispose : function() {
MochiKit.DOM.removeElement (this.layer);
},
/**
* DO NOT REMOVE. USED BY WEB ELEMENTS
*/
displayScrollBars : function (isDisplay) {
this.layer.style.overflow = isDisplay ? "auto" : "hidden";
},
/**
* DO NOT REMOVE. USED BY WEB ELEMENTS
*/
isDisplayScrollBars : function () {
this.layer.style.overflow == "auto";
},
update : function(update) {
if (update && update.cons == "bobj.crv.newReportPage") {
this.updateSize ( {
width : update.args.width,
height : update.args.height
});
this.layer.scrollLeft = 0;
this.layer.scrollTop = 0;
this.updateHTML (update.args.content, false);
}
},
scrollToHighlighted : function (scrollWindow) {
if(this._iframe) {
var iframeDoc = _ie ? this._iframe.contentWindow.document : this._iframe.contentDocument;
var e = iframeDoc.getElementById("CrystalHighLighted");
if(e) {
var ePosition = MochiKit.Style.getElementPosition (e, null, iframeDoc);
if(scrollWindow) {
var reportPagePos = MochiKit.Style.getElementPosition (this.layer);
window.scrollTo (reportPagePos.x + ePosition.x , reportPagePos.y + ePosition.y);
}
else {
this.layer.scrollLeft = ePosition.x;
this.layer.scrollTop = ePosition.y;
}
}
}
},
updateHTML : function(content, useAnimation) {
if (content) {
if(!this._iframe) {
this._iframe = MochiKit.DOM.createDOM('IFRAME', {id : this.id + '_iframe', width : '100%', height : '100%', frameBorder : '0', margin : '0'})
this._pageNode.appendChild(this._iframe);
}
if(useAnimation)
this._iframe.style.display = "none";
var iframeDoc = _ie ? this._iframe.contentWindow.document : this._iframe.contentDocument;
iframeDoc.open();
iframeDoc.write(this.getIFrameHTML (content));
iframeDoc.close();
if(useAnimation)
bobj.displayElementWithAnimation(this._iframe);
}
},
getIFrameHTML : function (content) {
var extraCssFileLink = "";
if (this.extraCssFileUrl != "") {
extraCssFileLink = "<link href=\"" + this.extraCssFileUrl + "\" rel=\"stylesheet\" type=\"text/css\" />\r\n";
}
return "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" +
"<html>\r\n" +
"<head>\r\n" +
extraCssFileLink +
"<style> body { overflow :hidden; margin : 0px;}</style>\r\n" +
"</head>\r\n" +
"<body>\r\n" +
content +
"</body>\r\n" +
"</html>";
},
/*
* Updates size of report page based on update object
* @param update [{width,height,marginLeft,marginRight,marginTop}] dimension and margins
* of report p
*/
updateSize : function(sizeObject) {
if (sizeObject) {
this.width = (sizeObject.width != undefined) ? sizeObject.width : this.width;
this.height = (sizeObject.height != undefined) ? sizeObject.height : this.height;
}
if (this._pageNode) {
var isBBM = bobj.isBorderBoxModel ();
this._pageNode.style.width = (isBBM ? this.width + 2: this.width) + 'px';
this._pageNode.style.height = (isBBM ? this.height + 2: this.height) + 'px';
}
if (this._shadowNode) {
this._shadowNode.style.width = (isBBM ? this.width + 2: this.width) + 'px';
this._shadowNode.style.height = (isBBM ? this.height + 2: this.height) + 'px';
}
},
getHTML : function() {
var h = bobj.html;
var isBBM = bobj.isBorderBoxModel ();
var layerStyle = {
width : '100%',
height : '100%',
overflow : 'auto',
position : 'absolute'
};
var pageStyle = {
position : 'relative',
width : (isBBM ? this.width + 2: this.width) + 'px',
height : (isBBM ? this.height + 2: this.height) + 'px',
'z-index' : 1,
'border-width' : '1px',
'border-style' : 'solid',
'background-color' : this.bgColor,
overflow : 'hidden',
'text-align' : 'left'
};
var shadowStyle = {
position : 'absolute',
'z-index' : 0,
display : 'none',
width : (isBBM ? this.width + 2: this.width) + 'px',
height : (isBBM ? this.height + 2: this.height) + 'px',
top : '0px',
left : '0px'
};
var shadowHTML = '';
if (this.documentView.toLowerCase () == bobj.crv.ReportPage.DocumentView.PRINT_LAYOUT) {
layerStyle['background-color'] = '#8E8E8E';
pageStyle['border-color'] = '#000000';
shadowStyle['background-color'] = '#737373';
shadowHTML = h.DIV ( {
id : this.id + '_shadow',
'class' : 'menuShadow',
style : shadowStyle
})
/* page should appear in the center for print layouts */
layerStyle['text-align'] = 'center'; /* For page centering in IE quirks mode */
pageStyle['margin'] = '0 auto'; /* center the page horizontally - CSS2 */
pageStyle['top'] = "6px";
} else {
/* Web Layout*/
layerStyle['background-color'] = '#FFFFFF';
pageStyle['border-color'] = '#FFFFFF';
/* page should appear in left for web layouts */
pageStyle['margin'] = '0';
}
var html = h.DIV ( {
id : this.id,
style : layerStyle,
'class' : 'insetBorder'
}, h.DIV ( {
id : this.id + '_page',
style : pageStyle
}), shadowHTML);
return html;
},
init : function() {
this._pageNode = getLayer (this.id + '_page');
this._shadowNode = getLayer (this.id + '_shadow');
this.initOld ();
this.updateHTML (this.content, true);
},
updateShadowLocation : function () {
var updateFunc = function () {
if(this._shadowNode && this._pageNode) {
this._shadowNode.style.display = "none"; //Must hide dropshadow as it can cause scrollbars to appear
var pageNodPos = {x : this._pageNode.offsetLeft, y : this._pageNode.offsetTop};
this._shadowNode.style.display = "block";
this._shadowNode.style.top = pageNodPos.y + (bobj.isBorderBoxModel() ? 4 : 6) + "px";
this._shadowNode.style.left = pageNodPos.x + (bobj.isBorderBoxModel() ? 4 : 6) + "px";
}
}
setTimeout(bobj.bindFunctionToObject(updateFunc,this), 0); // Must be executed after viewer has finished doLayout
},
/**
* Resizes the outer dimensions of the widget.
*/
resize : function (w, h) {
bobj.setOuterSize(this.layer, w, h);
if(_moz)
this.css.clip = bobj.getRect(0,w,h,0);
this.updateShadowLocation ();
},
/**
* @return Returns an object with width and height properties such that there
* would be no scroll bars around the page if they were applied to the widget.
*/
getBestFitSize : function() {
var page = this._pageNode;
return {
width: page.offsetWidth + 30,
height: page.offsetHeight + 30
};
},
hideFrame : function() {
this.css.borderStyle = 'none';
this._pageNode.style.border = '';
}
};

View File

@@ -0,0 +1,156 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
/**
* ReportView Constructor
*/
bobj.crv.newReportView = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId(),
viewStateId: null,
isMainReport: false
}, kwArgs);
var o = newWidget(kwArgs.id);
bobj.fillIn(o, kwArgs);
o.widgetType = 'ReportView';
o.reportPage = null;
o._lastPanelWidth = null;
// Attach member functions
o.initOld = o.init;
o.isMainReportFlag = o.isMainReport;
MochiKit.Base.update(o, bobj.crv.ReportView);
return o;
};
bobj.crv.ReportView = {
init : function() {
this.initOld ();
if (this.reportPage)
this.reportPage.init ();
},
addChild : function(widget) {
if (widget.widgetType == 'ReportPage')
this.reportPage = widget;
},
/**
* This method should be called after viewer has initialized. Adds a child to view by first appending its html
* to view and then intializing it.
*/
delayedAddChild : function(widget) {
this.addChild (widget);
append2 (this.layer, widget.getHTML ());
widget.init ();
},
scrollToHighlighted : function (scrollWindow) {
if(this.reportPage) {
this.reportPage.scrollToHighlighted(scrollWindow);
}
},
update : function(update) {
if (update && update.cons == "bobj.crv.newReportView") {
if(update.args)
this.viewStateId = update.args.viewStateId;
for ( var childVar in update.children) {
var child = update.children[childVar];
if (child && child.cons == "bobj.crv.newReportPage") {
if (!this.reportPage) {
/* adds reportPage if not existing */
this.delayedAddChild (bobj.crv.createWidget (child));
} else {
/* updates reportpage */
this.reportPage.update (child);
}
break; /* There is only one child */
}
}
}
},
getHTML : function() {
var h = bobj.html;
var layerStyle = {
width : '100%',
height : '100%',
overflow : 'hidden',
position : 'relative'
};
var html = h.DIV ( {
id : this.id,
style : layerStyle
}, this.reportPage ? this.reportPage.getHTML () : '');
return html;
},
_doLayout : function() {
if (this.reportPage)
this.reportPage.resize (this.getWidth (), this.getHeight ());
},
isMainReport : function() {
return this.isMainReportFlag;
},
/**
* ReportView will always fill its container but it should be told when to
* resize so that the layout of its contents will be updated.
*/
resize : function() {
this._doLayout ();
},
dispose : function() {
if (this.reportPage) {
this.reportPage.dispose ();
bobj.deleteWidget (this.reportPage);
delete this.reportPage;
}
bobj.removeAllChildElements (this.layer);
},
/**
* @return Returns a suggested size for the widget as an object with width and height integer properties that specify the dimensions in
* pixels.
*/
getBestFitSize : function() {
var w = 0;
var h = 0;
var pageSize = this.reportPage ? this.reportPage.getBestFitSize () : null;
if (pageSize) {
w += pageSize.width;
h += pageSize.height;
}
return {
width : w,
height : h
};
},
/**
* @return True if the view has report content. False if the view is empty.
*/
hasContent : function() {
return this.reportPage != null;
},
hideFrame : function() {
if (this.reportPage)
this.reportPage.hideFrame();
}
};

View File

@@ -0,0 +1,71 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
if (typeof(bobj.crv.Separator) == 'undefined') {
bobj.crv.Separator = {};
}
/**
* Separator Constructor. Simple horizontal separator.
*
*/
bobj.crv.newSeparator = function(kwArgs) {
var UPDATE = MochiKit.Base.update;
kwArgs = UPDATE({
id: bobj.uniqueId(),
marginLeft: 4,
marginRight: 4,
marginTop: 0,
marginBottom: 2
}, kwArgs);
var o = newWidget(kwArgs.id);
bobj.fillIn(o, kwArgs);
o.widgetType = 'Separator';
// Attach member functions
UPDATE(o, bobj.crv.Separator);
return o;
};
bobj.crv.Separator.getHTML = function() {
var HTML = bobj.html;
var htmlStr = '';
if (bobj.isBorderBoxModel()) {
htmlStr = HTML.IMG({
id: this.id,
src: bobj.skinUri('sep.gif'),
style: {
'height': 2 + 'px',
'width':'100%',
'margin-left': this.marginLeft + 'px',
'margin-right': this.marginRight + 'px',
'margin-top': this.marginTop + 'px',
'margin-bottom': this.marginBottom + 'px'
}});
}
else {
htmlStr = HTML.DIV({
id : this.id,
style: {
'height': 2 + 'px',
'margin-left': this.marginLeft + 'px',
'margin-right': this.marginRight + 'px',
'margin-top': this.marginTop + 'px',
'margin-bottom': this.marginBottom + 'px',
'background-image': 'url(' + bobj.skinUri('sep.gif') + ')',
'background-repeat': 'repeat-x',
'overflow': 'hidden'
}});
}
return htmlStr + bobj.crv.getInitHTML(this.widx);
};
/**
* @return Returns the outer height of the widget, including margins
*/
bobj.crv.Separator.getHeight = function() {
return this.layer.offsetHeight + this.marginTop + this.marginBottom;
};

View File

@@ -0,0 +1,183 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
if (typeof(bobj.crv.SharedWidgetHolder) == 'undefined') {
bobj.crv.SharedWidgetHolder = {};
bobj.crv.SharedWidgetHolder._registry = {};
}
/**
* Constructor. SharedWidgetHolder is a placeholder for a widget.
* SharedWidgetHolder instances belong to groups, in which one managed
* widget will be shown in one placeholder at a time. When show(true) is called
* for any member of the group, the managed widget will be displayed in that
* member.
*
* @param id [String] DHTML id
* @param group [String] Group the new instance will belong to
* @param width [int | String] Width of the placeholder
* @param height [int | String] Height of the placeholder
* @param resizeWidget [bool] Resize to the placeholder's dimensions
*/
bobj.crv.newSharedWidgetHolder = function(kwArgs) {
var mb = MochiKit.Base;
var ms = MochiKit.Signal;
kwArgs = mb.update({
id: bobj.uniqueId(),
group: 'SharedWidgetHolder',
width: null,
height: null,
resizeWidget: true
}, kwArgs);
var o = newWidget(kwArgs.id);
o.widgetType = 'SharedWidgetHolder';
bobj.fillIn(o, kwArgs);
o._setVisible = o.show;
o._resizeHolder = o.resize;
o._initHolder = o.init;
mb.update(o, bobj.crv.SharedWidgetHolder);
o._register();
return o;
};
bobj.crv.SharedWidgetHolder.init = function() {
this._initHolder();
var regInfo = this._regInfo;
if (regInfo.managedWidget && this === regInfo.visibleHolder) {
regInfo.managedWidget.init();
this.resize();
}
};
bobj.crv.SharedWidgetHolder.getHTML = function() {
var ISNUMBER = bobj.isNumber;
var ISSTRING = bobj.isString;
var vis = this.isHoldingWidget() ? 'visible' : 'hidden';
var innerHTML = this.isHoldingWidget() ? this._regInfo.managedWidget.getHTML() : '';
var style = {visibility: vis};
var width = this.width;
if (ISNUMBER(width)) {
width = width + 'px';
}
if (ISSTRING(width)) {
style.width = width;
}
var height = this.height;
if (ISNUMBER(height)) {
height = height + 'px';
}
if (ISSTRING(height)) {
style.height = height;
}
return bobj.html.DIV({id: this.id, style: style}, innerHTML);
};
/**
* Private. Register this instance in a group.
*/
bobj.crv.SharedWidgetHolder._register = function() {
var registry = bobj.crv.SharedWidgetHolder._registry;
var holderInfo = registry[this.group];
if (!holderInfo) {
holderInfo = {
managedWidget: null,
visibleHolder: this
};
registry[this.group] = holderInfo;
}
this._regInfo = holderInfo;
};
/**
* @return [bool] True if and only if this instance is currently holding a
* non-null managed widget. Only one member of a group can return
* true at any given time.
*/
bobj.crv.SharedWidgetHolder.isHoldingWidget = function() {
var regInfo = this._regInfo;
return ((regInfo.visibleHolder === this) && regInfo.managedWidget);
};
/**
* @return [Widget] The widget that is managed by the holder group that this
* instance belongs to.
*/
bobj.crv.SharedWidgetHolder.getManagedWidget = function() {
return this._regInfo.managedWidget;
};
/**
* Set the widget that is managed by the group that this isntance belongs to.
* The widget will be displayed in the currently visible member of the group.
*
* @param widget [Widget] The widget that should be managed.
*/
bobj.crv.SharedWidgetHolder.setManagedWidget = function(widget) {
var regInfo = this._regInfo;
var oldWidget = regInfo.managedWidget;
regInfo.managedWidget = widget;
if (oldWidget && oldWidget.layer) {
MochiKit.DOM.removeElement(oldWidget.layer);
}
if (!regInfo.visibleHolder) {
regInfo.visibleHolder = this;
}
var holder = regInfo.visibleHolder;
if (holder.layer && widget && widget.layer) {
holder.layer.appendChild(widget.layer);
holder.resize();
}
};
/**
* Alias for setManagedWidget. Allows instantiation using bobj.crv.createWidget();
*/
bobj.crv.SharedWidgetHolder.addChild = bobj.crv.SharedWidgetHolder.setManagedWidget;
/**
* Show or hide the managed widget in this holder instance.
*
* @param show [bool] If true, the managed widget will be displayed in this
* instance. If false and this holder is currently showing
* the managed widget, the widget will be hidden.
*/
bobj.crv.SharedWidgetHolder.show = function(show) {
var regInfo = this._regInfo;
if (show && (regInfo.visibleHolder !== this) && regInfo.managedWidget) {
this.layer.appendChild(regInfo.managedWidget.layer);
regInfo.visibleHolder._setVisible(false);
regInfo.visibleHolder = this;
this.resize();
}
this._setVisible(show);
};
/**
* Resize the holder instance. If resizeWidget property is true, the managed
* widget will be resized to the dimensions of the placeholder.
*
* @param w [width, optional] Width in pixels
* @param h [height, optional] Height in pixels
*/
bobj.crv.SharedWidgetHolder.resize = function(w, h) {
this._resizeHolder(w, h);
if (this.resizeWidget && this.isHoldingWidget()) {
this._regInfo.managedWidget.resize(this.getWidth(), this.getHeight());
}
};

View File

@@ -0,0 +1,38 @@
/*
* Disposes signals synchronously and asynchronously.
*/
if (typeof(bobj.crv.SignalDisposer) == 'undefined') {
bobj.crv.SignalDisposer = new function() {
var signals = []; //private variable
var timerID = null; //private variable
var CLEAN_SIGNALS_PER_TASK = 20;
var disconnect = MochiKit.Signal.disconnect;
this.dispose = function(signal, sync) {
if(signal != null) {
if(sync) {
disconnect(signal);
}
else {
signals.push (signal);
if (timerID == null)
timerID = setInterval (bobj.bindFunctionToObject (cleanTask, this), 100);
}
}
};
cleanTask = function() {
var count = CLEAN_SIGNALS_PER_TASK;
while (signals.length > 0 && count > 0) {
disconnect (signals.pop ());
count--;
}
if (signals.length == 0 && timerID != null) {
clearInterval (timerID);
timerID = null;
}
}
};
}

View File

@@ -0,0 +1,160 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
if (typeof(bobj.crv.StackedPanel) == 'undefined') {
bobj.crv.StackedPanel = {};
}
/**
* Constructor.
*
* @param id [String] DHTML id
* @param width [int] Width of the panel in pixels
* @param height [int] Height of the panel in pixels
*/
bobj.crv.newStackedPanel = function(kwArgs) {
var mb = MochiKit.Base;
var UPDATE = mb.update;
var BIND = mb.bind;
kwArgs = UPDATE({
id: bobj.uniqueId(),
width: null,
height: null
}, kwArgs);
var o = newWidget(kwArgs.id);
o.widgetType = 'StackedPanel';
bobj.fillIn(o, kwArgs);
o._tabs = [];
o._initWidget = o.init;
o._resizeWidget = o.resize;
UPDATE(o, bobj.crv.StackedPanel);
return o;
};
bobj.crv.StackedPanel = {
init : function() {
this._initWidget ();
var tabs = this._tabs;
/* Tabs that were added after getHTML must be written now */
var index = this._numTabsWritten;
while (index < tabs.length) {
append (this.layer, tabs[index].getHTML (), document);
index++;
}
for ( var i = 0, len = tabs.length; i < len; ++i) {
tabs[i].init ();
}
},
setTabDisabled : function(dis) {
for ( var i = 0, len = this._tabs.length; i < len; i++) {
this._tabs[i].setTabDisabled (dis);
}
},
getHTML : function() {
var DIV = bobj.html.DIV;
var layerStyle = {};
if (this.height) {
layerStyle.height = bobj.unitValue (this.height);
}
if (this.width) {
layerStyle.width = bobj.unitValue (this.width);
}
return DIV ( {
id : this.id,
style : layerStyle,
'class' : 'stackedPanel',
tabIndex : "-1"
}, this._getTabsHTML ());
},
_getTabsHTML : function() {
var tabsHTML = '';
var tabs = this._tabs;
var tabsLen = tabs.length;
for ( var i = 0; i < tabsLen; ++i) {
tabsHTML += tabs[i].getHTML ();
}
this._numTabsWritten = tabsLen;
return tabsHTML;
},
/**
* Add a tab to the panel. Must be called before getHTML is called.
*
* @param tab
* [StackedTab]
*/
addTab : function(tab) {
if (tab) {
this._tabs.push (tab);
if (this.layer) {
append (this.layer, tab.getHTML ());
tab.init ();
}
if (this.layer)
tab.resize(this.layer.clientWidth);
MochiKit.Signal.connect(tab, "StackedTabResized", this, '_onStackedTabResize');
}
},
getNumTabs : function() {
return this._tabs.length;
},
getTab : function(index) {
return this._tabs[index];
},
removeTab : function(index) {
if (index >= 0 && index < this._tabs.length) {
var tab = this._tabs[index];
this._tabs.splice (index, 1);
delete _widgets[this._tabs.widx];
if (tab.layer) {
tab.layer.parentNode.removeChild (tab.layer);
}
}
},
_onStackedTabResize: function () {
this.resize (this.getWidth());
},
resize : function(w, h) {
/* Exclude margins for safari as it miscalculates left/top margins */
var excludeMargins = !_saf;
bobj.setOuterSize(this.layer, w, h, excludeMargins);
var tabs = this._tabs;
var tabsLen = tabs.length;
if (tabsLen) {
/* Ensure that the vertical scrollbar never covers the content*/
var tabWidth = this.layer.clientWidth;
/* IE changes the value of clientWidth after resizing the first child... */
tabs[0].resize(tabWidth);
if (tabWidth != this.layer.clientWidth) {
tabWidth = this.layer.clientWidth;
tabs[0].resize(tabWidth);
}
for (var i = 1; i < tabsLen; ++i) {
tabs[i].resize(tabWidth);
}
}
}
};

View File

@@ -0,0 +1,230 @@
/*
================================================================================
StackedTab
================================================================================
*/
bobj.crv.newStackedTab = function(kwArgs) {
var UPDATE = MochiKit.Base.update;
kwArgs = UPDATE({
id: bobj.uniqueId(),
label: '',
width: 300,
height: null, // null height means grow as big as necessary
openAdvCB: null,
name : '',
isDataFetching: false
}, kwArgs);
var o = newWidget(kwArgs.id);
o.widgetType = 'StackedTab';
bobj.fillIn(o, kwArgs);
o._content = null;
if(o.openAdvCB) {
o._advanceButton = newIconWidget(
o.id + '_advBtn',
bobj.crv.allInOne.uri,
o.openAdvCB,
null, //text
L_bobj_crv_paramsOpenAdvance.replace("%1", o.name),//tooltip,
10, 10, 3, bobj.crv.allInOne.openParameterArrowDy + (_ie ? 2 : 3)); //width, height, dx, dy, disDx, disDy, cancelEventPropagation
bobj.crv.setAllClasses(o._advanceButton, 'arrow_button');
o._advanceButton.margin = 0;
}
o._initWidget = o.init;
o._resizeWidget = o.resize;
UPDATE(o, bobj.crv.StackedTab);
return o;
};
bobj.crv.StackedTab = {
setTabDisabled : function(dis) {
if (this._content)
this._content.setTabDisabled (dis);
if (this._advanceButton && this._advanceButton.layer)
bobj.disableTabbingKey (this._advanceButton.layer, dis);
if (this._textCtn)
bobj.disableTabbingKey (this._textCtn, dis);
if(this._dataFetchLayer)
bobj.disableTabbingKey (this._dataFetchLayer, dis);
},
init : function() {
var connect = MochiKit.Signal.connect;
var signal = MochiKit.Signal.signal;
var partial = MochiKit.Base.partial;
this._initWidget ();
if (this._content) {
this._content.init ();
}
if (this._advanceButton) {
this._advanceButton.init ();
this._onAdvanceButtonClickOld = MochiKit.Base.bind(this._advanceButton.layer.onclick, this._advanceButton.layer);
this._advanceButton.layer.onclick = MochiKit.Base.bind(this.advButtonOnClick, this);
this._advanceButton.css.width = "14px";
}
this._dataFetchLayer = getLayer(this.id + "_df");
this._labelCtn = getLayer (this.id + '_labelCtn');
this._textCtn = getLayer (this.id + '_textCtn');
this._contentCtn = getLayer (this.id + '_contentCtn');
if (this._advanceButton) {
var advButtonLayer = this._advanceButton.layer;
var bind = bobj.bindFunctionToObject;
connect (this.layer, 'onclick', bind(IconWidget_upCB, advButtonLayer));
connect (this.layer, 'onmouseover', bind(IconWidget_realOverCB, advButtonLayer));
connect (this.layer, 'onmouseout', bind(IconWidget_realOutCB, advButtonLayer));
connect (this.layer, 'onmousedown', bind(IconWidget_downCB, advButtonLayer));
}
connect(this._content, 'ParameterUIResized', partial (signal, this, "StackedTabResized"));
},
getHTML : function() {
var h = bobj.html;
var DIV = h.DIV;
var IMG = h.IMG;
var stackedTabAtt = {
'class' : 'stackedTab',
cellpadding : "0",
id : this.id,
style : {
cursor : this._advanceButton ? _hand : 'default'
}
};
var labelCtnAtt = {
id: this.id + '_labelCtn',
cellpadding : "0",
'class': 'crvnoselect stackedTabTitle'
};
var contentHTML = this._content ? this._content.getHTML() : '';
var advButtonHTML = this._advanceButton ? h.TD ({width : '17px'}, this._advanceButton.getHTML()) : ''; /* 14 for arrow height + 3px right margin */
var dataFetchHTML = "";
if (this.isDataFetching) {
var URL_TAG = "url(%1);"
dataFetchHTML = h.TD ({width : '20px'}, IMG ( {
src : _skin + '../transp.gif',
title : L_bobj_crv_ParamsDataTip,
tabindex: 0,
id: this.id + "_df",
style : {
width : "16px",
height : "16px",
"background-image" : URL_TAG.replace("%1", bobj.crv.allInOne.uri),
"background-position" : "0px " + (-bobj.crv.allInOne.paramDataFetchingDy) + "px",
"margin-right" : '4px',
'vertical-align' : 'middle'
}
}));
}
var html = DIV (stackedTabAtt, DIV (labelCtnAtt, h.TABLE ( {
cellpadding : "0",
width : '100%',
height : '20px',
style : {
'table-layout' : 'fixed'
}
}, h.TD ({style : {"vertical-align" : "top", "overflow" : "hidden"}}, DIV ( {
'class' :'stackedTabText',
id :this.id + '_textCtn',
title :this.label,
'tabIndex' :0,
style : {
'font-weight' : 'bold',
'color' : '#4F5C72'
}
}, convStr (this.label))
), dataFetchHTML, advButtonHTML)
), DIV ( {
id :this.id + '_contentCtn',
'class' :'stackedTabContentCtn'
}, contentHTML));
return html;
},
setDirty : function(isDirty) {
if(this._textCtn) {
this._textCtn.style.fontStyle = isDirty ? "italic" : "";
this._textCtn.title = isDirty ? this.label + " " + L_bobj_crv_ParamsDirtyTip : this.label;
}
if(this._labelCtn) {
var titleClassName = isDirty ? "stackedTabTitleDirty" : "stackedTabTitle";
// IE 7 uses "className"
this._labelCtn.setAttribute("className", titleClassName);
// IE 8, FireFox, and Safari use "class"
this._labelCtn.setAttribute("class", titleClassName);
}
},
resize : function(w) {
w = w - 4; // TODO exclude margins properly
if(this._labelCtn) {
// Exclude margins for safari as it miscalculates left/top margins
var excludeMargins = !_saf;
bobj.setOuterSize(this._labelCtn, w , null, excludeMargins);
}
if (this._content) {
this._content.resize(w -2);
}
bobj.setOuterSize(this.layer, w);
},
/**
* Set the widget that is displayed below the tab. Must be called before getHTML.
*
* @param widget [Widget] Widget that appears below the tab when the tab is expanded
*/
setContent : function(widget) {
this._content = widget;
},
/**
* Get the widget that is displayed below the tab.
*
* @return [Widget] Widget that appears below the tab
*/
getContent : function() {
return this._content;
},
/**
* Focus the advanced button if available
*/
focusAdvButton : function() {
if (this._advanceButton && this._advanceButton.focus)
this._advanceButton.focus();
},
/**
* Override default onclick for the advanced button to cancel propagating the event.
*/
advButtonOnClick : function(e) {
if (this._onAdvanceButtonClickOld)
{
this._onAdvanceButtonClickOld(e);
eventCancelBubble(e);
}
}
};

View File

@@ -0,0 +1,86 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
/**
* Constructor. StateManager holds state for multiple viewers.
*/
bobj.crv.StateManager = function() {
this._state = {};
};
bobj.crv.StateManager.prototype = {
/**
* Set the state object for a report view
*
* @param viewerName [String]
* @param stateName [String] The name of the report view
* @param viewState [Object] The state associated with the report view
*/
setViewState: function(viewerName, stateName, viewState) {
var state = this._state;
if (!state[viewerName]) {
state[viewerName] = {};
}
state[viewerName][stateName] = viewState;
},
/**
* Get the state object for a report view
*
* @param viewerName [String]
* @param stateName [String] The name of the report view
*
* @return [Object] Returns the state object for the report view or null
* if no object is associated with (viewerName, stateName)
*/
getViewState: function(viewerName, stateName) {
var state = this._state;
if (!state[viewerName]) {
return null;
}
return state[viewerName][stateName];
},
/**
* Set the compound state object for a viewer components. This object
* should contain a state object for every report view displayed by the
* viewer.
*
* @param viewerName [String]
* @param state [Object] All report view states for the viewer
*/
setComponentState: function(viewerName, state) {
this._state[viewerName] = state;
},
/**
* Get the compound state object for a viewer component. This object
* should contain a state object for every report view displayed by the
* viewer.
*
* @param viewerName [String]
*
* @return [Object] Returns all report view states for the viewer
*/
getComponentState: function(viewerName) {
return this._state[viewerName];
},
/**
* Get the state for all viewer components on the page.
*
* @return [Object] Returns the state of all viewers on the page, mapped
* by the id of the viewer widgets.
*/
getCompositeState: function() {
return this._state;
}
};
// Create a single StateManager for all viewers in the page to share
if (typeof bobj.crv.viewerState == 'undefined') {
bobj.crv.stateManager = new bobj.crv.StateManager();
}

View File

@@ -0,0 +1,257 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
/**
* Statusbar widget constructor ({id: String})
*/
bobj.crv.newStatusbar = function(kwArgs) {
var UPDATE = MochiKit.Base.update;
kwArgs = UPDATE({
id: bobj.uniqueId(),
visualStyle : {
className : null,
backgroundColor : null,
borderWidth : null,
borderStyle : null,
borderColor : null,
fontFamily : null,
fontWeight : null,
textDecoration : null,
color : null,
width : null,
height : null,
fontStyle : null,
fontSize : null
}
}, kwArgs);
var o = newPaletteContainerWidget(kwArgs.id);
o.margin = 0;
bobj.fillIn(o, kwArgs);
o._rightZoneWgts = [];
o.widgetType = 'Statusbar';
// Attach member functions (since we can't use prototypes)
o.initOld = o.init;
UPDATE(o, bobj.crv.Statusbar);
o.palette = newPaletteWidget(o.id + "_palette");
o.palette.isLeftTableFixed = true;
o.add(o.palette);
return o;
};
bobj.crv.Statusbar = {
/**
* Overrides parent
*/
init : function() {
this.initOld ();
bobj.setVisualStyle (this.layer, this.visualStyle);
this.palette.init ();
},
/**
* Overrides parent
*/
beginHTML : function() {
return bobj.html.openTag ('div', {
id : this.id,
'class' : 'dialogzone',
style : {
width : '100%',
overflow : 'hidden',
margin : this.margin + 'px',
padding : '2px 0px',
position : 'absolute'
}
});
},
/**
* Overrides parent
*/
getHTML : function() {
this._addRightZone ();
return (this.beginHTML () + this.palette.getHTML () + this.endHTML ());
},
/**
* Private. Adds right-aligned widgets to the right zone of the palette
*/
_addRightZone : function() {
this.palette.beginRightZone ();
var w = null;
while (w = this._rightZoneWgts.pop ()) {
this.palette.add (w);
}
delete this._rightZoneWgts;
},
/**
* Overrides parent
*/
write : function() {
this._addRightZone ();
this.begin ();
this.palette.write ();
this.end ();
document.write (bobj.crv.getInitHTML (this.widx));
},
/**
* Add child widgets to the statusbar - left or right
*/
addChild : function(widget) {
switch (widget.widgetType) {
case 'StatusbarBreadcrumb':
this.breadcrumb = widget;
break;
case 'StatusbarVersionIndicator':
this.versionIndicator = widget;
break;
}
/* Delay adding right-aligned widgets due to the semantics of the palette */
if (widget.layoutAlign == 'right') {
this._rightZoneWgts.push (widget);
} else {
this.palette.add (widget);
}
},
/**
* Update child widgets - if they are exists in the statusbar
*/
update : function(update) {
if (update) {
for ( var childNum in update.children) {
var child = update.children[childNum];
if (child) {
switch (child.cons) {
case "bobj.crv.newStatusbarBreadcrumb":
if (this.breadcrumb) {
this.breadcrumb.update (child.args);
}
break;
case "bobj.crv.newStatusbarVersionIndicator":
if (this.versionIndicator) {
this.versionIndicator.update (child.args);
}
break;
}
}
}
}
},
doLayout : function() {
if (this.breadcrumb) {
this.breadcrumb._doLayout();
}
}
};
/**
* StatusbarBreadcrumb widget constructor ({values: String[]})
*/
bobj.crv.newStatusbarBreadcrumb = function(kwArgs) {
var o = newWidget(bobj.uniqueId());
o.widgetType = 'StatusbarBreadcrumb';
o.values = kwArgs.values;
o.layoutAlign = 'left';
o._separatorImage = img(bobj.crvUri('images/breadcrumbSep.gif'), 14, 9);
MochiKit.Base.update(o, bobj.crv.StatusbarBreadcrumb);
return o;
};
bobj.crv.StatusbarBreadcrumb = {
/**
* Update the breadcrumbs ({values: String[]})
*/
update : function(kwArgs) {
this.values = kwArgs.values;
this.layer.innerHTML = this._render ();
},
/**
* Overrides parent
*/
getHTML : function() {
return bobj.html.DIV ( {
'class' : 'statusbar_breadcrumb'
}, bobj.html.DIV ( {
id : this.id
}, this._render ()));
},
/**
* Render the breadcrumbs as table cells separated by an image - called by getHTML and update
*/
_render : function() {
var html = '';
if (this.values && this.values.length > 0) {
var cells = '';
for (i = 0; i < this.values.length; i++) {
if (i > 0) { /* insert a separate image before values - except first one */
cells += bobj.html.TD (null, this._separatorImage);
}
cells += bobj.html.TD ( {
style : {
'white-space' : 'nowrap'
}
}, this.values[i]);
}
html = bobj.html.TABLE ( {
'class' : 'iconText',
cellspacing : '0',
cellpadding : '0'
}, bobj.html.TR (null, cells));
}
return html;
},
_doLayout : function() {
var needsRightAlign = (this.layer.parentNode.scrollWidth > this.layer.parentNode.offsetWidth) || (this.layer.offsetLeft < 0);
if (needsRightAlign) {
this.layer.style.position = "absolute";
this.layer.style.top = "0px";
this.layer.style.right = "0px";
}
else {
this.layer.style.position = "";
}
}
};
/**
* StatusbarVersionIndicator widget constructor ({value: String})
*/
bobj.crv.newStatusbarVersionIndicator = function(kwArgs) {
var text = (kwArgs && kwArgs.value) ? L_bobj_crv_LastRefreshed + ": " + kwArgs.value : ' ';
var o = NewLabelWidget(bobj.uniqueId(), text, true);
o.widgetType = 'StatusbarVersionIndicator';
o.layoutAlign = 'right';
MochiKit.Base.update(o, bobj.crv.StatusbarVersionIndicator);
return o;
};
bobj.crv.StatusbarVersionIndicator = {
/**
* Update the last refreshed value
*/
update : function(kwArgs) {
var text = (kwArgs && kwArgs.value) ? L_bobj_crv_LastRefreshed + ":&nbsp;" + kwArgs.value : '&nbsp;';
this.layer.innerHTML = text;
}
};

View File

@@ -0,0 +1,377 @@
/*
================================================================================
TextCombo
Internal class. Editable combo box that renders correctly in a Parameter UI
================================================================================
*/
/**
* Constructor. TextCombo extends TextComboWidget from the dhtmllib.
*/
bobj.crv.params.newTextCombo = function(kwArgs) {
var UPDATE = MochiKit.Base.update;
var PARAMS = bobj.crv.params;
kwArgs = UPDATE({
id: bobj.uniqueId(),
width: '100%',
maxChar: null,
tooltip: null,
disabled: false,
editable: false,
changeCB: null,
enterCB: null,
keyUpCB: null,
isTextItalic: false
}, kwArgs);
var o = newTextComboWidget(
kwArgs.id,
kwArgs.maxChar,
kwArgs.tooltip,
null, // width
kwArgs.changeCB,
null, // check CB
null, // beforeShowCB
null);// formName
o.widgetType = 'TextCombo';
// Update instance with constructor arguments
bobj.fillIn(o, kwArgs);
o.width = kwArgs.width;
// Update instance with member functions
o.init_TextCombo = o.init;
UPDATE(o, PARAMS.TextCombo);
o._createTextField(); // Override parent's text property
o._createArrow();
o.arrow.dy += 2; // Center the arrow
o.arrow.disDy += 2;
return o;
};
bobj.crv.params.TextCombo = {
setTextItalic : function(isTextItalic) {
if (this.text) {
this.text.setTextItalic (isTextItalic);
}
},
setForeColor : function(color) {
if (this.text)
this.text.setForeColor (color);
},
setTooltip : function(tooltip) {
if (this.text) {
this.text.setTooltip (tooltip);
}
},
setTabDisabled : function(dis) {
if (this.text)
this.text.setTabDisabled (dis);
if (this.arrow)
bobj.disableTabbingKey (this.arrow.layer, dis);
},
setMenu : function(menu) {
this.menu = menu;
},
init : function() {
this.init_TextCombo ();
this.arrowContainer = getLayer (this.id + '_arrowCtn');
if (this.arrow) {
this.arrow.layer.onfocus = IconWidget_realOverCB;
this.arrow.layer.onblur = IconWidget_realOutCB;
}
this.text.setValue (this.cleanValue);
},
toggleMenu : function() {
var menu = this.menu;
menu.parIcon = this;
var toShow = !menu.isShown();
menu.show (toShow);
if (toShow)
menu.valueSelect (this.text.getValue () + '');
},
_createArrow : function() {
var tooltip = _openMenu.replace("{0}", this.tooltip? this.tooltip: '');
this.arrow = newIconWidget(this.id + "arrow_",
bobj.skinUri("menus.gif"),
bobj.bindFunctionToObject(this.toggleMenu,this),
null,
tooltip,
7, /* w */
12, /* h */
0, /* dx */
83, /* dy */
0, /* disDx */
99); /* disDy */
this.arrow.setClasses("iconnocheck", "combobtnhover", "combobtnhover", "combobtnhover");
this.arrow.par = this;
},
_createTextField : function() {
this.text = bobj.crv.params.newTextField ( {
id : this.id + '_text',
cleanValue : this.cleanValue,
width : '100%',
maxChar : null,
tooltip : this.tooltip,
disabled : false,
editable : this.editable,
password : false,
focusCB : this.focusCB,
blurCB : this.blurCB,
keyUpCB : bobj.bindFunctionToObject (this._onKeyUp, this),
enterCB : this.enterCB,
foreColor : this.foreColor,
isTextItalic : this.isTextItalic
});
},
getHTML : function() {
var h = bobj.html;
var arrowClassName = 'iactTextComboArrow';
var arrowStyle = {};
arrowStyle.right = "0px";
if (MochiKit.Base.isIE ()) {
arrowStyle.height = "18px";
} else {
arrowStyle.height = "16px";
}
var html = h.DIV ( {
id : this.id,
style : {
width : "100%",
position : "relative"
}
}, h.DIV ( {
style : {
position : "relative"
},
'class' : 'iactTextComboTextField'
}, this.text.getHTML ()), h.DIV ( {
'class' : arrowClassName,
id : this.id + '_arrowCtn',
style : arrowStyle
}, this.arrow.getHTML ()));
return html;
},
/**
* Resets TextCombo. sets original value and hides arrow icon
*/
reset : function(value) {
this.text.reset (value);
},
/**
* Set the content of the text box and update the menu selection
*
* @param text [String]
*/
setValue : function(text) {
this.text.setValue(text);
},
setCleanValue : function(text) {
this.text.setCleanValue (text);
},
/**
* Private. Overrides parent.
*/
selectItem : function(item) {
if (item) {
this.val = item.value;
this.text.setValue (item.value, true); /* keep the previous clean value */
this.menu.select (item.index);
}
},
/**
* Get the content on the text box
*
* @return [String]
*/
getValue : function() {
return this.text.getValue ();
},
_onKeyUp : function(e) {
var text = this.text.getValue ();
if (this.keyUpCB)
this.keyUpCB (e);
}
};
/**
* ScrollMenuWidget
*/
bobj.crv.params.newScrollMenuWidget = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id : bobj.uniqueId(),
originalValues: [],
hasProperWidth: false,
hasValueList: false,
maxVisibleItems: 10,
openAdvDialogCB: null,
maxNumParameterDefaultValues: null
},kwArgs);
var visibleLines = (kwArgs.originalValues.length >= kwArgs.maxVisibleItems) ? kwArgs.maxVisibleItems : kwArgs.originalValues.length;
if (visibleLines === 1) {
visibleLines++;
}
var o = newScrollMenuWidget(
"menu_"+ kwArgs.id, //id
bobj.crv.params.ScrollMenuWidget.onChange, //changeCB
false, //multi
null,
visibleLines, //lines
null, //tooltip
null,//dblClickCB
null, //keyUpCB
false, //showLabel
'', //label
'',//convBlanks
null, //beforeShowCB
null); //menuClickCB
o.oldShow = o.show;
MochiKit.Base.update(o,kwArgs, bobj.crv.params.ScrollMenuWidget);
return o;
};
bobj.crv.params.ScrollMenuWidget = {
onChange : function() {
var o = this.parIcon;
var item = this.getSelection ();
if (item) {
if (this.maxNumParameterDefaultValues && item.index == this.maxNumParameterDefaultValues) {
if (this.openAdvDialogCB) {
this.openAdvDialogCB ();
this.clearSelection ();
}
} else {
o.val = item.value;
o.text.setValue (item.value);
}
} else {
o.val = null;
o.text.setValue ("");
}
if (o.changeCB) {
o.changeCB ();
}
},
getPosition : function() {
if (this.parIcon === null) {
return;
}
var layer = this.parIcon.layer;
var getDimensions = MochiKit.Style.getElementDimensions;
var position = getPosScrolled (layer);
var xPos = position.x + 2;
var yPos = position.y + getDimensions (layer).h + 3;
if (MochiKit.Base.isIE ()) {
xPos -= 1;
if (bobj.isQuirksMode ()) {
yPos -= 2;
}
}
return {
x : xPos,
y : yPos
};
},
setProperWidth : function() {
if (this.hasProperWidth === false) {
this.css.display = "block";
this.orginalWidth = this.layer.offsetWidth;
this.css.display = "none";
this.hasProperWidth = true;
}
},
setValueList : function() {
if (this.hasValueList === false) {
this.hasValueList = true;
var origValues = this.originalValues;
for ( var i = 0, len = origValues.length; i < len; i++) {
this.add (origValues[i], origValues[i], false);
}
}
},
setFocus : function(focus) {
if (focus) {
var focusCB = bobj.bindFunctionToObject (this.list.focus, this.list);
setTimeout (focusCB, 300);
} else {
if (this.parIcon.selected === true) {
this.parIcon.arrow.focus ();
}
}
},
show : function(show) {
if (this.layer === null)
this.justInTimeInit ();
if (this.hasValueList === false)
this.setValueList ();
if (this.parIcon === null)
return;
if (this.hasProperWidth === false)
this.setProperWidth ();
if (this.parIcon && this.parIcon.layer) {
var layer = this.parIcon.layer;
if (layer.clientWidth > this.orginalWidth) {
this.css.width = layer.clientWidth + "px";
this.list.css.width = layer.clientWidth + "px";
} else {
this.css.width = this.orginalWidth + "px";
this.list.css.width = this.orginalWidth + "px";
}
}
var pos = this.getPosition ();
this.oldShow (show, pos.x, pos.y);
this.setFocus (show);
}
};

View File

@@ -0,0 +1,151 @@
/*
* ================================================================================
* TextField
*
* Internal class. Text box that renders correctly in a Parameter UI
* ================================================================================
*/
/**
* Constructor. TextField extends TextFieldWidget from the dhtmllib.
*/
bobj.crv.params.newTextField = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId(),
cleanValue: '',
width: '100%',
maxChar: null,
tooltip: null,
disabled: false,
editable: true,
password: false,
focusCB: null,
blurCB: null,
changeCB: null,
keyUpCB: null,
enterCB: null,
foreColor : 'black',
isTextItalic : false,
canOpenAdvDialog : false
}, kwArgs);
var o = newTextFieldWidget(
kwArgs.id,
kwArgs.changeCB,
kwArgs.maxChar,
kwArgs.keyUpCB,
kwArgs.enterCB,
true, //nomargin
kwArgs.tooltip,
null, //width
kwArgs.focusCB,
kwArgs.blurCB);
o.widgetType = 'TextField';
// Update instance with constructor arguments
bobj.fillIn(o, kwArgs);
o.disabled = kwArgs.disabled;
o.width = kwArgs.width;
// Update instance with member functions
MochiKit.Base.update(o, bobj.crv.params.TextField);
if (kwArgs.cleanValue) {
o.setValue(kwArgs.cleanValue);
}
return o;
};
bobj.crv.params.TextField = {
setForeColor : function(color) {
this.foreColor = color;
if (this.css)
this.css.color = color;
},
setTextItalic : function(isTextItalic) {
this.isTextItalic = isTextItalic;
if (this.css)
this.css.fontStyle = isTextItalic ? 'italic' : '';
},
setTabDisabled : function(dis) {
bobj.disableTabbingKey (this.layer, dis);
},
eraseHelpTxt: MochiKit.Base.noop,
getHTML : function() {
var style = {
width : bobj.unitValue (this.width)
};
var isIE = MochiKit.Base.isIE ();
var className = 'iactTextField';
var attributes = {
type : this.password ? 'password' : 'text',
name : this.id,
id : this.id,
maxLength : this.maxChar,
style : style,
'class' : className,
oncontextmenu : "event.cancelBubble=true;return true",
onfocus : "TextFieldWidget_focus(this)",
onblur : "TextFieldWidget_blur(this)",
onchange : "TextFieldWidget_changeCB(event, this)",
onkeydown : "return TextFieldWidget_keyDownCB(event, this);",
onkeyup : "return TextFieldWidget_keyUpCB(event, this);",
onkeypress : "return TextFieldWidget_keyPressCB(event, this);",
ondragstart : "event.cancelBubble=true; return true;",
onselectstart : "event.cancelBubble=true; return true;"
};
if (this.disabled) {
attributes.disabled = "disabled";
}
if (this.isTextItalic) {
style["font-style"] = "italic";
}
style.color = this.foreColor;
if (!this.editable) {
attributes.readonly = "readonly";
if (this.canOpenAdvDialog) {
style.cursor = "pointer";
}
else {
style.cursor = "default";
}
}
if (this.tooltip) {
attributes.title = this.tooltip.replace(/"/g, "&quot;");
}
return bobj.html.INPUT (attributes);
},
/**
* Resets textField object. Sets clean value, current value
*/
reset : function(value) {
this.value = value;
this.cleanValue = value;
this.setValue (value);
},
setValue : function(value) {
TextFieldWidget_setValue.call (this, value);
},
setCleanValue : function(value) {
this.cleanValue = value;
}
};

View File

@@ -0,0 +1,295 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
bobj.crv.ToolPanelType = { //values must match server's expectations
None: 'None',
GroupTree : 'GroupTree',
ParameterPanel: 'ParameterPanel'
};
bobj.crv.ToolPanelTypeDetails = {
None : {
title : null,
img : null,
alt : null
},
GroupTree : {
title : L_bobj_crv_GroupTree,
img : { uri: bobj.crv.allInOne.uri, dx: 0, dy: bobj.crv.allInOne.groupTreeToggleDy },
alt : L_bobj_crv_GroupTree
},
ParameterPanel : {
title : L_bobj_crv_ParamPanel,
img : { uri: bobj.crv.allInOne.uri, dx: 0, dy: bobj.crv.allInOne.paramPanelToggleDy },
alt : L_bobj_crv_ParamPanel
}
};
/**
* ToolPanel constructor
*
* @param kwArgs.id [String] DOM node id
* @param kwArgs.width [String] Width
* @param kwArgs.height [String] Height
*/
bobj.crv.newToolPanel = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId() + "_toolPanel",
width: '300px',
height: '100%',
initialViewType: bobj.crv.ToolPanelType.None
}, kwArgs);
var o = newWidget(kwArgs.id);
// Update instance with constructor arguments
bobj.fillIn(o, kwArgs);
o.widgetType = 'ToolPanel';
o._children = [];
o._selectedChild = null;
o._groupTree = null;
o._paramPanel = null;
// Update instance with member functions
o.initOld = o.init;
o.resizeOld = o.resize;
MochiKit.Base.update(o, bobj.crv.ToolPanel);
o.needLeftBorder = false;
return o;
};
bobj.crv.ToolPanel = {
hasGroupTree : function() {
return this._groupTree != null;
},
/**
* Adds a child widget as a view. If the child has an isSelected attribute
* that evaluates as true, it will be the selected (active) view.
*
* This function must be called before getHTML() is called.
*
* @param widget [Widget] Child view widget
*/
addChild : function(widget) {
if (!widget) {
return;
}
var connect = MochiKit.Signal.connect;
var partial = MochiKit.Base.partial;
var signal = MochiKit.Signal.signal;
var Type = bobj.crv.ToolPanelType;
if (widget.widgetType == 'GroupTree') {
this._groupTree = widget;
MochiKit.Iter.forEach ( [ 'grpDrilldown', 'grpNodeRetrieveChildren', 'grpNodeCollapse', 'grpNodeExpand' ], function(sigName) {
connect (this._groupTree, sigName, partial (signal, this, sigName));
}, this);
if (this.initialViewType == Type.GroupTree) {
this._selectedChild = widget;
}
} else if (widget.widgetType == 'ParameterPanel') {
this._paramPanel = widget;
connect (this._paramPanel, 'resetParamPanel', partial (signal, this, 'resetParamPanel'));
if (this.initialViewType == Type.ParameterPanel) {
this._selectedChild = widget;
}
}
this._children.push (widget);
},
hasParameterPanel : function () {
return this._paramPanel != null;
},
getParameterPanel : function() {
return this._paramPanel;
},
/**
* This method must be called after viewer has been initialized. Adds new child to toolpanel.
*/
delayedAddChild : function(widget) {
this.addChild (widget);
var display = widget === this._selectedChild ? '' : 'none';
append2 (this.layer, bobj.html.DIV ( {
style : {
display : display
}
}, widget.getHTML ()));
widget.init ();
},
/*
* The caller is responsible for calling doLayout after making a call to setView. calling doLayout is very expensive and want to avoid it if
* possible.
*/
setView : function(panelType) {
var prevSelectedChild = this._selectedChild;
this.updateSelectedChild (panelType);
var nextSelectedChild = this._selectedChild;
if(prevSelectedChild != nextSelectedChild) {
if (prevSelectedChild) {
var container = bobj.getContainer (prevSelectedChild);
if (container) {
container.style.display = 'none';
}
}
if(nextSelectedChild) {
var container = bobj.getContainer (nextSelectedChild);
if (container) {
bobj.displayElementWithAnimation(container);
}
}
}
},
updateSelectedChild : function (panelType) {
var Type = bobj.crv.ToolPanelType;
switch(panelType) {
case Type.GroupTree:
this._selectedChild = this._groupTree;
break;
case Type.ParameterPanel:
this._selectedChild = this._paramPanel;
break;
default:
this._selectedChild = null;
}
},
getHTML : function() {
var h = bobj.html;
var content = '';
var children = this._children;
for ( var i = 0, len = children.length; i < len; ++i) {
var child = children[i];
var display = child === this._selectedChild ? '' : 'none';
content += h.DIV ( {
style : {
display : display
}
}, child.getHTML ());
}
var isDisplayed = (bobj.crv.ToolPanelType.None !== this.initialViewType);
var toolPanelClass = 'toolPanel';
if (this.needLeftBorder)
toolPanelClass += ' leftBorder';
var layerAtt = {
id : this.id,
'class' : toolPanelClass,
style : {
position : 'absolute',
margin : '0',
width : this.width,
height : this.height,
overflow : 'hidden',
display : isDisplayed ? '' : 'none'
}
};
var html = h.DIV (layerAtt, content);
return html;
},
init : function() {
this.initOld ();
if (this._groupTree)
this._groupTree.init ();
if (this._paramPanel)
this._paramPanel.init ();
},
update : function(update) {
if (update && update.cons == "bobj.crv.newToolPanel") {
for ( var childVar in update.children) {
var child = update.children[childVar];
if (child) {
switch (child.cons) {
case "bobj.crv.newGroupTree":
/* if there is a group tree, update it */
if (this._groupTree) {
this._groupTree.update (child);
}
/* else create and add one */
else {
this.delayedAddChild (bobj.crv.createWidget (child));
}
break;
case "bobj.crv.params.newParameterPanel":
if (this._paramPanel) {
this._paramPanel.update (child);
}
else {
this.delayedAddChild (bobj.crv.createWidget (child));
}
break;
}
}
}
this.initialViewType = update.args.initialViewType;
this.setView (this.initialViewType);
this.css.width = update.args.width;
}
},
getBestFitHeight : function () {
var height = 0;
if(this._selectedChild != null)
height = this._selectedChild.getBestFitHeight();
return height;
},
hasPercentWidth : function () {
return (this.width != null) && (this.width.length > 0) && (this.width.charAt(this.width.length - 1) == '%');
},
getPercentWidth : function () {
return parseInt(this.width) / 100;
},
_doLayout : function() {
var innerWidth = this.layer.clientWidth;
var contentHeight = this.layer.clientHeight;
if (this._selectedChild) {
this._selectedChild.setDisplay (true);
this._selectedChild.resize (innerWidth, contentHeight);
}
},
resize : function(w, h) {
bobj.setOuterSize (this.layer, w, h);
this._doLayout ();
var width = _ie && _isQuirksMode ? this.layer.offsetWidth : this.layer.clientWidth;
var height = _ie && _isQuirksMode ? this.layer.offsetWidth : this.layer.clientWidth;
MochiKit.Signal.signal (this, 'resizeToolPanel', width, height);
// do not have a percent width if we have resized the tool panel
this.width = width;
},
addLeftBorder : function() {
this.needLeftBorder = true;
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,862 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
/**
* Viewer Constructor
*
* kwArgs.layoutType [String] Tells the viewer how to size itself. Can be
* "client" (fill window), "fitReport", or "fixed"
* kwArgs.width [Int] Width in pixels when layoutType=fixed
* kwArgs.height [Int] Height in pixels when layoutType=fixed
*/
bobj.crv.newViewer = function(kwArgs) {
kwArgs = MochiKit.Base.update({
id: bobj.uniqueId(),
isDisplayModalBG : false,
isLoadContentOnInit : false,
layoutType : bobj.crv.Viewer.LayoutTypes.FIXED,
visualStyle : {
className : null,
backgroundColor : null,
borderWidth : null,
borderStyle : null,
borderColor : null,
fontFamily : null,
fontWeight : null,
textDecoration : null,
color : null,
width : '800px',
height : '600px',
fontStyle : null,
fontSize : null,
top : "0px", /* passed by Java DHTML viewer */
left : "0px" /* passed by Java DHTML viewer */
}
}, kwArgs);
var o = newWidget(kwArgs.id);
bobj.fillIn(o, kwArgs);
o.widgetType = 'Viewer';
o._topToolbar = null;
o._reportAlbum = null;
o._leftPanel = null;
o._separator = null;
o._print = null;
o._export = null;
o._promptDlg = null;
o._reportProcessing = null;
o._eventListeners = [];
o._statusbar = null;
o._leftPanelResizeGrabber = newGrabberWidget(
o.id + '_leftPanelResizeGrabber',
bobj.bindFunctionToObject(bobj.crv.Viewer.onGrabberMove, o),
0, // intial left
0, // intial top
4, // width
1, // intial height (has to be pixels so we'll figure it out later)
true); // Moves on the horizontal axis
// Attach member functions
o.initOld = o.init;
o._boundaryControl = new bobj.crv.BoundaryControl(kwArgs.id + "_bc");
o._modalBackground = new bobj.crv.ModalBackground(
kwArgs.id + "_mb",
bobj.bindFunctionToObject(bobj.crv.Viewer.keepFocus, o));
MochiKit.Base.update(o, bobj.crv.Viewer);
window[o.id] = o
return o;
};
bobj.crv.Viewer = {
LayoutTypes : {
FIXED : 'fixed',
CLIENT : 'client',
FITREPORT : 'fitreport'
},
PromptingTypes : {
HTML : 'html',
FLEX : 'flex'
},
onGrabberMove : function(x) {
if (this._leftPanel) {
this._leftPanel.resize (x, null);
this._doLayout ();
}
},
keepFocus : function () {
var swf = bobj.crv.params.FlexParameterBridge.getSWF(this.id);
if (swf)
swf.focus();
},
addChild : function(widget) {
if (widget.widgetType == 'ReportAlbum') {
this._reportAlbum = widget;
} else if (widget.widgetType == 'Toolbar') {
this._topToolbar = widget;
this._separator = bobj.crv.newSeparator ();
} else if (widget.widgetType == 'Statusbar') {
this._statusbar = widget;
} else if (widget.widgetType == 'PrintUI') {
this._print = widget;
} else if (widget.widgetType == 'ExportUI') {
this._export = widget;
} else if (widget.widgetType == 'ReportProcessingUI') {
this._reportProcessing = widget;
} else if (widget.widgetType == 'LeftPanel') {
this._leftPanel = widget;
}
},
getHTML : function() {
var h = bobj.html;
var layerStyle = {
overflow: 'hidden',
position: 'relative',
left : this.visualStyle.left,
top : this.visualStyle.top
};
var html = h.DIV({dir: 'ltr', id:this.id, style:layerStyle, 'class':'dialogzone'},
this._topToolbar ? this._topToolbar.getHTML() : '',
this._separator ? this._separator.getHTML() : '',
this._leftPanel ? this._leftPanel.getHTML() : '',
this._reportAlbum ? this._reportAlbum.getHTML() : '',
this._leftPanelResizeGrabber ? this._leftPanelResizeGrabber.getHTML() : '',
this._statusbar ? this._statusbar.getHTML(): '');
return html;
},
_onWindowResize : function() {
if (this._currWinSize.w != winWidth () || this._currWinSize.h != winHeight ()) {
this._doLayout ();
this._currWinSize.w = winWidth ();
this._currWinSize.h = winHeight ();
}
},
init : function() {
this.initOld ();
this._initSignals ();
if (this._reportAlbum)
this._reportAlbum.init ();
if (this._topToolbar)
this._topToolbar.init ();
if (this._leftPanel)
this._leftPanel.init ();
if (this._statusbar)
this._statusbar.init ();
if (this._leftPanelResizeGrabber) {
this._leftPanelResizeGrabber.init ();
if (!this._leftPanel || !this._leftPanel.isToolPanelDisplayed ())
this._leftPanelResizeGrabber.setDisplay (false);
}
this.setDisplayModalBackground(this.isDisplayModalBG);
bobj.setVisualStyle (this.layer, this.visualStyle);
this._currWinSize = {
w : winWidth (),
h : winHeight ()
};
var connect = MochiKit.Signal.connect;
var signal = MochiKit.Signal.signal;
if (this.layoutType.toLowerCase () == bobj.crv.Viewer.LayoutTypes.CLIENT) {
connect (window, 'onresize', this, '_onWindowResize');
}
if (!this._topToolbar && !this._statusbar && this._reportAlbum && !this._reportAlbum.isDisplayDrilldownTab()) {
this.layer.className += ' hideFrame';
this._reportAlbum.setHideFrame(true);
}
if (this.layer && _ie && bobj.checkParent (this.layer, "TABLE")) {
/*
* delays the call to doLayout to ensure all dom elemment's width and
* height are set beforehand.
*/
connect (window, 'onload', this, '_doLayoutOnLoad');
this._oldCssVisibility = this.css.visibility;
this.css.visibility = "hidden";
} else {
this._doLayout ();
}
this.scrollToHighlighted ();
signal (this, 'initialized', this.isLoadContentOnInit);
},
/**
* Connects all the signals during initialization
*/
_initSignals : function() {
var partial = MochiKit.Base.partial;
var signal = MochiKit.Signal.signal;
var connect = MochiKit.Signal.connect;
var fe = MochiKit.Iter.forEach;
if (this._topToolbar) {
fe ( [ 'zoom', 'drillUp', 'firstPage', 'prevPage', 'nextPage', 'lastPage', 'selectPage', 'refresh', 'search', 'export', 'print' ], function(sigName) {
connect (this._topToolbar, sigName, partial (signal, this, sigName));
}, this);
}
this._initLeftPanelSignals ();
if (this._reportAlbum) {
fe ( [ 'selectView', 'removeView', 'viewChanged' ], function(sigName) {
connect (this._reportAlbum, sigName, partial (signal, this, sigName));
}, this);
}
if (this._print) {
connect (this._print, 'printSubmitted', partial (signal, this, 'printSubmitted'));
}
if (this._export) {
connect (this._export, 'exportSubmitted', partial (signal, this, 'exportSubmitted'));
}
},
/**
* DO NOT REMOVE. USED BY WEB ELEMENTS
*/
getLeftPanel : function () {
return this._leftPanel;
},
_initLeftPanelSignals : function () {
var partial = MochiKit.Base.partial;
var signal = MochiKit.Signal.signal;
var connect = MochiKit.Signal.connect;
var fe = MochiKit.Iter.forEach;
if (this._leftPanel) {
fe ( [ 'grpDrilldown', 'grpNodeRetrieveChildren', 'grpNodeCollapse', 'grpNodeExpand', 'resetParamPanel', 'resizeToolPanel' ], function(sigName) {
connect (this._leftPanel, sigName, partial (signal, this, sigName));
}, this);
connect (this._leftPanel, 'switchPanel', this, '_onSwitchPanel')
}
},
/**
* returns true when main report view is selected in report album
*/
_isMainReportViewSelected : function() {
var currentView = this._reportAlbum.getSelectedView();
return currentView && currentView.isMainReport();
},
_doLayoutOnLoad : function() {
this.css.visibility = this._oldCssVisibility;
this._doLayout();
},
_doLayout : function() {
var topToolbarH = this._topToolbar ? this._topToolbar.getHeight() : 0;
var topToolbarW = this._topToolbar ? this._topToolbar.getWidth() : 0;
var separatorH = this._separator ? this._separator.getHeight() : 0;
var statusbarH = this._statusbar ? this._statusbar.getHeight() : 0;
var leftPanelW = this._leftPanel ? this._leftPanel.getBestFitWidth() : 0;
var leftPanelGrabberW = this._leftPanelResizeGrabber && this._leftPanelResizeGrabber.isDisplayed() ?
this._leftPanelResizeGrabber.getWidth() : 0;
var layout = this.layoutType.toLowerCase();
var toolPanel = this._leftPanel ? this._leftPanel.getToolPanel() : null;
var hasPercentWidth = (toolPanel && toolPanel.isDisplayed() && toolPanel.hasPercentWidth());
if (bobj.crv.Viewer.LayoutTypes.CLIENT == layout) {
this.css.width = '100%';
this.css.height = '100%';
if (hasPercentWidth)
leftPanelW = Math.max(leftPanelW, (this.getWidth() * toolPanel.getPercentWidth()) - leftPanelGrabberW);
}
else if (bobj.crv.Viewer.LayoutTypes.FITREPORT == layout) {
var viewerWidth = 0;
var viewerHeight = 0;
if (hasPercentWidth)
leftPanelW += 200;
if(this._reportAlbum) {
var albumSize = this._reportAlbum.getBestFitSize();
viewerWidth = (albumSize.width + leftPanelW + leftPanelGrabberW < topToolbarW) ? topToolbarW : albumSize.width + leftPanelW + leftPanelGrabberW;
viewerHeight = (albumSize.height + topToolbarH + separatorH + statusbarH);
}
else if (this._leftPanel) { /* If DisplayPage = false in webformviewer */
viewerWidth = leftPanelW;
viewerHeight = (this._leftPanel.getBestFitHeight() + topToolbarH + separatorH + statusbarH); ;
}
this.css.height = viewerHeight + 'px';
this.css.width = viewerWidth + 'px';
}
else { /* fixed layout */
this.css.width = this.visualStyle.width;
this.css.height = this.visualStyle.height;
if (hasPercentWidth)
leftPanelW = Math.max(leftPanelW, (this.getWidth() * toolPanel.getPercentWidth()) - leftPanelGrabberW);
}
var albumW = this.getWidth() - leftPanelW - leftPanelGrabberW;
var albumH = Math.max(0, this.getHeight() - topToolbarH - separatorH - statusbarH);
if (this._reportAlbum) {
this._reportAlbum.resizeOuter(albumW, albumH);
this._reportAlbum.move(leftPanelW + leftPanelGrabberW, topToolbarH + separatorH);
}
if(this._leftPanel) {
this._leftPanel.resize(leftPanelW, albumH);
this._leftPanel.move(0, topToolbarH + separatorH);
}
if(this._leftPanelResizeGrabber && this._leftPanelResizeGrabber.isDisplayed()) {
this._leftPanelResizeGrabber.resize(null, albumH);
this._leftPanelResizeGrabber.move(leftPanelW, topToolbarH + separatorH)
}
if(this._statusbar) {
this._statusbar.doLayout();
this._statusbar.move(0, topToolbarH + separatorH + albumH)
}
if (this._print && this._print.layer) {
this._print.center();
}
if (this._export && this._export.layer) {
this._export.center();
}
if (this._reportProcessing && this._reportProcessing.layer) {
this._reportProcessing.center();
}
var viewerP = MochiKit.Style.getElementPosition(this.layer);
var viewerD = MochiKit.Style.getElementDimensions(this.layer);
if (this._modalBackground)
this._modalBackground.updateBoundary(viewerD.w, viewerD.h, viewerP.x, viewerP.y);
var bodyD = bobj.getBodyScrollDimension();
var isViewerCutOff = ((viewerP.x + viewerD.w) >= bodyD.w) || ((viewerP.y + viewerD.h) >= bodyD.h);
if(isViewerCutOff && (layout != bobj.crv.Viewer.LayoutTypes.CLIENT)) {
/* BoundaryControl adds a hidden div with the same dimension and position as current viewer to body
to fix the problem of IE regarding scrollbar that are hidden when left + viewer's width > body's width
*/
this._boundaryControl.updateBoundary(viewerD.w, viewerD.h, viewerP.x, viewerP.y);
}
else {
this._boundaryControl.updateBoundary(0, 0, 0, 0);
}
var FLEXUI = bobj.crv.params.FlexParameterBridge;
var swf = FLEXUI.getSWF(this.id);
if(swf) {
if (this._promptDlg && this._promptDlg.style.visibility != 'hidden') {
if(swf._isMaximized) {
FLEXUI.fitScreen(this.id);
}
else {
FLEXUI.resize(this.id, swf.offsetHeight, swf.offsetWidth, true);
}
}
}
this._adjustWindowScrollBars();
},
_onSwitchPanel : function(panelType) {
var Type = bobj.crv.ToolPanelType;
if (Type.GroupTree == panelType) {
MochiKit.Signal.signal (this, 'showGroupTree');
} else if (Type.ParameterPanel == panelType) {
MochiKit.Signal.signal (this, 'showParamPanel');
} else if (Type.None == panelType) {
MochiKit.Signal.signal (this, 'hideToolPanel');
}
this._leftPanelResizeGrabber.setDisplay (!(Type.None == panelType));
this._doLayout ();
},
resize : function(w, h) {
if (bobj.isNumber (w)) {
w = w + 'px';
}
if (bobj.isNumber (h)) {
h = h + 'px';
}
this.visualStyle.width = w;
this.visualStyle.height = h;
this._doLayout ();
},
/**
* Set the page number. Updates toolbars with current page and number of pages
* info.
*
* @param curPageNum [String]
* @param numPages [String] (eg. "1" or "1+");
*/
setPageNumber : function(curPageNum, numPages) {
if (this._topToolbar) {
this._topToolbar.setPageNumber (curPageNum, numPages);
}
},
/**
* Display the prompt dialog.
*
* @param html [string] HTML fragment to display inside the dialog's form.
*/
showPromptDialog : function(html, closeCB) {
if (!this._promptDlg) {
var promptDialog_ShowCB = MochiKit.Base.bind (this._onShowPromptDialog, this);
var promptDialog_HideCB = MochiKit.Base.bind (this._onHidePromptDialog, this);
this._promptDlg = bobj.crv.params.newParameterDialog ( {
id : this.id + '_promptDlg',
showCB : promptDialog_ShowCB,
hideCB : promptDialog_HideCB
});
}
this._promptDlg.setCloseCB (closeCB);
this._promptDlg.setNoCloseButton(!closeCB);
/* The reason for saving document.onkeypress is that prompt dialog steals the document.onkeypress and never sets it back */
this._originalDocumentOnKeyPress = document.onkeypress; /*
* Must be set before .updateHtmlAndDisplay(html) as this function call modifies
* document.onkeypress;
*/
this.updatePromptDialog(html);
},
/**
* Update the prompt dialog - with CR2010 DCP prompting this allow the dialog to be kept open during dependent prompt submits
*
* @param html [string] HTML fragment to display inside the dialog's form
*/
updatePromptDialog : function(html) {
html = html || '';
var callback = function(prompt, prompthtml) {
return function() {
prompt.updateHtmlAndDisplay (prompthtml);
}
};
/**
* AllInOne.js lacks prompting javascript files (to reduce amount of data transmitted) therefore, prompting data must be loaded on demand
*/
bobj.loadJSResourceAndExecCallBack(bobj.crv.config.resources.HTMLPromptingSDK, callback(this._promptDlg, html));
if (bobj.isParentWindowTestRunner ()) {
/* for testing purposes only*/
setTimeout (MochiKit.Base.partial (MochiKit.Signal.signal, this, "promptDialogIsVisible"), 5);
}
},
showFlexPromptDialog : function(servletURL, closeCB) {
var FLEXUI = bobj.crv.params.FlexParameterBridge;
var VIEWERFLEX = bobj.crv.params.ViewerFlexParameterAdapter;
if (!FLEXUI.checkFlashPlayer ()) {
var msg = L_bobj_crv_FlashRequired;
this.showError (msg.substr (0, msg.indexOf ('{0}')), FLEXUI.getInstallHTML ());
return;
}
VIEWERFLEX.setViewerLayoutType (this.id, this.layoutType);
if (!this._promptDlg) {
this._promptDlg = document.createElement ('div');
this._promptDlg.id = this.id + '_promptDlg';
this._promptDlg.closeCB = closeCB;
var PROMPT_STYLE = this._promptDlg.style;
PROMPT_STYLE.border = '1px';
PROMPT_STYLE.borderStyle = 'solid';
PROMPT_STYLE.borderColor = '#000000';
PROMPT_STYLE.position = 'absolute';
PROMPT_STYLE.zIndex = bobj.constants.modalLayerIndex;
var divID = bobj.uniqueId ();
this._promptDlg.innerHTML = "<div id=\"" + divID + "\" name=\"" + divID + "\"></div>";
// generate hidden buttons to prevent tabbing into the viewer
var onfocusCB = bobj.bindFunctionToObject(bobj.crv.Viewer.keepFocus, this);
var firstLink = MochiKit.DOM.createDOM('BUTTON', {
id : this._promptDlg.id + '_firstLink',
onfocus : onfocusCB,
style : {
width : '0px',
height : '0px',
position : 'absolute',
left : '-30px',
top : '-30px'
}
});
var lastLink = MochiKit.DOM.createDOM('BUTTON', {
id : this._promptDlg.id + '_lastLink',
onfocus : onfocusCB,
style : {
width : '0px',
height : '0px',
position : 'absolute',
left : '-30px',
top : '-30px'
}
});
document.body.appendChild (firstLink);
document.body.appendChild (this._promptDlg);
document.body.appendChild (lastLink);
var state = bobj.crv.stateManager.getComponentState (this.id);
var sessionID = state.common.reportSourceSessionID;
var lang = bobj.crv.getLangCode ();
FLEXUI.setMasterCallBack (this.id, VIEWERFLEX);
FLEXUI.createSWF (this.id, divID, servletURL, true, lang, sessionID);
} else {
this._promptDlg.closeCB = closeCB;
this._promptDlg.style.display = '';
FLEXUI.init (this.id);
}
this.setDisplayModalBackground (true);
},
sendPromptingAsyncRequest : function (evArgs){
MochiKit.Signal.signal(this, 'crprompt_asyncrequest', evArgs);
},
setDisplayModalBackground : function (isDisplay) {
isDisplay = this.isDisplayModalBG || isDisplay; //viewer.isDisplayModalBG has higher priority
if(this._modalBackground)
this._modalBackground.show(isDisplay);
},
_onShowPromptDialog : function() {
this._adjustWindowScrollBars ();
this.setDisplayModalBackground (true);
},
_onHidePromptDialog : function() {
this._adjustWindowScrollBars ();
document.onkeypress = this._originalDocumentOnKeyPress;
this.setDisplayModalBackground (false);
},
isPromptDialogVisible: function () {
return this._promptDlg && this._promptDlg.isVisible && this._promptDlg.isVisible ();
},
hidePromptDialog : function() {
if (this.isPromptDialogVisible()) {
this._promptDlg.show (false);
}
},
/**
* Hide the flex prompt dialog
*/
hideFlexPromptDialog : function() {
if (this._promptDlg) {
if (_ie)
{
/* IE has an issue where if a user calls back from a swf
and closes the containing div then when the div is shown
again the swf will lose any external interface calls. To get around
this we must set the focus to something other than the swf first
before hiding the window. */
this._promptDlg.focus();
}
this._promptDlg.style.visibility = 'hidden';
this._promptDlg.style.display = 'none';
this.setDisplayModalBackground (false);
if (this._promptDlg.closeCB)
this._promptDlg.closeCB();
}
},
_adjustWindowScrollBars : function() {
if (_ie && this.layoutType == bobj.crv.Viewer.LayoutTypes.CLIENT && this._promptDlg && this._promptDlg.layer && MochiKit.DOM.currentDocument ().body) {
var bodyOverFlow, pageOverFlow;
var body = MochiKit.DOM.currentDocument ().body;
var promptDlgLayer = this._promptDlg.layer;
if (this.getReportPage () && this.getReportPage ().layer) {
var reportPageLayer = this.getReportPage ().layer;
}
if (!window["bodyOverFlow"]) {
window["bodyOverFlow"] = MochiKit.DOM.getStyle (body, 'overflow');
}
if (body.offsetHeight < (promptDlgLayer.offsetTop + promptDlgLayer.offsetHeight)) {
if (window["bodyOverFlow"] == "hidden") {
bodyOverFlow = "scroll";
}
pageOverFlow = "hidden";
} else {
bodyOverFlow = window["bodyOverFlow"];
pageOverFlow = "auto";
}
body.style.overflow = bodyOverFlow;
if (reportPageLayer) {
reportPageLayer.style.overflow = pageOverFlow;
}
}
},
/**
* Display an error message dialog.
*
* @param text [String] Short, user-friendly error message
* @param details [String] Technical info that's hidden unless the user chooses to see it
*/
showError : function(text, details) {
var dlg = bobj.crv.ErrorDialog.getInstance ();
dlg.setText (text, details);
dlg.setTitle (L_bobj_crv_Error);
dlg.show (true);
},
/**
* Update the UI using the given properties
*
* @param update [Object] Component properties
*/
update : function(update) {
if (!update || update.cons != "bobj.crv.newViewer")
return;
if(update.args)
this.isDisplayModalBG = update.args.isDisplayModalBG;
/*
* With CR2010 DCP prompting we want to keep open the prompt dialog until all parameters
* are resolved (ADAPT01346079). Unfortunately, as soon as the parameters resolved, server
* calls the getPage and returns the page content, so we don't know when to close the dialog.
*/
this.hidePromptDialog();
for ( var childNum in update.children) {
var child = update.children[childNum];
if (child) {
switch (child.cons) {
case "bobj.crv.newReportAlbum":
if (this._reportAlbum) {
this._reportAlbum.update (child);
}
break;
case "bobj.crv.newToolbar":
if (this._topToolbar) {
this._topToolbar.update (child);
}
break;
case "bobj.crv.newStatusbar":
if (this._statusbar) {
this._statusbar.update (child);
}
break;
case "bobj.crv.newLeftPanel":
if (this._leftPanel)
this._leftPanel.update (child);
else {
this._leftPanel = bobj.crv.createWidget(child);
if(this.layer) {
append(this.layer, this._leftPanel.getHTML())
this._initLeftPanelSignals ();
this._leftPanel.init();
}
if(this._leftPanel && this._leftPanel.isToolPanelDisplayed())
this._leftPanelResizeGrabber.setDisplay(true);
}
break;
case "bobj.crv.newExportUI":
if (this._export) {
this._export.update (child);
}
break;
}
}
}
this._doLayout ();
this.scrollToHighlighted ();
this.setDisplayModalBackground (this.isDisplayModalBG);
},
getToolPanel : function() {
if(this._leftPanel)
return this._leftPanel.getToolPanel();
return null;
},
getParameterPanel : function() {
var toolPanel = this.getToolPanel ();
if (toolPanel)
return toolPanel.getParameterPanel ();
return null;
},
getReportPage : function() {
if (this._reportAlbum) {
var view = this._reportAlbum.getSelectedView();
if (view) {
return view.reportPage;
}
}
return null;
},
scrollToHighlighted : function() {
if(!this._reportAlbum)
return;
var currentView = this._reportAlbum.getSelectedView ();
if (currentView) {
currentView.scrollToHighlighted(this.layoutType.toLowerCase () == bobj.crv.Viewer.LayoutTypes.FITREPORT);
}
},
addViewerEventListener : function (e, l) {
var ls = this._eventListeners[e];
if (!ls) {
this._eventListeners[e] = [l];
return;
}
ls[ls.length] = l;
},
removeViewerEventListener : function (e, l) {
var ls = this._eventListeners[e];
if (ls) {
for (var i = 0, lsLen = ls.length; i < lsLen; i++) {
if (ls[i] == l){
ls.splice(i, 1);
return;
}
}
}
},
getEventListeners : function (e) {
return this._eventListeners[e];
}
};
bobj.crv.BoundaryControl = function(id) {
this.id = id;
};
bobj.crv.BoundaryControl.prototype = {
updateBoundary : function(width,height,left,top) {
if(!this.layer) {
this._init();
}
if(this.layer) {
this.layer.style.width = width + "px";
this.layer.style.height = height + "px";
this.layer.style.left = left + "px";
this.layer.style.top = top + "px";
}
},
_getStyle : function () {
return {
display:'block',
visibility:'hidden',
position:'absolute'
};
},
_getHTML : function () {
return bobj.html.DIV({id : this.id, style : this._getStyle()});
},
_init: function() {
if(!this.layer){
append2(_curDoc.body,this._getHTML ());
this.layer = getLayer(this.id);
this.layer.onselectstart = function () {return false;};
this.layer.onmousedown = eventCancelBubble;
if (this.mouseupCB)
this.layer.onmouseup = this.mouseupCB;
}
}
};
bobj.crv.ModalBackground = function (id, mouseupCB) {
this.id = id;
this.mouseupCB = mouseupCB;
};
bobj.crv.ModalBackground.prototype = new bobj.crv.BoundaryControl();
MochiKit.Base.update(bobj.crv.ModalBackground.prototype, {
_getStyle : function () {
return {
'background-color' : '#888888',
position : 'absolute',
opacity : 0.30,
display : 'block',
filter : 'alpha(opacity=30);',
'z-index' : bobj.constants.modalLayerIndex - 2,
visibility : 'hidden'
};
},
show : function (show) {
if(!this.layer) {
this._init();
}
this.layer.style.visibility = show ? "visible" : "hidden";
}
});

View File

@@ -0,0 +1,547 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
/*
================================================================================
ViewerFlexParameterAdapter.js
Viewer's implementaion for flex prompting UI
================================================================================
*/
bobj.crv.params.ViewerFlexParameterAdapter = {
_viewerLayoutType : [],
_promptData : [],
_paramCtrl : [],
_iParam : [],
_iPromptUnitData : [],
_iParamData : [],
_moveArea : null,
///////////////////////////
// Member setters
//////////////////////////
setViewerLayoutType : function(id, l) {
this._viewerLayoutType[id] = l;
},
setPromptData : function(id, d, forIParams) {
if (!forIParams){
/* Full prompt UI data */
this._promptData[id] = d;
this.clearIParamPromptUnitData(id);
}else{
/* Interactive prompt UI data */
for(var i = 0, l = d.length; i < l; i++) {
var unit = d[i];
this._addIParamPromptUnitData(id, unit.id, unit.names, unit.data);
}
}
},
setCurrentIParamInfo : function(id, c, p) {
this._paramCtrl[id] = c;
this._iParam[id] = p;
},
getShowMinUI : function (id) {
return this.hasIParamPromptUnitData(id);
},
getWidth : function (id) {
if(this.hasIParamPromptUnitData(id))
return 300;
else
return this.getSWFWidth(id);
},
getHeight : function (id) {
if(this.hasIParamPromptUnitData(id))
return 315;
else
return this.getSWFHeight(id);
},
getScreenHeight : function (id) {
var lDim = MochiKit.Style.getElementDimensions(getLayer(id));
return lDim.h - 2;
},
getScreenWidth : function (id) {
var lDim = MochiKit.Style.getElementDimensions(getLayer(id));
return lDim.w - 2;
},
/*
* Returns the ideal height of the prompting window
*/
getSWFHeight : function(id) {
var lTypes = bobj.crv.Viewer.LayoutTypes;
var layout = lTypes.CLIENT;
if (this._viewerLayoutType[id]) {
layout = this._viewerLayoutType[id];
}
var min = layout === lTypes.FIXED ? 0 : 480;
var sH = this.getScreenHeight(id);
return Math.max(min, sH - 200);
},
getSWFWidth : function(id) {
var sW = this.getScreenWidth(id);
return Math.min(600, sW - 20);
},
getAllowFullScreen : function(id)
{
return !this.hasIParamPromptUnitData(id);
},
hasIParamPromptUnitData : function (id) {
return (this._iPromptUnitData[id] != null) && (this._iParamData[id] != null) && (this._iParam[id] != null);
},
_addIParamPromptUnitData : function(id, unitID, names, data) {
if (!this.hasIParamPromptUnitData(id)) {
this._iPromptUnitData[id] = [];
this._iParamData[id] = [];
}
this._iPromptUnitData[id][unitID] = data;
for ( var i = 0, len = names.length; i < len; i++) {
this._iParamData[id][names[i]] = unitID;
}
},
clearIParamPromptUnitData : function (id) {
if (!this.hasIParamPromptUnitData(id)) {
return;
}
delete this._iPromptUnitData[id];
delete this._iParamData[id];
delete this._iParam[id];
},
///////////////////////////
// Callbacks
//////////////////////////
getPromptData : function (id) {
if (this.hasIParamPromptUnitData(id)) {
var promptUUID = this._iParamData[id][this._iParam[id].paramName];
if (promptUUID) {
return this._iPromptUnitData[id][promptUUID];
}
}
return this._promptData[id];
},
/**
* Flex callback to start moving the dialog
*/
startDrag : function(id) {
var swf = bobj.crv.params.FlexParameterBridge.getSWF(id);
if (swf) {
if (this._moveArea) {
return;
}
this._moveArea = document.createElement('div');
this._moveArea.id = bobj.uniqueId();
MOVE_STYLE = this._moveArea.style;
var STYLE = swf.style;
var P_STYLE = swf.parentNode.style;
MOVE_STYLE.top = P_STYLE.top;
MOVE_STYLE.left = P_STYLE.left;
MOVE_STYLE.width = STYLE.width ? STYLE.width : swf.width + 'px';
MOVE_STYLE.height = STYLE.height ? STYLE.height : swf.height + 'px';;
MOVE_STYLE.border = '1px';
MOVE_STYLE.borderStyle = 'solid';
MOVE_STYLE.borderColor = '#000000';
MOVE_STYLE.backgroundColor = '#FFFFFF';
MOVE_STYLE.position = 'absolute';
MOVE_STYLE.opacity = 0.50;
MOVE_STYLE.filter = 'alpha(opacity=50)';
MOVE_STYLE.zIndex = bobj.constants.modalLayerIndex - 1;
document.body.appendChild(this._moveArea);
document.body.style.cursor = 'move';
}
},
/**
* Flex callback when finished moving the dialog
*/
stopDrag : function(id) {
if (this._moveArea) {
var p = MochiKit.Style.getElementPosition(this._moveArea);
this.move(id, p.x, p.y);
document.body.removeChild(this._moveArea);
delete this._moveArea;
document.body.style.cursor = 'default';
}
},
/**
* Flex callback for moving the dialog.
* x is the amount to move on the x axis, -:left +:right
* y is the amount to move on the y axis, -:up +:down
*/
drag : function(id, x, y) {
var LOG = bobj.crv.logger;
LOG.info('doMove Called viewer:' + id + ' x:' + x + ' y:' + y);
var l = getLayer(id);
if (!l) {
LOG.error('Shifting SWF could not find the viewer:' + id);
return;
}
var m = this._moveArea;
if (!m) {
LOG.error('Unable to move SWF, no move area available');
return;
}
var mX = m.offsetLeft;
var mY = m.offsetTop;
var mH = m.offsetHeight;
var mW = m.offsetWidth;
var vX = l.offsetLeft;
var vY = l.offsetTop;
var vH = l.offsetHeight;
var vW = l.offsetWidth;
var newX = mX + x;
var newY = mY + y;
if (newY < vY) {
newY = vY;
} else if (newY + mH > vY + vH) {
newY = vH - mH;
}
if (newX < vX) {
newX = vX;
} else if (newX + mW > vX + vW) {
newX = vW - mW;
}
m.style.top = newY + 'px';
m.style.left = newX + 'px';
LOG.info('Moved the SWF to x:' + newX + ' y:' + newY);
},
/**
* Flex callback when finished moving the dialog
*/
move : function(id, x, y) {
var swf = bobj.crv.params.FlexParameterBridge.getSWF(id);
if (swf) {
var p = new MochiKit.Style.Coordinates(x,y);
MochiKit.Style.setElementPosition(swf.parentNode, p);
}
},
setParamValues : function(id, valueData) {
bobj.crv.logger.info('setting parameter values');
if (this.hasIParamPromptUnitData(id)){
this._setIParamValues (id, valueData);
} else {
this._setFullParamValues (id, valueData);
this.closeDialog(id);
}
},
_setFullParamValues : function (id, valueData) {
bobj.event.publish('crprompt_flexparam', id, valueData);
},
_setIParamValues : function (id, valueData) {
var param = this._iParam[id];
var ctrl = this._paramCtrl[id];
var data = this._iParamData[id];
var unitData = this._iPromptUnitData[id];
if (!param || !ctrl || !data || !unitData || valueData.length != 1) {
return;
}
var vPromptUnit = valueData[0];
var vPrompts = vPromptUnit.prompts;
for (var i = 0, len = vPrompts.length; i < len; i++) {
var vPrompt = vPrompts[i];
if (!vPrompt || !vPrompt.name || !vPrompt.values) {
continue;
}
ctrl.updateParameter(decodeURI(vPrompt.name), this._convertFlexValues(vPrompt, param.valueDataType));
}
ctrl._updateToolbar();
this._updatePromptData(id, vPromptUnit, param.valueDataType);
this.closeDialog(id);
},
_updatePromptData: function (id, newUnitData, type){
var newPrompts = newUnitData.prompts;
var data = this._iPromptUnitData[id][newUnitData.id];
var unitData = data.promptUnits[0];
var prompts = unitData.prompts;
for (var i = 0, pLen = prompts.length; i < pLen; i++) {
var prompt = prompts[i];
for (var j = 0, npLen = newPrompts.length; j < npLen; j++) {
var newPrompt = newPrompts[j];
if (prompt.id == newPrompt.id){
prompt.values = this._unescapeFlexValues(newPrompt.values, type);
break;
}
}
}
},
_unescapeFlexValues: function (fValues, type){
if (type != bobj.crv.params.DataTypes.STRING) {
return fValues;
}
for (var i = 0, len = fValues.length; i < len; i++) {
this._unescapeFlexValue(fValues[i], type);
}
return fValues;
},
_unescapeFlexValue: function (fValue, type) {
if (type != bobj.crv.params.DataTypes.STRING) {
return;
}
if ((fValue.value !== undefined && fValue.value !== null)){
fValue.value = decodeURI(fValue.value);
if (fValue.labels !== undefined && fValue.labels !== null){
for (var i = 0, len = fValue.labels.length; i < len; i++) {
fValue.labels[i] = decodeURI(fValue.labels[i]);
}
}
} else {
// Range
if (fValue.start){
this._unescapeFlexValue(fValue.start, type);
}
if (fValue.end){
this._unescapeFlexValue(fValue.end, type);
}
}
},
_getDescriptionIndex: function (prompt)
{
var vIndex = prompt.lovValueIndex;
var types = prompt.lovFieldTypes;
if (vIndex !== undefined && types !== undefined)
{
for (var i=0, len=types.length; i<len; i++) {
if (i != vIndex && types[i] == "s"){
return i;
}
}
}
return -1;
},
_convertFlexValues: function (prompt, type){
var dIndex = this._getDescriptionIndex(prompt);
var fValues = prompt.values;
var jsValues = [];
for (var i = 0, len = fValues.length; i < len; i++) {
jsValues.push(this._convertFlexValue(fValues[i], type, dIndex));
}
return jsValues;
},
_convertFlexValue: function (fValue, type, dIndex) {
var jsValue = {};
if ((fValue.value !== undefined && fValue.value !== null)){
// Discrete
if (dIndex > -1 && fValue.labels && fValue.labels.length > dIndex){
jsValue.desc = decodeURI(fValue.labels[dIndex]);
}
var Type = bobj.crv.params.DataTypes;
switch (type) {
case Type.DATE:
case Type.TIME:
case Type.DATE_TIME:
jsValue.value = this._convertDateTimeFlexValue(fValue.value, type);
break;
default:
jsValue.value = decodeURI(fValue.value);
break;
}
} else {
// Range
if (fValue.start){
jsValue.lowerBoundType = fValue.start.inc == true ? 2 : 1;
jsValue.beginValue = this._convertFlexValue(fValue.start, type);
} else {
jsValue.lowerBoundType = 0;
}
if (fValue.end){
jsValue.upperBoundType = fValue.end.inc == true ? 2 : 1;
jsValue.endValue = this._convertFlexValue(fValue.end, type);
} else {
jsValue.upperBoundType = 0;
}
}
return jsValue;
},
_convertDateTimeFlexValue : function (fValue, type) {
var Type = bobj.crv.params.DataTypes;
var dValue = {};
var parts = fValue.split(',');
switch(type) {
case Type.DATE:
dValue.y = parseInt(parts[0].substring(5), 10);
dValue.m = parseInt(parts[1], 10) - 1;
dValue.d = parseInt(parts[2].substring(parts[2].length - 1, 0), 10);
break;
case Type.TIME:
dValue.h = parseInt(parts[0].substring(5), 10);
dValue.min = parseInt(parts[1], 10);
dValue.s = parseInt(parts[2].substring(parts[2].length - 1, 0), 10);
dValue.ms = 0;
break;
case Type.DATE_TIME:
dValue.y = parseInt(parts[0].substring(9), 10);
dValue.m = parseInt(parts[1], 10) - 1;
dValue.d = parseInt(parts[2], 10);
dValue.h = parseInt(parts[3], 10);
dValue.min = parseInt(parts[4]);
dValue.s = parseInt(parts[5].substring(parts[5].length - 1, 0), 10);
dValue.ms = 0;
break;
}
return dValue;
},
logon : function(id, logonData) {
bobj.crv.logger.info('logging on');
this.closeDialog(id);
bobj.event.publish('crprompt_flexlogon', id, logonData);
},
processingCancel : function(id) {
var v = getWidgetFromID(id);
if (v && v._reportProcessing) {
v._reportProcessing.cancelShow();
}
},
processingDelayedShow : function(id) {
var v = getWidgetFromID(id);
if (v && v._reportProcessing) {
v._reportProcessing.delayedShow();
}
},
logger : function(text) {
bobj.crv.logger.info(text);
},
getSWFBaseURL : function() {
return bobj.crvUri("../../swf/");
},
getSWFID : function() {
return bobj.uniqueId();
},
getZIndex : function() {
return bobj.constants.modalLayerIndex;
},
getUseSavedData : function(id) {
return this.hasIParamPromptUnitData(id);
},
closeDialog : function(id) {
var v = getWidgetFromID(id);
if (v) {
v.hideFlexPromptDialog();
}
},
getUseOKCancelButtons : function(id) {
return this.hasIParamPromptUnitData(id);
},
getIsDialog : function(id) {
return true;
},
getShouldAutoResize : function(id) {
return true;
},
setVisibility : function(id) {
var swf = bobj.crv.params.FlexParameterBridge.getSWF(id);
if (swf) {
var P_STYLE = swf.parentNode.style;
P_STYLE.position = 'absolute';
P_STYLE.visibility = 'visible';
P_STYLE.borderStyle = 'none';
P_STYLE.opacity = 1;
if (swf.focus !== undefined) {
swf.focus();
}
}
},
getReportStateInfo : function(id) {
var s = bobj.crv.stateManager.getComponentState(id);
if (s && s.common && s.common.reqCtx) {
return MochiKit.Base.serializeJSON(s.common.reqCtx);
}
},
setReportStateInfo : function(id, rsInfo) {
var s = bobj.crv.stateManager.getComponentState(id);
if (s && s.common && s.common.reqCtx) {
s.common.reqCtx = MochiKit.Base.evalJSON(unescape(rsInfo));
}
},
sendAsyncRequest : function(id, args) {
bobj.event.publish('crprompt_asyncrequest', id, args);
},
readyToShow: function(id) {
this.processingCancel(id);
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
if (typeof bobj === 'undefined') {
bobj = {};
}
if (typeof bobj.crv === 'undefined') {
bobj.crv = {};
}
if (typeof bobj.crv.WarningPopup === 'undefined') {
bobj.crv.WarningPopup = {};
}
bobj.crv.WarningPopup.getInstance = function() {
if (bobj.crv.WarningPopup.__instance === undefined)
bobj.crv.WarningPopup.__instance = new bobj.crv.WarningPopup.Class();
return bobj.crv.WarningPopup.__instance;
};
bobj.crv.WarningPopup.Class = function() {
this.layer = null;
this.id = bobj.uniqueId();
};
bobj.crv.WarningPopup.Class.prototype = {
show : function(text, xPos, yPos) {
if (!this.layer) {
this.init();
}
this.layer.style.top = yPos + "px";
this.layer.style.left = xPos + "px";
this.txtLayer.innerHTML = text;
this.layer.style.display = "block";
},
hide : function() {
if (this.layer)
this.layer.style.display = "none";
},
getHTML : function() {
return bobj.html.DIV( {
'class' : 'WarningPopup',
id : this.id
}, bobj.html.IMG( {
id : this.id + "img",
style : {
position : 'absolute',
left : '10px',
top : '-19px'
},
src : bobj.crvUri('images/WarningPopupTriangle.gif')
}), bobj.html.DIV( {
id : this.id + "txt",
style : {
padding : "5px"
}
}));
},
init : function() {
append2(document.body, this.getHTML());
this.layer = getLayer(this.id);
this.txtLayer = getLayer(this.id + "txt");
}
};

View File

@@ -0,0 +1,84 @@
// Copyright (c) Business Objects 2010. All rights reserved.
// CrystalReports DHTML Viewer SDK
// Version: Internal (Unsupported)
// ###################################################################################
// CRViewer object contains utilities that allow interaction with the CrystalReports DHTML viewer.
// CRViewer has the following properties and methods defined.
// CRViewer.getViewer()
// returns an CRViewer.Viewer object that represents the DHTML viewer on the current page. Use this object to interact with the DHTML viewer.
// CRViewer.getViewer().addEventListener (event type, listener function)
// Registers a listener function with the given event type. The listener function should return true if the event was handled and normal viewer processing should not occur.
// CRViewer.getViewer().removeEventListener (event type, listener function)
// Removes the listener for the given event type.
// CRViewer.Events
// returns an Array of event types that can be handled using event listeners
// CRViewer.Events.HyperlinkClicked
// An event that will be fired when a hyperlink is clicked. Note this event will only occur if the viewer is configured to render hyperlinks using javascript.
// Arguments to listeners of these events will be as follows: { url : 'url string', target : 'target for the link'}
// ###################################################################################
if (typeof (CRViewer) == "undefined") {
CRViewer = {
getViewer : function (/* optional */ viewerName) {
return this._getViewer(viewerName);
},
Events : {
HyperlinkClicked : "hyperlinkClicked"
},
_viewersMap : [],
_getViewer : function (viewerName) {
var map = this._viewersMap;
if (viewerName) {
for (var i = 0, len = map.length; i < len; i++) {
if (map[i].id == viewerName) {
return map[i];
}
}
} else if (map.length > 0) {
return map[0];
}
return this._createViewer(viewerName);
},
_getRealViewer : function (viewerName)
{
if (viewerName) {
return getWidgetFromID(viewerName);
} else {
if (_widgets) {
for (var i = 0, len = _widgets.length; i < len; i++) {
if (_widgets[i].widgetType == "Viewer") {
return _widgets[i];
}
}
}
}
},
_createViewer : function (viewerName)
{
var realViewer = this._getRealViewer(viewerName);
if (realViewer && realViewer.widgetType == "Viewer") {
var o = {};
o.id = realViewer.id;
o.realViewer = realViewer;
o.addEventListener = function (event, listener) {
this.realViewer.addViewerEventListener(event, listener);
}
o.removeEventListener = function (event, listener) {
this.realViewer.removeViewerEventListener(event, listener);
}
this._viewersMap[this._viewersMap.length] = o;
return o;
}
}
};
}

View File

@@ -0,0 +1,34 @@
function bobj_WebForm_Callback (viewerID, callbackEventArgument, formID) {
if (!viewerID || !formID) {
return;
}
var frm = document.getElementById(formID); // get the form by using viewerID
if (!frm) {
return;
}
var strArr = [];
for (var i = 0, itemCount = frm.elements.length; i < itemCount; i++) {
var elem = frm.elements[i];
if (elem.name && elem.value) {
strArr.push(elem.name);
strArr.push('=');
strArr.push(encodeURIComponent(elem.value));
strArr.push('&');
}
}
strArr.push('__BOBJ_CALLBACK_EVENTTARGET=');
strArr.push(encodeURIComponent(viewerID));
strArr.push('&__BOBJ_CALLBACK_EVENTARGUMENT=');
strArr.push(encodeURIComponent(callbackEventArgument));
var qryString = strArr.join('');
var req = MochiKit.Async.getXMLHttpRequest();
req.open("POST", frm.action, true);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
req.setRequestHeader('Accept','application/json');
return MochiKit.Async.sendXMLHttpRequest(req, qryString);
}

View File

@@ -0,0 +1,776 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
if (typeof bobj == 'undefined') {
bobj = {};
}
if (typeof bobj.constants == 'undefined') {
bobj.constants = {
modalLayerIndex:1000
};
}
/**
* @return [String] Returns a different id each time it's called
*/
bobj.uniqueId = function() {
return 'bobjid_' + (++bobj.uniqueId._count);
};
if (typeof bobj.uniqueId._count == 'undefined') {
bobj.uniqueId._count = new Date().getTime();
}
/**
* Like MochiKit.Base.update except that it checks each item in obj against
* a test function before adding it to self.
*
* @param test [Function] function that returns a boolean when passed (self, obj, key)
* @param self [Object|null] object to be updated
* @param obj [Object] object to copy properties from
*/
bobj.updateIf = function (test, self, obj/*, ... */) {
if (self === null) {
self = {};
}
for (var i = 1, len = arguments.length; i < len; i++) {
var o = arguments[i];
if (typeof(o) != 'undefined' && o !== null) {
for (var k in o) {
if (test(self, obj, k)) {
self[k] = o[k];
}
}
}
}
return self;
};
/**
* Copy properties from obj to self if the properties are undefined in self
*/
bobj.fillIn = function (self, obj) {
var test = function(self, obj, k) {
return (typeof(self[k]) == 'undefined');
}
bobj.updateIf(test, self, obj);
};
bobj.isObject = function(obj) {
return (obj && typeof obj == 'object');
};
bobj.isArray = function(obj) {
if(bobj.isObject(obj)) {
try {
return obj.constructor == Array;
}
catch(e) {
return false;
}
}
return false;
};
bobj.isString = function(obj) {
return (typeof(obj) == 'string');
};
bobj.isNumber = function(obj) {
return typeof(obj) == 'number' && isFinite(obj);
};
bobj.isBoolean = function(obj) {
return typeof obj == 'boolean';
};
bobj.isFunction = function(obj) {
return typeof(obj) == 'function';
};
/**
* Checks for the border box model, where css width includes padding and borders.
* IE uses this box model when a strict dtd is not specified.
*
* @return [boolean] Returns true if the border box model is being used
*/
bobj.isBorderBoxModel = function() {
if (typeof bobj.isBorderBoxModel._cachedValue == 'undefined') {
/*
* TODO: It is unnecessary to create DIV to check border box model. All we need to do is check _ie && quirksMode
* I didn't remove it for sake of not breaking different scenarios (requires alot of testing)
*/
if(document.body) {
var box = document.createElement('div');
box.style.width = '10px';
box.style.padding = '1px';
box.style.position = 'absolute';
box.style.visibility = 'hidden';
document.body.appendChild(box);
bobj.isBorderBoxModel._cachedValue = (box.offsetWidth == 10);
document.body.removeChild(box);
}
else {
return _ie && bobj.isQuirksMode();
}
}
return bobj.isBorderBoxModel._cachedValue;
};
/**
* @return [boolean] True if the document is rendering in quirks mode
*/
bobj.isQuirksMode = function() {
return (document.compatMode != 'CSS1Compat');
};
/* Sets the visual style of the specified element
*
* @param element [DOM node]
* @param visualStyle {} object containing visual styles
*/
bobj.setVisualStyle =function(element,visualStyle) {
if(element === null || visualStyle === null) {
return;
}
var elemStyle = element.style;
if(visualStyle.className)
element.className = visualStyle.className;
MochiKit.Iter.forEach ( [ "background", "borderWidth", "borderStyle", "borderColor", "fontFamily", "fontStyle", "fontSize",
"fontWeight", "textDecoration", "color", "width", "height", "left", "top" ], function(styleName) {
if (visualStyle[styleName])
elemStyle[styleName] = visualStyle[styleName];
});
};
/**
* Sets the outer size of an element, including padding, borders and margins.
*
* Note: Non-pixel units are ignored
*
* @param node [DOM node]
* @param w [Int - optional] Width in pixels
* @param h [Int - optional] Height in pixels
* @param excludeMargins [bool - optional] When true, margins are not included
* in the box size.
*/
bobj.setOuterSize = function(node, w, h, excludeMargins) {
var origStyle = null;
var nodeStyle = node.style;
if (nodeStyle.display == 'none') {
// Nodes have to be displayed to get their calculated styles.
// We display them but make them invisible and absolutely positioned
// so they don't affect the layout.
origStyle = {
visibility: nodeStyle.visibility,
position: nodeStyle.position,
display: 'none'
};
nodeStyle.visibility = 'hidden';
nodeStyle.position = 'absolute';
nodeStyle.display = '';
}
function pixels (selector) {
var value = MochiKit.DOM.getStyle(node, selector);
if (bobj.isString(value) && value.substring(value.length - 2 == 'px')) {
return (parseInt(value, 10) || 0);
}
return 0;
}
if (bobj.isNumber(w)) {
if (!bobj.isBorderBoxModel()) {
w -= pixels('border-left-width');
w -= pixels('border-right-width');
w -= pixels('padding-left');
w -= pixels('padding-right');
if(excludeMargins) {
w -= pixels('margin-left');
w -= pixels('margin-right');
}
}
nodeStyle.width = Math.max(0, w) + 'px';
}
if (bobj.isNumber(h)) {
if (!bobj.isBorderBoxModel()) {
if(excludeMargins) {
h -= pixels('margin-top');
h -= pixels('margin-bottom');
}
h -= pixels('border-top-width');
h -= pixels('border-bottom-width');
h -= pixels('padding-top');
h -= pixels('padding-bottom');
}
nodeStyle.height = Math.max(0, h) + 'px';
}
if (origStyle) {
nodeStyle.display = origStyle.display;
nodeStyle.position = origStyle.position;
nodeStyle.visibility = origStyle.visibility;
}
};
/**
* Get the node that contains a child widget.
*
* @param child [object] the widget whose parent node to be looked for
*/
bobj.getContainer = function(child) {
if (child && child.layer) {
return child.layer.parentNode;
}
return null;
};
/**
* Checks whether elem has a parent with the tag name equivalent to parentTagName
*
* @param elem [HTML node] the element whose parent is checked against parentTagName
* @param parentTagName [String] Parent's tagName ie) TABLE
*
*
* @return [boolean] True if elem has a parent with tagName equivalent to parentTagName
*/
bobj.checkParent = function(elem,parentTagName) {
var foundParent = false;
if(elem && parentTagName) {
parentTagName = parentTagName.toUpperCase();
var parent = elem.parentNode;
while(parent) {
if(parent.tagName == parentTagName) {
foundParent = true;
break;
}
parent = parent.parentNode;
}
}
return foundParent;
};
/**
* Implements Array.slice for array-like objects. For example, the special
* "arguments" variable within function calls is array-like but doesn't have
* a slice method.
*
* @param arrayLike [Object] An array-like object as defined by MochiKit.Base.isArrayLike.
* @param begin [Number] Zero-based index at which to begin extraction.
* @param end [Number] Zero-based index at which to end extraction.
* Extracts up to but not including end.
*
* @return [Array] A shallow copy of the portion of the array specified or null if invalid argument.
*/
bobj.slice = function(arrayLike, begin, end) {
if (bobj.isArray(arrayLike)) {
return arrayLike.slice(begin, end);
}
else if (MochiKit.Base.isArrayLike(arrayLike)) {
var retArray = [];
var endIdx = arrayLike.length;
if (bobj.isNumber(end) && end < endIdx) {
endIdx = end;
}
begin = Math.max(begin, 0);
for (var i = begin; i < endIdx; ++i) {
retArray.push(arrayLike[i]);
}
return retArray;
}
return null;
};
/**
* Extract a range of elements from a string or array-like list (non-destructive)
*
* @param list [String | Array-Like]
* @param start [Int] Index of start, inclusive
* @param end [Int] Index of end, exclusive
*
* @return Array of extracted elements or Null
*/
bobj.extractRange = function(list, start, end) {
if (list && bobj.isNumber(start)) {
if (!bobj.isNumber(end) || end > list.length) {
end = list.length;
}
start = Math.max(0, start);
if (start < end) {
var s1 = 0, e1 = start;
var s2 = end, e2 = list.length;
if (list.substring) {
return (list.substring(s1, e1) + list.substring(s2, e2));
}
else {
return bobj.slice(list, s1, e1).concat(bobj.slice(list, s2, e2));
}
}
}
return list;
};
/**
* Returns a value with a unit appended
*
* @param val [int or string]
* @param unit [sring - optional] Defaults to 'px'
*
* @return [string] Returns val as a string with unit appended if val is a
* number. Returns val without modification if val is not a number.
*/
bobj.unitValue = function(val, unit) {
if (bobj.isNumber(val)) {
return val + (unit || 'px');
}
return val;
};
/**
* Evaluate an expression in the window (global) scope
*
* @param expression [String] Expression to evaluate
*
* @return Returns the result of the evaluation
*/
bobj.evalInWindow = function(expression) {
if (window.execScript) { // Internet Explorer
return window.execScript(expression);
}
else {
return MochiKit.Base.bind(eval, window, expression).call();
}
};
/**
* Loads specified resource and executes callback
*/
bobj.loadJSResourceAndExecCallBack = function(resource, callback)
{
if(!resource || !callback)
return; // if arguments are not defined, just return
/*
* If bobj.crv.config.useCompressedScripts is true, then the resource is already loaded and we can skip loading
*/
if(!resource.isLoaded) {
var onLoad = function(resource, callback, response) {
resource.isLoaded = true;
bobj.evalInWindow(response.responseText);
callback.apply();
};
var req = MochiKit.Async.getXMLHttpRequest();
req.open("GET", bobj.crvUri(resource.path), true);
req.setRequestHeader('Accept','application/x-javascript,application/javascript, text/javascript');
var deferred = MochiKit.Async.sendXMLHttpRequest(req);
deferred.addCallback(MochiKit.Base.bind(onLoad, this, resource, callback));
}
else {
setTimeout(function(){callback.apply()},0);
}
};
/**
* Remove whitespace from the left end of a string.
*
* @param str [String]
*
* @return [String] Returns a string with no leading whitespace
*/
bobj.trimLeft = function(str) {
str = str || '';
return str.replace(/^\s+/g, '');
};
/**
* Remove whitespace from the right end of a string.
*
* @param str [String]
*
* @return [String] Returns a string with no trailing whitespace
*/
bobj.trimRight = function(str) {
str = str || '';
return str.replace(/\s+$/g, '');
};
/**
* Remove whitespace from both ends of a string.
*
* @param str [String]
*
* @return [String] Returns a string with no leading or trailing whitespace
*/
bobj.trim = function(str) {
return bobj.trimLeft(bobj.trimRight(str));
};
/**
* Check if the two inputs (and their contents) are equal.
*
* @param obj1 [Any]
* @param obj2 [Any]
*
* @return [boolean] Returns true if the two inputs are equal.
*/
bobj.equals = function (obj1, obj2) {
if (typeof(obj1) != typeof(obj2)) {
return false;
}
if (bobj.isObject(obj1)) {
var same = true;
for (var prop in obj1) {
same = same && bobj.equals(obj1[prop], obj2[prop]);
}
return same;
}
else {
return obj1 == obj2;
}
};
/**
* Creates a stylesheet link and adds it to document body
* @param1 href [String] location of css file
*
*/
bobj.includeLink = function(href) {
var head = document.getElementsByTagName("head")[0];
var body = document.body;
var link = document.createElement("link");
link.setAttribute("rel","stylesheet");
link.setAttribute("type","text/css");
link.setAttribute("href",href);
if(head) {
head.appendChild(link);
}
else if(body) {
body.appendChild(link);
}
};
/**
* @param hrefArray Array of url of css files
* @param callback function that gets executed once all css files are loaded
*/
bobj.includeCSSLinksAndExecuteCallback = function (hrefArray, callback) {
if(hrefArray == null || hrefArray.length < 1) {
callback.apply();
return;
}
var cb = function () {
var me = arguments.callee;
var callback = me.callback;
me.hrefCount--;
if(me.hrefCount == 0)
callback.apply();
}
cb.hrefCount = hrefArray.length;
cb.callback = callback;
for(var i = 0, len = hrefArray.length; i < len; i++) {
bobj.includeCSSLinkAndExecuteCallback(hrefArray[i], cb);
}
};
bobj.includeCSSLinkAndExecuteCallback = function(href, callback) {
var cssLinkId = encodeURIComponent(href);
/*if a css file with same href is already added, execute cb and continue */
if(getLayer(cssLinkId)) {
callback.apply();
return;
}
/*if css file successfully loads, add css text and call callback*/
var onLoad = function(callback, linkId, response) {
bobj.addStyleSheet(response.responseText, linkId);
callback.apply();
};
/*if css file fails to load, continue with callback */
var onError = function(callback) {
callback.apply();
};
var req = MochiKit.Async.getXMLHttpRequest();
req.open("GET", href, true);
req.setRequestHeader('Accept','text/css');
var deferred = MochiKit.Async.sendXMLHttpRequest(req);
var cb = MochiKit.Base.bind(onLoad, this, callback, cssLinkId)
var eb = MochiKit.Base.bind(onError, this, callback)
deferred.addCallbacks(cb, eb);
};
bobj.addStyleSheet = function(stylesheet,id) {
var style = document.createElement('style');
style.setAttribute("type", "text/css");
if(id) {
style.setAttribute("id", id);
}
if (style.styleSheet) {
style.styleSheet.cssText = stylesheet;
}
else {
style.appendChild(document.createTextNode(stylesheet));
}
var head = document.getElementsByTagName('head');
var body = document.getElementsByTagName('body');
if(head && head[0]) {
head[0].appendChild(style);
}
else if(body && body[0]) {
body[0].appendChild(style);
}
};
bobj.removeAllChildElements = function(elem) {
if(elem) {
while(elem.lastChild) {
elem.removeChild(elem.lastChild);
}
}
};
bobj.getValueHashCode = function(valueType, value) {
var Types = bobj.crv.params.DataTypes;
switch(valueType) {
case Types.BOOLEAN :
case Types.CURRENCY:
case Types.NUMBER:
case Types.STRING:
return '' + value;
case Types.TIME:
return '' + value.h + ',' + value.min + ',' + value.s + ',' + value.ms;
case Types.DATE:
return '' + value.y + ',' + value.m + ',' + value.d;
case Types.DATE_TIME:
return '' + value.y + ',' +value.m + ',' + value.d + ',' + value.h + ',' + value.min + ',' + value.s + ',' + value.ms;
}
};
/**
* Checks if there's a DOM element whose ID attribute matches the given string. If not, continue to search for a DOM element
* whose Name attribute matches the given string.
*
* @param idOrName [string] The ID or Name of the element to search for.
* @return [DOM element] Returns a DOM element, or null.
*/
bobj.getElementByIdOrName = function (idOrName) {
if (!idOrName) {
return null;
}
var elem = document.getElementById(idOrName);
if (elem) {
return elem;
}
var elems = document.getElementsByName(idOrName);
if (elems && elems.length > 0) {
return elems[0];
}
return null;
};
/*
* Returns a rectangle that can be used for css clip property
* @param top, right, bottom, left [Int]
* @return [String] returns rect(top,right,bottom,left) in pixel unit
*/
bobj.getRect = function(top, right, bottom, left) {
return "rect(" + top + "px, "+ right + "px," + bottom + "px," + left + "px)";
}
bobj.getBodyScrollDimension = function() {
var w = 0;
var h = 0;
var bodyTags = document.getElementsByTagName("Body");
if(bodyTags && bodyTags[0]) {
w = bodyTags[0].scrollWidth;
h = bodyTags[0].scrollHeight;
}
return {w : w, h : h};
}
/**
* Disables tabbing on element specified
* @param layer, The layer that will be modified
* @param dis [boolean], true would disable tabbing on element
*/
bobj.disableTabbingKey = function(layer, dis) {
if(layer) {
//Setting tabIndex value to (-1) would prevent tabbing to the DOM layer
layer.tabIndex = dis ? -1 : 0;
}
}
bobj.getStringWidth = function(string, fontFamily, fontSize) {
if(document.body) {
var span = document.createElement('span');
span.appendChild(document.createTextNode(string));
span.style.position = 'absolute';
span.style.visibility = 'hidden';
if(fontFamily)
span.style.fontFamily = fontFamily;
if(fontSize)
span.style.fontSize = fontSize;
document.body.appendChild(span);
var width = span.offsetWidth;
document.body.removeChild(span);
return width;
}
return 0;
}
bobj.deleteWidget = function(widget) {
if(widget && widget.widx) {
if(widget.layer) {
//Helps GC reclaim memory. Essential to IE memory leak
widget.layer.click = null;
widget.layer.onmouseup = null;
widget.layer.onmousedown = null;
widget.layer.onmouseover = null;
widget.layer.onmousemove = null;
widget.layer.onmouseout = null;
widget.layer.onchange = null;
widget.layer.onfocus = null;
widget.layer.onkeydown = null;
widget.layer.onkeyup = null;
widget.layer.onkeypress = null;
var parent = widget.layer.parentNode;
if(parent) {
parent.removeChild(widget.layer); //removing child from parent
}
delete widget.layer;
}
delete widget.css;
delete _widgets[widget.widx]; // cleans DHTML_Lib collection of widgets
_widgets[widget.widx] = null; /* for debugging purpose only */
delete widget;
}
};
bobj.cloneArray = function(array) {
return array.slice();
};
/**
* returns a function that would execute obj.func with obj as the context
* Similar to MochiKit.Base.bind, but this is a lot faster
*/
bobj.bindFunctionToObject = function(func, obj) {
return function () {
return func.apply(obj, arguments);
};
};
/**
* Object.superClass will be populated with all functions defined in superClass
*/
bobj.extendClass = function(object, ObjectClassDefinition, superClass) {
MochiKit.Base.update(object, ObjectClassDefinition);
object.superClass = {};
for ( var funcName in superClass) {
object.superClass[funcName] = bobj.bindFunctionToObject(superClass[funcName], object);;
}
};
bobj.displayElementWithAnimation = function (element) {
if(element != null) {
MochiKit.DOM.setOpacity(element, 0); //to reserve the element's space
MochiKit.Style.setDisplayForElement("block", element);
new MochiKit.Visual.appear(element, {duration: 0.5});
}
};
/**
* Returns dimension of element when it is invisible.DOM.offsetHeight should be used when
* element is visible to avoid execution cost of this method
*/
bobj.getHiddenElementDimensions = function (element) {
var size = { w : 0, h : 0};
if(element) {
var body = document.body;
var clonedNode = element.cloneNode(true); //clone and append the node to body as
var nodeStyle = clonedNode.style;
nodeStyle.display = "";
nodeStyle.visibility = "hidden";
nodeStyle.width = "";
nodeStyle.height = "";
nodeStyle.position = "absolute";
nodeStyle.left = "-1000px";
nodeStyle.top = "-1000px";
body.appendChild(clonedNode);
size = { w : clonedNode.offsetWidth, h : clonedNode.offsetHeight};
body.removeChild(clonedNode);
}
return size;
}
/**
* Checks for PDF reader that has the ability to process JavaScript.
* Currently, it checks for Adobe Acrobat Reader version >= 7 on IE and Version >= 8 on other browsers.
*/
bobj.hasPDFReaderWithJSFunctionality = function() {
if (navigator.plugins) {
var plugins = navigator.plugins;
for (var i=0, len=plugins.length; i < len; i++) {
if (plugins[i].description.indexOf('Adobe PDF Plug-In') != -1) {
return true;
}
}
}
try {
var pdfReader = new ActiveXObject('AcroPDF.PDF.1');
if (pdfReader) {
return true;
}
} catch (e) {}
return false;
};

View File

@@ -0,0 +1,536 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
if (typeof(bobj) == 'undefined') {
bobj = {};
}
if (typeof(bobj.crv) == 'undefined') {
bobj.crv = {};
// Constants used in the viewer
bobj.crv.ActxPrintControl_CLSID = 'B7DA1CA9-1EF8-4831-868A-A767093EA685';
bobj.crv.ActxPrintControl_Version = '13,0,30,3805';
// Configuration for ALL viewers in a page
// TODO The dhtmllib doesn't currently suport widgets from different locales
// on the same page. We will need that support for the viewer.
bobj.crv.config = {
isDebug : false,
scriptUri: null, // The uri for the viewer script dir (that holds crv.js)
skin: "skin_standard",
needFallback: true,
lang: "en",
useCompressedScripts: true,
useAsync : true,
indicatorOnly: false,
resources : {
'HTMLPromptingSDK' : {isLoaded: false, path : '../../promptengine-compressed.js'},
'ParameterControllerAndDeps' : {isLoaded: false, path: '../../parameterUIController-compressed.js'}
},
logging: { enabled: false, id: 0}
};
bobj.crv.logger = {
info: function(){ /* Do Nothing */}
};
// Udate configuration with properties from crv_config, if it exists
if (typeof(crv_config) == 'object') {
for (var i in crv_config) {
bobj.crv.config[i] = crv_config[i];
}
}
// If the uri for the bobj.crv script dir wasn't set, try to figure it out
if (!bobj.crv.config.scriptUri) {
var scripts = document.getElementsByTagName("script");
var reCrvJs = /(.*)crv\.js$/i;
for(var i = 0; i < scripts.length; i++) {
var src = scripts[i].getAttribute("src");
if(!src) { continue; }
var matches = src.match(reCrvJs);
if(matches && matches.length) {
bobj.crv.config.scriptUri = matches[1];
break;
}
}
if (!bobj.crv.config.scriptUri ) {
bobj.crv.config.scriptUri = '';
if (bobj.crv.config.isDebug) {
throw "bobj.crv.config.scriptUri is undefined";
}
}
}
/**
* Parse a URI into its constitutents as defined in RFC2396
*
* @param uri [String] Uri to parse
*
* @return Returns object has string values for the uri's components
*/
bobj.parseUri = function(uri) {
var regExp = "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$";
var result = uri.match(new RegExp(regExp));
return {
scheme : result[2],
authority : result[4],
path : result[5],
query : result[7],
fragment : result[9]
};
};
bobj.crvUri = function(uri) {
return bobj.crv.config.scriptUri + uri;
};
/**
* A helper method for evaluating whether parent window is JSUnit test runner
*/
bobj.isParentWindowTestRunner = function() {
try {
var tempTop = top || window;
while(tempTop.top && tempTop.top != tempTop) {
tempTop = tempTop.top;
}
return tempTop.jsUnitTestSuite !== undefined;
}
catch(err){}
return false;
};
bobj.skinUri = function(uri) {
return bobj.crvUri("../dhtmllib/images/") + bobj.crv.config.skin + "/" + uri;
};
/**
* Create a widget using json
* eg.
* createWidget({
* cons: bobj.crv.myWidget,
* args: {foo: 'bar'},
* children: [ {cons: ...}, ...]
* });
*
* @param json [Object] Object representing the widget
* @return Returns the widget or null if creation failed
*/
bobj.crv.createWidget = function(json) {
if (!bobj.isObject(json)){
return null;
}
var constructor = json.cons;
if (bobj.isString(constructor)) {
try {
constructor = eval(constructor);
}
catch (err) {
if (bobj.crv.config.isDebug) {
throw "bobj.crv.createWidget: invalid constructor";
}
}
}
if (!bobj.isFunction(constructor)) {
if (bobj.crv.config.isDebug) {
throw "bobj.crv.createWidget: invalid constructor";
}
return null;
}
var widget = constructor(json.args);
if (bobj.isArray(json.children)) {
if (widget.delayedBatchAdd) {
widget.delayedBatchAdd(json.children);
}
else if (widget.addChild){
for (var i = 0, len = json.children.length; i < len; ++i) {
var child = bobj.crv.createWidget(json.children[i]);
widget.addChild(child);
}
}
}
return widget;
};
/**
* Create a widget using bobj.crv.createWidget and write it to the document.
* If optional element is given, the innerHTML is written instead and scripts
* are executed.
*
* @param json [Object] Object representing the widget
* @return Returns the widget or null if creation failed
*/
bobj.crv.writeWidget = function(json, element) {
var widget = bobj.crv.createWidget(json);
if (widget) {
if(element){
var html = widget.getHTML();
var ext = bobj.html.extractHtml(html);
var links = ext.links;
element.innerHTML = html;
for(var iLinks = 0, linksLen = links.length; iLinks < linksLen; ++iLinks){
bobj.includeLink(links[iLinks]);
}
var scripts = ext.scripts;
for (var iScripts = 0, scriptsLen = scripts.length; iScripts < scriptsLen; ++iScripts) {
var script = scripts[iScripts];
if (!script) {continue;}
if (script.text) {
try {
bobj.evalInWindow(script.text);
}
catch(err) {}
}
}
var styleText = "";
for (var i = 0, len = ext.styles.length; i < len ; i++) {
styleText += ext.styles[i].text + '\n';
}
if(styleText.length > 0) {
bobj.addStyleSheet(styleText);
}
}
else {
widget.write();
}
}
return widget;
};
/**
* Initialize a widget.
*
* @param widx [Int] Widget index
* @param initElt [DOM Node, opt] The element that called the init event
*/
bobj.crv._initWidget = function(widx, initElt) {
try {
var widget = _widgets[widx];
widget.init();
if (initElt) {
MochiKit.DOM.removeElement(initElt);
}
}
catch (err) {
if (bobj.crv.config.isDebug) {
var msg = "bobj.crv._initWidget: Couldn't initialize widget: ";
msg += 'widx=' + widx;
msg += ', type=';
if (!_widgets[widx]) {
msg += 'null';
}
else if (bobj.isString(_widgets[widx].widgetType)) {
msg += _widgets[widx].widgetType;
}
else
{
msg += 'unknown';
}
msg += ' because: ' + err;
throw msg;
}
}
};
/**
* Creates an hidden image tag that initializes a widget using its onload
* event. The tag should be appended to the html of the widget.
*
* Note: doesn't work in Opera 9, but we don't support that yet
*
* TODO nested widgets fail in Firefox because parent's init method has to
* be called after child's init method and the timing of the img onload
* events looks to be unpredictable. onerror might be more predictable if
* no src is specified... is it supported in Safari?
*
* @param widx [Int] Widget index
*
* @return Returns html that initializes the widget with index == widx
bobj.crv.getInitHTML = function(widx) {
return bobj.html.IMG({
style: {display:'none'},
//onload: 'bobj.crv._initWidget(' + widx + ', this);',
onload: "alert('loading " + widx + "')",
src: bobj.crvUri("../dhtmllib/images/transp.gif")
});
}*/
/**
* Returns HTML that auto-intializes a widget.
*/
bobj.crv.getInitHTML = function(widx) {
var scriptId = 'bobj_crv_getInitHTML_' + widx;
return '<script id="' + scriptId + '" language="javascript">' +
'bobj.crv._initWidget(' + widx + ',"' + scriptId + '");' +
'</script>';
};
bobj.crv._preloadProcessingIndicatorImages = function() {
var relativeImgPath = bobj.crvUri("../dhtmllib/images/" + bobj.crv.config.skin + "/");
var images = [];
var imgNames = [
"wait01.gif",
"dialogtitle.gif",
"dialogelements.gif",
"../transp.gif"];
for(var i = 0, len = imgNames.length; i < len; i++){
images[i] = new Image();
images[i].src = relativeImgPath + imgNames[i];
}
};
bobj.crv._loadJavaScript = function(scriptFile) {
if (scriptFile) {
document.write('<script language="javascript" src="'
+ bobj.crvUri(scriptFile)
+'"></script>');
}
};
/**
* Include the viewer's scripts in the document.
*/
bobj.crv._includeAll = function() {
bobj.crv._includeLocaleStrings();
if (bobj.crv.config.useCompressedScripts) {
if (bobj.crv.config.indicatorOnly) {
bobj.crv._loadJavaScript('../../processindicator.js');
}
else {
bobj.crv._loadJavaScript('../../allInOne.js');
if(!bobj.crv.config.useAsync) {
for(var name in bobj.crv.config.resources) {
var resource = bobj.crv.config.resources[name];
resource.isLoaded = true;
bobj.crv._loadJavaScript(resource.path);
}
}
if (bobj.crv.config.logging.enabled) {
bobj.crv._loadJavaScript('../log4javascript/log4javascript.js');
}
}
return;
}
else {
// list of script uris relative to crv.js
var scripts = [];
if (bobj.crv.config.indicatorOnly) {
scripts = [
'../MochiKit/Base.js',
'../dhtmllib/dom.js',
'initDhtmlLib.js',
'../dhtmllib/dialog.js',
'../dhtmllib/waitdialog.js',
'common.js',
'Dialogs.js'
];
}
else {
scripts = [
'../MochiKit/Base.js',
'../MochiKit/Async.js',
'../MochiKit/DOM.js',
'../MochiKit/Style.js',
'../MochiKit/Signal.js',
'../MochiKit/New.js',
'../MochiKit/Color.js',
'../MochiKit/Iter.js',
'../MochiKit/Visual.js',
'../log4javascript/log4javascript_uncompressed.js',
'../external/date.js',
'../dhtmllib/dom.js',
'initDhtmlLib.js',
'../dhtmllib/palette.js',
'../dhtmllib/menu.js',
'../dhtmllib/psheet.js',
'../dhtmllib/treeview.js',
'../dhtmllib/dialog.js',
'../dhtmllib/waitdialog.js',
'../../prompting/js/promptengine_prompts2.js',
'../../prompting/js/promptengine_calendar2.js',
'../swfobject/swfobject.js',
'common.js',
'encoding.js',
'html.js',
'ImageSprites.js',
'Toolbar.js',
'Statusbar.js',
'PanelNavigator.js',
'PanelNavigatorItem.js',
'PanelHeader.js',
'LeftPanel.js',
'GroupTreeNode.js',
'GroupTree.js',
'GroupTreeListener.js',
'ToolPanel.js',
'ReportPage.js',
'ReportView.js',
'ButtonList.js',
'ReportAlbum.js',
'Separator.js',
'Viewer.js',
'ViewerListener.js',
'StateManager.js',
'IOAdapters.js',
'ArgumentNormalizer.js',
'event.js',
'PromptPage.js',
'Dialogs.js',
'StackedTab.js',
'StackedPanel.js',
'Parameter.js',
'ParameterController.js',
'Colors.js',
'TextField.js',
'TextCombo.js',
'RangeField.js',
'ParameterValueRow.js',
'ParameterInfoRow.js',
'OptionalParameterValueRow.js',
'ParameterUI.js',
'OptionalParameterUI.js',
'ParameterDialog.js',
'ParameterPanelToolbar.js',
'ParameterPanel.js',
'bobjcallback.js',
'Calendar.js',
'WarningPopup.js',
'../FlexParameterBridge.js',
'ViewerFlexParameterAdapter.js',
'SignalDisposer.js'
];
}
if(bobj.isParentWindowTestRunner()) {
scripts.push('../jsunit/tests/crViewerTestSuite.js');
}
for (var i = 0, len = scripts.length; i < len; i++) {
document.write('<script language="javascript" src="'
+ bobj.crvUri(scripts[i])
+'"></script>');
}
for(var i in bobj.crv.config.resources){
//all Resources are automatically loaded at initialization when useCompressedScripts is false (in debug mode)
bobj.crv.config.resources[i].isLoaded = true;
}
}
};
bobj.crv.getLangCode = function () {
var splitChar = '_'; // default to java's locale split character
if (bobj.crv.config.lang.indexOf ('-') > 0) {
splitChar = '-'; // must be .Net's locale split
}
var lang = bobj.crv.config.lang.split(splitChar);
// TODO (Julian): Java server side now handles the chinese variants due to language pack fix
// We'll do the same for WebForm and then the following code can be removed.
// For Chinese locales "zh" we only support "TW" & "CN"
// zh_HK / zh_MO / zh_MY, are all mapped to zh_TW, everything else is zh_CN
if(lang[0].toLowerCase() == "zh") {
if(lang.length > 1 ) {
var region = lang[1].toUpperCase();
if(region == "TW" || region == "HK" || region == "MO" || region == "MY") {
lang[1] = "TW";
} else {
lang[1] = "CN";
}
} else {
lang[1] = "CN";
}
}
// .NET webform viewers don't support variants from server side - until we fix this chop-off variant code for all other than "zh"
if (lang.length > 1 && (!bobj.crv.config.needFallback || lang[0].toLowerCase() == "zh")) {
lang = lang[0] + "_" + lang[1];
}
else {
lang = lang[0];
}
return lang;
};
bobj.crv._includeLocaleStrings = function() {
var lang = bobj.crv.getLangCode ();
if (bobj.crv.config.needFallback) {
bobj.crv._loadJavaScript('../../allStrings_en.js');
if (lang == 'en') return; // DO NOT load 'en' strings below again!
}
bobj.crv._loadJavaScript('../../allStrings_' + lang + '.js');
};
if (typeof MochiKit == 'undefined') {
MochiKit = {};
}
if (typeof MochiKit.__export__ == 'undefined') {
MochiKit.__export__ = false; // don't export symbols into the global namespace
}
if (!bobj.crv.config.useAsync) bobj.crv._preloadProcessingIndicatorImages();
bobj.crv._includeAll();
bobj.crv.initLog = function(logLevel, handlerUri) {
bobj.crv.logger = log4javascript.getLogger();
log4javascript.setEnabled(bobj.crv.config.logging.enabled);
if (bobj.crv.config.logging.enabled) {
bobj.crv.logger.setLevel(logLevel);
var uri = handlerUri + '?ServletTask=Log';
var ajaxAppender = new log4javascript.AjaxAppender(uri);
bobj.crv.logger.addAppender(ajaxAppender);
var oldLogFunc = bobj.crv.logger.log;
bobj.crv.logger.log = function(level, message, exception) {
oldLogFunc(level, bobj.crv.config.logging.id + ' ' + message, exception);
};
bobj.crv.logger.info('Logging Initialized');
}
};
bobj.crv.invokeActionAdapter = function (args) {
var n = "invokeAction";
var f = window[n];
if (!f && window.parent){
f = window.parent[n];
}
if (f){
f(args.url, args.actionId, args.objectId, args.containerId, args.actionType, null);
}
};
}
if(typeof(Sys)!=='undefined' && typeof(Sys.Application)!== 'undefined' && typeof(Sys.Application.notifyScriptLoaded)!== 'undefined') {
Sys.Application.notifyScriptLoaded();
}

View File

@@ -0,0 +1,6 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
if (typeof(bobj.dom) == 'undefined') {
bobj.dom = {};
}

View File

@@ -0,0 +1,72 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
if (typeof bobj == 'undefined') {
bobj = {};
}
bobj.encodeUTF8 = function(string) {
var arr = [];
var strLen = string.length;
for(var i = 0; i < strLen; i++) {
var c = string.charCodeAt(i);
if(c < 0x80) {
arr.push(c);
}
else if(c < 0x0800) {
arr.push((c >> 6) | 0xc0);
arr.push(c & 0x3f | 0x80);
}
else if(c < 0xd800 || c >= 0xe000) {
arr.push((c >> 12) | 0xe0);
arr.push((c >> 6) & 0x3f | 0x80);
arr.push(c & 0x3f | 0x80);
}
else if(c < 0xdc00) {
var c2 = string.charCodeAt(i + 1);
if(isNaN(c2) || c2 < 0xdc00 || c2 >= 0xe000) {
arr.push(0xef, 0xbf, 0xbd);
continue;
}
i++;
val = ((c & 0x3ff) << 10) | (c2 & 0x3ff);
val += 0x10000;
arr.push((val >> 18) | 0xf0);
arr.push((val >> 12) & 0x3f | 0x80);
arr.push((val >> 6) & 0x3f | 0x80);
arr.push(val & 0x3f | 0x80);
}
else {
arr.push(0xef, 0xbf, 0xbd);
}
}
return arr;
};
bobj.encodeBASE64 = function(byteArray) {
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var arr = [];
var c1, c2, c3, e1, e2, e3, e4;
var i = 0, arrLen = byteArray.length;
while(i < arrLen) {
c1 = byteArray[i++];
c2 = byteArray[i++];
c3 = byteArray[i++];
e1 = c1 >> 2;
e2 = ((c1 & 3) << 4) | (c2 >> 4);
e3 = ((c2 & 15) << 2) | (c3 >> 6);
e4 = c3 & 63;
if (isNaN(c2)) {
e3 = e4 = 64;
} else if(isNaN(c3)) {
e4 = 64;
}
arr.push(keyStr.charAt(e1));
arr.push(keyStr.charAt(e2));
arr.push(keyStr.charAt(e3));
arr.push(keyStr.charAt(e4));
}
return arr.join('');
};

View File

@@ -0,0 +1,136 @@
/**
* Publish/Subscribe event system for anonymous message passing
*
*/
if (typeof bobj == 'undefined') {
bobj = {};
}
if (typeof bobj.event == 'undefined') {
bobj.event = {};
bobj.event._topicSubscriptions = {};
bobj.event._globalSubscriptions = [];
}
/**
* Publish an event for subscribers to receive
*
* @param topic [String] The event topic
* @param arguments Unnamed args will be passed to subscribers
*/
bobj.event.publish = function(topic) {
var args = bobj.slice(arguments, 1);
var topicSubs = bobj.event._topicSubscriptions[topic];
if (topicSubs) {
for (var i = 0; i < topicSubs.length; ++i) {
topicSubs[i]._notify.apply(null, args);
}
}
var globalSubs = bobj.event._globalSubscriptions;
for (var j = 0; j < globalSubs.length; ++j) {
globalSubs[j]._notify.apply(null, args);
}
};
/**
* Subscribe to a topic
*
* @param topic [String] The event topic
* @param callback [Function] Function to be call with topic's arguments
* @param target [Object] Object to notify (requires methName)
* @param methName [String] Name of method to call when target is notified
*
* Arguments may be passed in any of the following combinations:
* (topic, target, methName)
* (topic, callback)
* (target, methName)
* (callback)
*
* When a topic is not specified, the subscriber receives all topics
*
* @return Subscription object that can be used to unsubscribe
*/
bobj.event.subscribe = function() {
var nmlr = bobj.event.subscribe._normalizer;
if (!nmlr) {
nmlr = bobj.event.subscribe._normalizer = new bobj.ArgumentNormalizer();
// If 3 args: (topic, target, methName)
nmlr.addRule('topic', 'target', 'methName');
// If 2 args and first is a string: (topic, callback)
nmlr.addRule([bobj.isString, 'topic'], 'callback');
// If 2 args: (target, methName)
nmlr.addRule('target', 'methName');
// If 1 arg: (callback)
nmlr.addRule('callback');
}
return bobj.event.kwSubscribe(nmlr.normalizeArray(arguments));
};
/**
* Subscribe to a topic using keyword arguments
*
* @param kwArgs.topic [String] The event topic
* @param kwArgs.callback [Function] Function to be call with topic's arguments
* @param kwArgs.target [Object] Object to notify (requires methName)
* @param kwArgs.methName [String] Name of method to call when target is notified
*
* @see bobj.event.subscribe
*
* @return Subscription object that can be used to unsubscribe
*/
bobj.event.kwSubscribe = function(kwArgs) {
var bind = MochiKit.Base.bind;
var subscription = {};
if (kwArgs.callback) {
subscription._notify = kwArgs.callback;
}
else {
subscription._notify = bind(kwArgs.target[kwArgs.methName], kwArgs.target);
}
if (kwArgs.topic) {
subscription.topic = kwArgs.topic;
var subs = bobj.event._topicSubscriptions;
if (!subs[kwArgs.topic]) {
subs[kwArgs.topic] = [];
}
subs[kwArgs.topic].push(subscription);
}
else {
bobj.event._globalSubscriptions.push(subscription);
}
return subscription;
};
/**
* Unsubscribe from a topic
*
* @param subscription [Subscription] The object returned by subscribe
*/
bobj.event.unsubscribe = function(subscription) {
var subsList = bobj.event._globalSubscriptions;
if (subscription.topic) {
subsList = bobj.event._topicSubscriptions[subscription.topic];
}
if (subsList) {
var idx = MochiKit.Base.findIdentical(subsList, subscription);
if (idx != -1) {
subsList.splice(idx, 1); // remove the subscription
delete subscription._notify; // prevent leaks
}
}
};

View File

@@ -0,0 +1,219 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
if (typeof(bobj.html) == 'undefined') {
bobj.html = {};
}
bobj.html.openTag = function(tag, atts) {
var html = '<' + tag;
for (var i in atts) {
html += ' ' + i + '="';
var value = atts[i];
if (bobj.isArray(value)) {
value = value.join(' ');
}
else if (bobj.isObject(value)) {
// create a string of the form "foo:bar;baz:garply"
var stringValue = ""
for (var k in value) {
stringValue += k + ':' + value[k] + ';';
}
value = stringValue;
}
html += value + '"';
}
return html + '>'
};
bobj.html.closeTag = function(tag) {
return '</' + tag + '>';
};
bobj.html.createHtml = function(tag, atts, innerHtml /*, innerHtml...*/) {
var html = bobj.html.openTag(tag, atts);
for (var i = 2; i < arguments.length; ++i) {
html += arguments[i];
}
html += bobj.html.closeTag(tag);
return html;
};
bobj.html.TABLE = MochiKit.Base.partial(bobj.html.createHtml, 'table');
bobj.html.UL = MochiKit.Base.partial(bobj.html.createHtml, "ul");
bobj.html.OL = MochiKit.Base.partial(bobj.html.createHtml, "ol");
bobj.html.LI = MochiKit.Base.partial(bobj.html.createHtml, "li");
bobj.html.TD = MochiKit.Base.partial(bobj.html.createHtml, "td");
bobj.html.TR = MochiKit.Base.partial(bobj.html.createHtml, "tr");
bobj.html.TBODY = MochiKit.Base.partial(bobj.html.createHtml, "tbody");
bobj.html.THEAD = MochiKit.Base.partial(bobj.html.createHtml, "thead");
bobj.html.TFOOT = MochiKit.Base.partial(bobj.html.createHtml, "tfoot");
bobj.html.TABLE = MochiKit.Base.partial(bobj.html.createHtml, "table");
bobj.html.TH = MochiKit.Base.partial(bobj.html.createHtml, "th");
bobj.html.INPUT = MochiKit.Base.partial(bobj.html.createHtml, "input");
bobj.html.SPAN = MochiKit.Base.partial(bobj.html.createHtml, "span");
bobj.html.A = MochiKit.Base.partial(bobj.html.createHtml, "a");
bobj.html.DIV = MochiKit.Base.partial(bobj.html.createHtml, "div");
bobj.html.IMG = MochiKit.Base.partial(bobj.html.createHtml, "img");
bobj.html.BUTTON = MochiKit.Base.partial(bobj.html.createHtml, "button");
bobj.html.TT = MochiKit.Base.partial(bobj.html.createHtml, "tt");
bobj.html.PRE = MochiKit.Base.partial(bobj.html.createHtml, "pre");
bobj.html.H1 = MochiKit.Base.partial(bobj.html.createHtml, "h1");
bobj.html.H2 = MochiKit.Base.partial(bobj.html.createHtml, "h2");
bobj.html.H3 = MochiKit.Base.partial(bobj.html.createHtml, "h3");
bobj.html.BR = MochiKit.Base.partial(bobj.html.createHtml, "br");
bobj.html.HR = MochiKit.Base.partial(bobj.html.createHtml, "hr");
bobj.html.LABEL = MochiKit.Base.partial(bobj.html.createHtml, "label");
bobj.html.TEXTAREA = MochiKit.Base.partial(bobj.html.createHtml, "textarea");
bobj.html.FORM = MochiKit.Base.partial(bobj.html.createHtml, "form");
bobj.html.P = MochiKit.Base.partial(bobj.html.createHtml, "p");
bobj.html.SELECT = MochiKit.Base.partial(bobj.html.createHtml, "select");
bobj.html.OPTION = MochiKit.Base.partial(bobj.html.createHtml, "option");
bobj.html.OPTGROUP = MochiKit.Base.partial(bobj.html.createHtml, "optgroup");
bobj.html.LEGEND = MochiKit.Base.partial(bobj.html.createHtml, "legend");
bobj.html.FIELDSET = MochiKit.Base.partial(bobj.html.createHtml, "fieldset");
bobj.html.STRONG = MochiKit.Base.partial(bobj.html.createHtml, "strong");
bobj.html.CANVAS = MochiKit.Base.partial(bobj.html.createHtml, "canvas");
bobj.html.IFRAME = MochiKit.Base.partial(bobj.html.createHtml, "iframe");
bobj.html.SCRIPT = MochiKit.Base.partial(bobj.html.createHtml, "script");
/**
* Extract scripts from an html fragment.
*
* @param html [String] html fragment
*
* @return [Object] Returns an object with a list of scripts and html without
* scripts
* i.e. {scripts: [{src:[String], text:[String]},...], html:[String]}
*/
bobj.html.extractScripts = function(html) {
// Match script tags with or without closing tags
// 1 - Attributes of tag that doesn't have closing tag (e.g. <script/>)
// 2 - Attributes of tag that has closing tag
// 3 - Script text
// 1 2 3
var regexpScript = /(?:<script([^>]*)\/>|<script([^>]*)>([\s\S]*?)<\/script>)/i;
// Match src attributes
// 1 - URI
// 1
var regexpSrc = /src=\"([^\"]*)\"/i;
var scripts = [];
var match = null;
while(match = regexpScript.exec(html)) {
var script = {src: null, text: null};
var attributes = match[1] || match[2];
if (attributes = regexpSrc.exec(attributes)) {
script.src = attributes[1];
}
if (match[3]) {
script.text = match[3];
}
scripts.push(script);
html = bobj.extractRange(html, match.index, match.index + match[0].length);
}
return {scripts: scripts, html: html};
}
/**
* Extract scripts and css links from a html fragment.
*
* @param html [String] html fragment
*
* @return [Object] Returns an object with a list of scripts, css links and html
* i.e. {scripts: [{src:[String], text:[String]},...], html:[String], links: [String,...]}
*/
bobj.html.extractHtml = function(html) {
var extScripts = bobj.html.extractScripts(html);
var extLinks = bobj.html.extractLinks(extScripts.html);
var extStyles = bobj.html.extractStyles(extLinks.html);
return {scripts: extScripts.scripts, html : extStyles.html, links : extLinks.links, styles: extStyles.styles};
}
/**
* Extract css links from a html fragment.
*
* @param html [String] html fragment
*
* @return [Object] Returns an object with a list of links and html without
* links
* i.e. {links: [String,...], html:[String]}
*/
bobj.html.extractLinks = function(html) {
var regexpLink = /<link([^>]*)>/i;
var regexpHref = /href=\"([^\"]*)\"/i;
var links = [];
var match = null;
while(match = regexpLink.exec(html)) {
// match = "<link href='' \>
var href = regexpHref.exec(match);
if(href && href.length > 0) {
links.push(href[1]);
}
html = bobj.extractRange(html, match.index, match.index + match[0].length);
}
return {links: links, html: html};
}
/**
* Extract <style> tags from an html fragment.
* Note - links to external style sheets are not currently extracted
*
* @param html [String] html fragment
*
* @return [Object] Returns an object with a list of styles and html without
* styles
* i.e. {styles: [{text:[String], type:[String], media:[String]},...], html:[String]}
*/
bobj.html.extractStyles = function(html) {
// Match style tags
// 1 - Attributes
// 2 - CSS text
// 1 2
var regexpStyle = /<style([^>]*)>([\s\S]*?)<\/style>/i;
var regexpType = /type=\"([^\"]*)\"/i;
var regexpMedia = /media=\"([^\"]*)\"/i;
var styles = [];
var match = null;
while(match = regexpStyle.exec(html)) {
var style = {media: null, type: null, text: match[2]};
var matchType = regexpType.exec(match[1]);
if (matchType) {
style.type = matchType[1];
}
var matchMedia = regexpMedia.exec(match[1]);
if (matchMedia) {
style.media = matchMedia[1];
}
styles.push(style);
html = bobj.extractRange(html, match.index, match.index + match[0].length);
}
return {styles: styles, html: html};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 B

View File

@@ -0,0 +1,579 @@
/* Copyright (c) Business Objects 2006. All rights reserved. */
.stackedPanel
{
overflow-y: auto;
overflow-x: hidden;
position: relative;
background-color: #F5F7F9;
}
.parameterPanelToolbar
{
margin: 0px;
overflow: hidden;
}
.toolPanel
{
position:relative; /* Needed for Webform design time */
background-color: #F5F7F9;
border-right: 1px solid #96a8c3;
border-bottom: 1px solid #96a8c3;
}
.toolPanel.leftBorder
{
border-left: 1px solid #96a8c3;
}
.leftPanel
{
position : absolute;
top: 0px;
left: 0px;
}
.panelHeader
{
border-top: 1px solid #96a8c3;
border-right: 1px solid #96a8c3;
background:transparent url('allInOneBG.gif') repeat-x 0px -126px; /* panelHeaderBG.gif */
position : absolute;
z-index: 1;
overflow: hidden;
}
.panelHeaderTitle
{
position : absolute;
bottom : 3px;
left : 10px;
font-family : "Tahoma";
font-weight: bold;
font-size : 8.5pt;
white-space: nowrap;
color :#FFFFFF;
overflow : hidden;
}
.panelHeaderCloseButton
{
padding : 1px;
}
.panelHeaderCloseButtonHighlighted
{
border : 1px solid #F5F7F9;
}
.panelHeaderButtonCtn
{
position : absolute;
right: 4px;
bottom: 1px;
}
.panelNavigatorInnerBorder
{
border: 1px solid #f3f6f8;
}
.panelNavigator
{
position : absolute;
background-color : #e5eaf1;
z-index: 5;
border: 1px solid #96a8c3;
}
.panelNavigatorItemImage
{
width : 22px;
height : 22px;
position : absolute;
top : 6px;
left: 6px;
}
.panelNavigatorItem
{
position:absolute;
width: 35px;
left : 0px;
top : 0px; /* Will be set by PanelNavigatorItem constructor */
height : 35px;
cursor : pointer;
}
.panelNavigatorItem.selected
{
background:transparent url('allInOneBG.gif') repeat-x 0px -181px; /* panelNavigatorItemSelectedBG.gif */
}
.panelNavigatorItem.highlighted
{
background:transparent url('allInOneBG.gif') repeat-x 0px -146px; /* panelNavigatorItemHL.gif */
}
.panelNavigatorItem.selected.highlighted
{
background:transparent url('allInOneBG.gif') repeat-x 0px -146px; /* panelNavigatorItemHL.gif */
}
.parameterInfoRow
{
color : #006699;
padding : 1px 2px;
margin: 2px 10px;
font-style: italic;
font-family : "arial" , "sans-serif";
font-size : 12px;
display: none;
white-space: nowrap;
text-decoration: underline;
cursor: pointer;
}
.paramPanelOverLay
{
width: 100%;
height: 100%;
background-color: black;
position: absolute;
top: 0px;
left: 0px;
z-index: 5;
filter: alpha(opacity=15); /* IE */
opacity: 0.15; /* Safari and Mozilla */
}
.stackedTab
{
overflow: hidden;
margin: 5px 2px;
background-color: #f7f7f7;
border-collapse: collapse;
border: 1px solid #94aac5;
}
.stackedTabTitle
{
height: 20px;
}
.stackedTabTitleDirty
{
background-color: #D5ECFF;
height: 20px;
}
.stackedTabContentCtn
{
float: left;
}
.arrow_button_default
{
}
.arrow_button_depressed
{
background-image: url('arrow_button_depressed.gif');
background-repeat: no-repeat;
}
.arrow_button_hover
{
background-image: url('arrow_button_hover.gif');
background-repeat: no-repeat;
}
.stackedTabLabelHover
{
background-color: #8E8EAD;
}
.stackedTabText
{
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
cursor: default;
color: black;
font-size: 8pt;
font-family: tahoma;
position: relative;
margin-left: 5px;
top: 1px;
width: 100%;
}
.stackedTabIconCtn
{
position: absolute;
top: 1px;
height: 100%;
width: 20px;
z-index: 5;
}
.clearValueBtnCtn
{
position : absolute;
right : 1px;
top : 1px;
}
.advButtonContainer {
height: 16px;
position:absolute;
right:0px;
top : 0px;
}
.WarningPopup
{
position : absolute;
border: 1px solid black;
width :300px;
font-family : "arial" , "sans-serif";
font-size : 12px;
background-color : #ffffcc;
display : none;
z-index: 20;
}
.crvnoselect
{
-moz-user-select: none;
-khtml-user-select: none;
user-select: none;
}
.iactParamRow
{
position: relative;
height: 18px;
overflow: hidden;
white-space: nowrap;
margin: 2px 20px 2px 0px;
}
.iactParamRow.editable.hasError
{
border: 1px solid red;
}
.iactParamRow.editable
{
border: 1px solid #94aac5;
}
.iactParamRowIE
{
height: 20px;
}
.iactParamValue
{
padding-left:4px;
height: 18px;
overflow: hidden;
}
.iactParamValueAndButton
{
position: relative;
overflow: hidden;
height: 18px;
}
.iactTextField
{
background-color: #f7f7f7;
font-family: tahoma;
font-size: 8pt;
height: 15px;
border: none;
padding-left: 2px;
padding-right: 2px;
position : relative;
padding-top : 0px;
top : 2px;
}
.iactRangeFieldTable
{
height: 18px;
padding-left: 2px;
padding-right: 2px;
padding-top: 1px;
white-space:nowrap;
overflow:hidden;
border-collapse: collapse;
font-family: "arial" , "sans-serif";
font-size: 12px;
}
.iactTextComboTextField
{
margin-right: 15px;
}
.iactTextComboArrow
{
height: 16px;
overflow: hidden;
border-top: 1px solid #E1E1FC;
border-left: 1px solid #E1E1FC;
border-right: 1px solid #9191AC;
border-bottom: 1px solid #9191AC;
position: absolute;
top: 0px;
}
.iactValueIcon
{
height: 18px;
overflow: hidden;
}
.crvTooltip
{
position: absolute;
z-index: 5000;
padding: 2px 6px 2px 6px;
font-family: "arial" , "sans-serif";
font-size: 11px;
color: #000000;
background-color: #FFFFCC;
border: 1px solid #636384;
-moz-border-radius: 5px;
}
.infozone
{
background-color: white;
color: #808080;
font-family: "arial" , "sans-serif";
font-size: 11px;
border: 1px solid #808080;
padding: 4px;
}
.waitdialogzone
{
border-top: solid 1px #FFFFFF;
border-left: solid 1px #FFFFFF;
border-right: solid 1px #636384;
border-bottom: solid 1px #636384;
padding: 5px;
margin: 5px;
}
.dialogTitleLevel2
{
font-family : Tahoma, sans-serif;
font-size: 8.5pt;
font-weight: bold;
color : #4F5C72;
display:inline;
white-space:nowrap;
}
.dialogTitleLevel2Underline
{
border-bottom: 1px solid #4F5C72;
}
/*=========*/
/* Toolbar */
/*=========*/
.crtoolbar
{
background:transparent url('allInOneBG.gif') repeat-x 0px 0px; /* toolbar_background.gif */
}
img.toolbar_separator /* must be used on a IMG which is inside a DIV with 6px width */
{
background:transparent url('allInOneBG.gif') no-repeat 0px -28px; /* toolbar_separator_icon.gif */
width: 2px;
height: 26px;
position: relative;
left: 2px;
}
/*==========================================================*/
/* Toolbar button's default, depressed and hover behaviours */
/*==========================================================*/
.toolbar_button_default
{
}
.toolbar_button_depressed
{
background-image: url('toolbar_button_depressed.gif');
background-repeat: no-repeat;
}
.toolbar_button_hover
{
background-image: url('toolbar_button_hover.gif');
background-repeat: no-repeat;
}
/*==============================================================*/
/* Toolbar menu arrow's default, depressed and hover behaviours */
/*==============================================================*/
.toolbar_menuarrow_default
{
}
.toolbar_menuarrow_depressed
{
background-image: url('toolbar_menuarrow_depressed.gif');
background-repeat: no-repeat;
}
.toolbar_menuarrow_hover
{
background-image: url('toolbar_menuarrow_hover.gif');
background-repeat: no-repeat;
}
/*======================*/
/* Toolbar button group */
/*======================*/
.toolbar_buttongroup
{
background:transparent url('allInOneBG.gif') repeat-x 0px -54px; /* toolbar_buttongroup_background.gif */
}
img.toolbar_buttongroup_left
{
background:transparent url('allInOneBG.gif') no-repeat 0px -78px; /* toolbar_buttongroup_left.gif */
width: 2px;
height: 24px;
}
img.toolbar_buttongroup_right
{
background:transparent url('allInOneBG.gif') no-repeat 0px -102px; /* toolbar_buttongroup_right.gif */
width: 2px;
height: 24px;
}
/*===========*/
/* Statusbar */
/*===========*/
.statusbar_breadcrumb
{
width: 100%;
height: 14px;
overflow: hidden;
position: relative;
}
/*==============================================================*/
/* DesignTime CSS styles */
/*==============================================================*/
.designTimeToolbarButton
{
overflow: hidden;
float: left;
width: 21px;
height: 19px;
margin-top: 5px;
margin-left: 5px;
}
.designTimePanelNavigatorItem
{
width : 31px;
height : 33px;
cursor : pointer;
}
.designTimePanelNavigatorItem.selected
{
background:transparent url('allInOneBG.gif') repeat-x 0px -181px;
}
.designTimeToolbarItem
{
float: left;
}
.designTimeLeftPanel
{
height: 100%;
float : left;
vertical-align: top;
width: 100px;
}
.designTimePanelNavigator
{
vertical-align: top;
background-color : #e5eaf1;
border: 1px solid #94abc5;
float: left;
width : 33px;
height: 100%;
overflow:hidden;
}
.designTimeStatusBar
{
height: 15px;
overflow: hidden;
clear: both;
text-align: right;
white-space: nowrap;
padding: 3px 5px;
position: relative;
}
.designTimeToolPanel
{
height:100%;
position : relative;
overflow: hidden;
float : right;
border-top: 1px solid #94abc5;
border-right : 1px solid #94abc5;
border-bottom: 1px solid #94abc5;
background-color: #F5F7F9;
}
.designTimeReportAlbum
{
height: 100%;
float:right;
}
.clear
{
clear: both;
height: 1px;
overflow: hidden;
}
DIV.hideFrame
{
background-color: transparent;
}
DIV.hideFrame .hideableFrame
{
display: none;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 853 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

Some files were not shown because too many files have changed in this diff Show More