[Rt-commit] r2780 - in rtfm/branches/2.1-TESTING/html/RTFM/Article: . Elements

tla at bestpractical.com tla at bestpractical.com
Tue Apr 19 01:10:12 EDT 2005


Author: tla
Date: Tue Apr 19 01:10:11 2005
New Revision: 2780

Modified:
   rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowSearchCriteria
   rtfm/branches/2.1-TESTING/html/RTFM/Article/Search.html
Log:
Move </form> tag to Search.html for symmetry; fix update logic so that
search names can be updated.



Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowSearchCriteria
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowSearchCriteria	(original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowSearchCriteria	Tue Apr 19 01:10:11 2005
@@ -102,7 +102,6 @@
 <div align="right"><input type="submit"></div>
 <&/Elements/TitleBoxEnd&>
 % }
-</form>
 
 
 </%init>

Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/Search.html
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/Search.html	(original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/Search.html	Tue Apr 19 01:10:11 2005
@@ -23,6 +23,8 @@
     Name => ($search ? $search->Name : undef),
     Privacy => ($search ? $search->Privacy : undef) &>
 <& Elements/ShowSearchCriteria, dates => \%dates, RefersTo => $RefersTo, customfields => $customfields,  ReferredToBy => $ReferredToBy, %ARGS &>
+</form>
+
 <& Elements/ShowSearchResults, articles => $articles &>
 <%init>
 use RT::SavedSearch;
@@ -118,19 +120,25 @@
 	push(@results, loc("Could not create search: [_1]", $msg));
     }
 } elsif ($ARGS{'Update'}) {
-    my %searchargs = %ARGS;
-    foreach my $key (@metakeys) {
-	delete $searchargs{$key};
-    }
-    
-    # We already have a search loaded, because CurrentSearch is set,
-    # or else we would not have gotten here.
-    my ($ret, $msg) = $search->Update(\%searchargs);
-    if ($ret) {
-	push(@results, loc("Search [_1] updated", $search->Name));
+    if ($ARGS{'SearchPrivacy'} != $search->Privacy) {
+	push(@results, 
+	     loc("Error: cannot change privacy value of existing search"));
     } else {
-	push(@results, loc("Error: search [_1] not updated: [_2]",
-			   $search->Name, $msg));
+	my %searchargs = %ARGS;
+	foreach my $key (@metakeys) {
+	    delete $searchargs{$key};
+	}
+	
+	# We already have a search loaded, because CurrentSearch is set,
+	# or else we would not have gotten here.
+	my ($ret, $msg) = $search->Update(Name => $ARGS{'NewSearchName'},
+					  SearchParams => \%searchargs);
+	if ($ret) {
+	    push(@results, loc("Search [_1] updated", $search->Name));
+	} else {
+	    push(@results, loc("Error: search [_1] not updated: [_2]",
+			       $search->Name, $msg));
+	}
     }
 } elsif ($ARGS{'Delete'}) {
     # Keep track of this, as we are about to delete the search.


More information about the Rt-commit mailing list