[Rt-commit] [svn] r1027 - rt/branches/rt-3.1/html/Search

leira at pallas.eruditorum.org leira at pallas.eruditorum.org
Mon Jun 7 16:56:19 EDT 2004


Author: leira
Date: Mon Jun  7 16:56:19 2004
New Revision: 1027

Modified:
   rt/branches/rt-3.1/html/Search/Build.html
Log:
- Value of entry aggregator always comes from the node's parent
- Set the parent's entry aggregator when adding a clause to a grouping
- It matters if the value of the node is a reference, not the node itself


Modified: rt/branches/rt-3.1/html/Search/Build.html
==============================================================================
--- rt/branches/rt-3.1/html/Search/Build.html	(original)
+++ rt/branches/rt-3.1/html/Search/Build.html	Mon Jun  7 16:56:19 2004
@@ -251,6 +251,8 @@
 		    my $newparent = Tree::Simple->new($ARGS{'AndOr'});
 		    $newparent->addChild($newnode);
 		    $newnode = $newparent;
+		} else {
+		    $currentkey->getParent()->setNodeValue($ARGS{'AndOr'});
 		}
 		$currentkey->insertSibling($newindex, $newnode);
 		$currentkey = $newnode;
@@ -326,7 +328,7 @@
 	my $newparent;
 	if ($index > 0 ) {
 	    my $sibling = $parent->getChild($index - 1);
-	    if (ref($sibling)) {
+	    if (ref($sibling->getNodeValue)) {
 		$parent->removeChild($currentkey);
 		my $newtree = Tree::Simple->new('AND', $parent);
 		$newtree->addChild($currentkey);
@@ -355,17 +357,22 @@
 elsif ( $ARGS{"Toggle"} ) {
     my $ea;
     if ($currentkey) {
-	if (!ref($currentkey->getNodeValue())) {
-	    if ($currentkey->getNodeValue() eq 'AND') {
-		$currentkey->setNodeValue('OR');
+	my $value = $currentkey->getNodeValue();
+	my $parent = $currentkey->getParent();
+	my $parentvalue = $parent->getNodeValue();
+	if (ref($value)) {
+	    debug("setting parent value");
+	    if ( $parentvalue eq 'AND') {
+		$parent->setNodeValue('OR');
 	    } else {
-		$currentkey->setNodeValue('AND');
+		$parent->setNodeValue('AND');
 	    }
 	} else {
-	    if ($currentkey->getParent()->getNodeValue() eq 'AND') {
-		$currentkey->getParent()->setNodeValue('OR');
+	    debug("setting my value");
+	    if ($value eq 'AND') {
+		$currentkey->setNodeValue('OR');
 	    } else {
-		$currentkey->getParent()->setNodeValue('AND');
+		$currentkey->setNodeValue('AND');
 	    }
 	}
     }
@@ -404,8 +411,8 @@
     push @$keys, $_tree;
     my $clause = $_tree->getNodeValue();
     my $str;
+    my $ea = $_tree->getParent()->getNodeValue();
     if (ref($clause)) {
-	my $ea = $_tree->getParent()->getNodeValue();
         $str .= $ea . " " if $_tree->getIndex() > 0;
 	$str .= $clause->{Key} . " " . $clause->{Op} . " " . $clause->{Value};
 
@@ -413,7 +420,7 @@
 	    $queues->{ $clause->{Value} } = 1;
 	}
     } else {
-	$str = $_tree->getNodeValue() if $_tree->getIndex() > 0;
+	$str = $ea if $_tree->getIndex() > 0;
     }
 
     my $selected;


More information about the Rt-commit mailing list