#145 removing filters in list

15 years 3 months ago #82983 by ndee
Replied by ndee on topic Re:removing filters in list
It did not stop bother me... ;)

I hope it is fixed. Please check. Beside the fix of the Remove function I added a missing space to the select list and some double qoutes and the fitler -> filter typo.

All line numbers refer to admin.comprofiler.html.php shipped with CB 1.2 RC4.

I rewrote moveOption4 because it did not make sense:
a) second param was never used
b) for loop was useless and got never executed
c) the function does only cut of the last element of the array

I have not much experience with Javascript so please check if the function works right.

removed line 587-604
[code:1]function moveOption4(fromObj, toObj)
{
for(var i = fromObj.options.length - 1; i >= 0; i--)
{
if(fromObj.options.selected)
{
fromObj.options.selected = false;
for(var j = i; j < fromObj.options.length - 1; j++)
{
fromObj.options[j].text = fromObj.options[j + 1].text;
fromObj.options[j].value = fromObj.options[j + 1].value;
}
fromObj.options.length = fromObj.options.length - 1;
if(NS4)
history.go(0);
}
}
}[/code:1]

added:
[code:1]
function moveOption4(fromObj)
{
fromObjIndex = fromObj.selectedIndex;
fromObj.options[fromObjIndex].selected = false;
fromObj.options[fromObjIndex] = null;
}[/code:1]

----
function getFilterList(selectObj); line 624-652
added else statement to make sure the variable filterfields is empty, without doing that it is not empty if you remove the last filter
[code:1] function getFilterList(selectObj) {
var filterfields='';
var j=0;
var advType=getObject('ft2');
var simType=getObject('ft1');
//alert(simType.checked);
if(simType.checked) {
selectAll(selectObj);
if(selectObj.selectedIndex != -1) {
for(i = 0; i < selectObj.options.length; i++) {
if(j>0) filterfields += ' AND ';
filterfields += selectObj.options.value;
j++;
}
//alert(filterfields);
if(filterfields!=""«») {
document.adminForm.filterfields.value="s("+filterfields+"«»)";
} else {
document.adminForm.filterfields.value="";
}
}
} else {
if(document.adminForm.advFilterText.value!=""«») {
document.adminForm.filterfields.value="a("+escape(document.adminForm.advFilterText.value)+"«»)";
} else {
document.adminForm.filterfields.value="";
}
}
}[/code:1]

added else clause
[code:1] function getFilterList(selectObj) {
var filterfields='';
var j=0;
var advType=getObject('ft2');
var simType=getObject('ft1');
//alert(simType.checked);
if(simType.checked) {
selectAll(selectObj);
if(selectObj.selectedIndex != -1) {
for(i = 0; i < selectObj.options.length; i++) {
if(j>0) filterfields += ' AND ';
filterfields += selectObj.options.value;
j++;
}
//alert(filterfields);
if(filterfields!=""«») {
document.adminForm.filterfields.value="s("+filterfields+"«»)";
} else {
document.adminForm.filterfields.value="";
}
} else {
document.adminForm.filterfields.value="";
document.adminForm.advFilterText.value="";
}
} if(advType.checked) {
if(document.adminForm.advFilterText.value!=""«») {
document.adminForm.filterfields.value="a("+escape(document.adminForm.advFilterText.value)+"«»)";
} else {
document.adminForm.filterfields.value="";
}
}
}[/code:1]

---
line 892, changed function call
[code:1]<input type=button onclick="moveOption4(this.form.filter,this.form.filterfieldlist);" value=" Remove ">[/code:1]

to
[code:1]<input type=button onclick="moveOption4(this.form.filter);" value=" Remove " />[/code:1]

minor changes in enclosed admin.comprofiler.html.php

Post edited by: ndee, at: 2008/12/21 00:51

###################
SPEED UP HELP, read first: Help us help you
###################
Attachments:

Please Log in to join the conversation.

15 years 3 months ago #82985 by ndee
Replied by ndee on topic Re:removing filters in list
file..

Attachment admin.zip not found


###################
SPEED UP HELP, read first: Help us help you
###################
Attachments:

Please Log in to join the conversation.

15 years 3 months ago #85621 by beat
Replied by beat on topic Re:removing filters in list
Many thanks for the fix proposal. B)

Implemented the fix to this bug, without rewriting. This whole screen is scheduled for a completely cool jQuery rewrite after CB 1.2 Stable, so want to keep changes minimal for now.

So this identified issue is fixed for upcoming CB 1.2 Stable. :)

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.302 seconds

Facebook Twitter LinkedIn