See:
http://www.nabble.com/Trinidad-1.2.1%3A-SelectOrderShuttle-leading-trailingDescShown-Fails-For-Me-tf4370052.html#a12480664
for bug:
http://issues.apache.org/jira/browse/TRINIDAD-678
-=> Gregg <=-
Steve wrote:
Hi
Gregg,
I'm using the release version 1.0.2 in which the leadingDescShown and
trailingDescShown attributes of selectOrderShuttle don't seem to be
working - the description boxes remain empty. Was this bug responsible
for this too?
Thanks,
Steve
Gregg Leichtman wrote:
Apparently two more private generated
_javascript_ functions
TrShuttleProxy._orderList and TrShuttleProxy._orderTopBottomList are
also affected by this bug in the selectOrderShuttle component. I have
also patched and successfully overridden these functions as follows
(all
fixes demarcated by // gsl fix; added comment to bug report:
https://issues.apache.org/jira/browse/TRINIDAD-723):
/*
* _orderList
*
* This function reorders the given list by shifting the selections
in
* the given direction. If no formName is supplied, the form is
found when
* this is called. The 'list' parameter should be the
* list name(i.e. "<shuttleName>:leading" or
"<shuttleName>:trailing")
*/
TrShuttleProxy._orderList = function(
down,
list,
formName
)
{
//get the formName if needed
if(formName == (void 0))
{
formName = TrShuttleProxy._findFormNameContaining(list);
}
//get the actual list
var colList = document.forms[formName].elements[list];
//get all the selected item indexes
var selItems = TrShuttleProxy._getSelectedIndexes(formName,
list);
//if no items are selected, return with alert.
if(selItems.length == 0)
{
if (_shuttle_no_items_selected.length > 0)
alert(_shuttle_no_items_selected);
return;
}
var descArray = TrShuttleProxy._getDescArray(list);
// Start with the last selected index and move up, working by
blocks
var processed = selItems.length - 1;
while (processed >= 0)
{
var lastInBlock = selItems[processed];
var firstInBlock = lastInBlock;
var tempIndex = processed;
// find the first index in that block
while ((tempIndex > 0) && ((selItems[tempIndex] -
selItems[tempIndex - 1]) == 1))
{
tempIndex--;
firstInBlock--;
}
if (down == 0)
{
// move this block up
// if we are at the top, do nothing
if(firstInBlock != 0)
{
//get the text and value of the one space above the block
var oText = colList.options[firstInBlock-1].text;
var oValue = colList.options[firstInBlock-1].value;
var oTitle = colList.options[firstInBlock-1].title; // gsl fix
if ( descArray != (void 0) )
var dValue = descArray[firstInBlock - 1];
//move the block up one at a time
for (var i = firstInBlock; i <= lastInBlock; i++)
{
colList.options[i-1].text = colList.options[i].text;
colList.options[i-1].value = colList.options[i].value;
colList.options[i-1].title = colList.options[i].title; // gsl fix
colList.options[i-1].selected = true;
if ( descArray != (void 0) )
descArray[i-1] = descArray[i];
}
//put the info of the slot above the selection below it
colList.options[lastInBlock].text = oText;
colList.options[lastInBlock].value = oValue;
colList.options[lastInBlock].title = oTitle; // gsl fix
colList.options[lastInBlock].selected = false;
if ( descArray != (void 0) )
descArray[lastInBlock] = dValue;
}
}
else
{
// move this block down
// if we are at the bottom, do nothing
if(lastInBlock != colList.length-2)
{
//get the text and value of the one space below the block
var oText = colList.options[lastInBlock+1].text;
var oValue = colList.options[lastInBlock+1].value;
var oTitle = colList.options[lastInBlock+1].title; // gsl fix
if ( descArray != (void 0) )
var dValue = descArray[lastInBlock+1];
//move the block down one at a time
for (var i = lastInBlock; i >= firstInBlock; i--)
{
colList.options[i+1].text = colList.options[i].text;
colList.options[i+1].value = colList.options[i].value;
colList.options[i+1].title = colList.options[i].title; // gsl fix
colList.options[i+1].selected = true;
if ( descArray != (void 0) )
descArray[i+1] = descArray[i];
}
//put the info of the slot below the selection above it
colList.options[firstInBlock].text = oText;
colList.options[firstInBlock].value = oValue;
colList.options[firstInBlock].title = oTitle; // gsl fix
colList.options[firstInBlock].selected = false;
if ( descArray != (void 0) )
descArray[firstInBlock] = dValue;
}
}
processed = tempIndex - 1;
}
TrShuttleProxy._displayDesc( list, formName );
//make the list for submission
TrShuttleProxy._makeList(formName, list);
}
/*
* _orderTopBottomList
*
* This function reorders the given list by shifting the selections
all the way
* in the given direction. If no formName is supplied, the form is
found when
* this is called. The 'list' parameter should be the
* list name(i.e. "<shuttleName>:leading" or
"<shuttleName>:trailing")
*/
TrShuttleProxy._orderTopBottomList = function(
down,
list,
formName
)
{
//get the formname if needed
if(formName == (void 0))
{
formName = TrShuttleProxy._findFormNameContaining(list);
}
//get the actual list
var colList = document.forms[formName].elements[list];
//get all the indexes of the items selected in the list
var selItems = TrShuttleProxy._getSelectedIndexes(formName,
list);
//if no items are selected, return with alert.
if(selItems.length == 0)
{
if (_shuttle_no_items_selected.length > 0)
alert(_shuttle_no_items_selected);
return;
}
var descArray = TrShuttleProxy._getDescArray(list);
var moveDescArray = new Array();
var selDescArray = new Array();
var moveItemsText = new Array();
var moveItemsValue = new Array();
var moveItemsTitle = new Array(); // gsl fix
var moveItemsIndex = 0;
if(down == 0)
{
//get an array of all the items we will have to displace in
order
var selItemsIndex = 0;
var moveItemsIndex = 0;
for(var colListIndex=0;
colListIndex < selItems[selItems.length - 1];
colListIndex++)
{
if(colListIndex != selItems[selItemsIndex])
{
moveItemsText[moveItemsIndex] =
colList.options[colListIndex].text;
moveItemsValue[moveItemsIndex] =
colList.options[colListIndex].value;
moveItemsTitle[moveItemsIndex] = colList.options[colListIndex].title;
//
gsl fix
if ( descArray != (void 0) )
moveDescArray[moveItemsIndex] = descArray[colListIndex];
moveItemsIndex++
}
else
{
if ( descArray != (void 0) )
selDescArray[selItemsIndex] = descArray[colListIndex];
selItemsIndex++;
}
}
if ( descArray != (void 0) )
selDescArray[selItemsIndex] = descArray[colListIndex];
//place items to move toward top of col
for(var i = 0; i < selItems.length; i++)
{
colList.options[i].text = colList.options[selItems[i]].text;
colList.options[i].value =
colList.options[selItems[i]].value;
colList.options[i].title = colList.options[selItems[i]].title; // gsl
fix
colList.options[i].selected = true;
if ( descArray != (void 0) )
descArray[i] = selDescArray[i];
}
//place displaced items below
for(var j = 0; j < moveItemsText.length; j++)
{
colList.options[i].text = moveItemsText[j];
colList.options[i].value = moveItemsValue[j];
colList.options[i].title = moveItemsTitle[j]; // gsl fix
colList.options[i].selected = false;
if ( descArray != (void 0) )
descArray[i] = moveDescArray[j];
i++
}
}
else
{
//get an array of all the items we will have to displace in
order
var selItemsIndex = 1;
var moveItemsIndex = 0;
if ( descArray != (void 0) )
selDescArray[0] = descArray[selItems[0]];
for(var colItemsIndex=selItems[0]+1;
colItemsIndex <= colList.length-2;
colItemsIndex++)
{
if((selItemsIndex == selItems.length) ||
(colItemsIndex != selItems[selItemsIndex]))
{
moveItemsText[moveItemsIndex] =
colList.options[colItemsIndex].text;
moveItemsValue[moveItemsIndex] =
colList.options[colItemsIndex].value;
moveItemsTitle[moveItemsIndex] = colList.options[colItemsIndex].title;
// gsl fix
if ( descArray != (void 0) )
moveDescArray[moveItemsIndex] = descArray[colItemsIndex];
moveItemsIndex++;
}
else
{
if ( descArray != (void 0) )
selDescArray[selItemsIndex] = descArray[colItemsIndex];
selItemsIndex++;
}
}
//place items to move toward bottom of col
var j = colList.length - 2;
for(var i = selItems.length-1; i >= 0; i--)
{
colList.options[j].text = colList.options[selItems[i]].text;
colList.options[j].value =
colList.options[selItems[i]].value;
colList.options[j].title = colList.options[selItems[i]].title; // gsl
fix
colList.options[j].selected = true;
if ( descArray != (void 0) )
descArray[j] = selDescArray[i];
j--;
}
//place displaced items above
for(var i = moveItemsText.length-1; i >= 0; i--)
{
colList.options[j].text = moveItemsText[i];
colList.options[j].value = moveItemsValue[i];
colList.options[j].title = moveItemsTitle[i]; // gsl fix
colList.options[j].selected = false;
if ( descArray != (void 0) )
descArray[j] = moveDescArray[i];
j--
}
}
TrShuttleProxy._displayDesc( list, formName );
//make the list for submission
TrShuttleProxy._makeList(formName, list);
}
-=> Gregg <=-
|
signature.asc
Description: OpenPGP digital signature