| 
Welcome, Guest

#145 removing filters in list
(1 viewing) (1) Guest

TOPIC: #145 removing filters in list

Re:removing filters in list 3 years, 5 months ago #82983

  • ndee
  • ndee
  • OFFLINE
  • Platinum Boarder
    Platinum Boarder
  • Posts: 543
  • Karma: 19
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
function moveOption4(fromObj, toObj)
{
for(var i = fromObj.options.length - 1; i >= 0; i--)
{
if(fromObj.options[i].selected)
{
fromObj.options[i].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);
}
}
}


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


----
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
	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[i].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="";
}
}
}


added else clause
	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[i].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="";
}
}
}


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


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


minor changes in enclosed admin.comprofiler.html.php

Post edited by: ndee, at: 2008/12/21 00:51
Attachments:
###################
SPEED UP HELP, read first: Help us help you
###################
The topic has been locked.

Re:removing filters in list 3 years, 5 months ago #82985

  • ndee
  • ndee
  • OFFLINE
  • Platinum Boarder
    Platinum Boarder
  • Posts: 543
  • Karma: 19
file..

Attachment admin.zip not found

Attachments:
###################
SPEED UP HELP, read first: Help us help you
###################
The topic has been locked.

Re:removing filters in list 3 years, 4 months ago #85621

  • beat
  • beat
  • ONLINE
  • Administrator
    Administrator
  • Posts: 6783
  • Karma: 327
Many thanks for the fix proposal.

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
CB links: Subscribe to CB documentation - Our templates - Paid Subscriptions - Get Hosting - Our Forge - Incubator
Visit my CB Profile - Send me a Private Message (PM)
--
help us spend more time coding by helping others in this forum, many thanks
The topic has been locked.
Time to create page: 1.16 seconds