[Rt-commit] r4315 - in rt/branches/3.7-EXPERIMENTAL: . html/Search/Elements

ruz at bestpractical.com ruz at bestpractical.com
Sat Dec 17 21:10:23 EST 2005


Author: ruz
Date: Sat Dec 17 21:10:22 2005
New Revision: 4315

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/PickBasics
   rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/PickCFs
Log:
 r1531 at cubic-pc:  cubic | 2005-12-18 03:05:27 +0300
  r1466 at cubic-pc:  cubic | 2005-12-14 22:41:38 +0300
  * switch to ConditionRow component
  * add callback
 


Modified: rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/PickBasics
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/PickBasics	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/PickBasics	Sat Dec 17 21:10:22 2005
@@ -43,123 +43,167 @@
 %# those contributions and any derivatives thereof.
 %# 
 %# END BPS TAGGED BLOCK }}}
-<tr>
-<td class="label">
-<&|/l&>id</&>
-</td><td>
-<& /Elements/SelectEqualityOperator, Name => "idOp" &>
-</td><td>
-<input name="ValueOfid" size="5">
-</td></tr>
+% foreach( @lines ) {
+<& ConditionRow, Condition => $_ &>
+% }
+<%INIT>
 
-<tr><td class="label">
-<& /Elements/SelectAttachmentField, Name => 'AttachmentField' &>
-</td><td>
-<& /Elements/SelectBoolean, Name => "AttachmentOp", 
+my @lines = (
+    {
+        Name => 'id',
+        Field => loc('id'),
+        Op => {
+            Type => 'component',
+            Path => '/Elements/SelectEqualityOperator',
+        },
+        Value => { Type => 'text', Size => 5 }
+    },
+    {
+        Name => 'Attachment',
+        Field => {
+            Type => 'component',
+            Path => '/Elements/SelectAttachmentField',
+        },
+        Op => {
+            Type => 'component',
+            Path => '/Elements/SelectBoolean',
+            Arguments => {
 			    True => loc("matches"), 
 			    False => loc("does not match"), 
-			    TrueVal => 'LIKE', 
-			    FalseVal => 'NOT LIKE' 
-&> 
-</td><td>
-<input name="ValueOfAttachment" size="20">
-</td></tr>
-
-<tr><td class="label">
-<&|/l&>Queue</&>
-</td><td>
-<& /Elements/SelectBoolean,  Name => "QueueOp" , 
-					True => loc("is"), 
-					False => loc("isn't"), 
-					TrueVal=> '=', 
-					FalseVal => '!=' &>
-</td><td>
-<& /Elements/SelectQueue, 
-    Name => "ValueOfQueue", 
-    NamedValues => 1, 
-    CheckQueueRight => 'ShowTicket' &>
-</td></tr>
-
-<tr><td class="label">
-<&|/l&>Status</&>
-</td><td>
-<& /Elements/SelectBoolean, Name => "StatusOp", 
-			    True => loc("is"), 
-  			    False => loc("isn't"), 
-			    TrueVal=> '=', 
-			    FalseVal => '!=' 
-&>  
-</td><td>
-<& /Elements/SelectStatus, Name => "ValueOfStatus", SkipDeleted => 1 &>
-</td></tr>
-
-<tr><td class="label">
-<select name="ActorField">
-<option value="Owner"><&|/l&>Owner</&></option>
-<option value="Creator"><&|/l&>Creator</&></option>
-<option value="LastUpdatedBy"><&|/l&>LastUpdatedBy</&></option>
-</select>
-</td><td>
-<& /Elements/SelectBoolean, Name => "ActorOp",
-					  TrueVal=> '=',
-					  FalseVal => '!=',
-&> 
-</td><td>
-<& /Elements/SelectOwner, Name => "ValueOfActor", ValueAttribute => 'Name' &>
-</td></tr>
-
-<tr><td class="label">
-<& SelectPersonType, Name => 'WatcherField', Default => 'Requestor' &>
-</td><td>
-<& /Elements/SelectMatch, Name => "WatcherOp" &>
-</td><td>
-<input name="ValueOfWatcher" size="20">
-</td></tr>
+			    TrueVal => 'LIKE',
+			    FalseVal => 'NOT LIKE',
+            },
+        },
+        Value => { Type => 'text', Size => 20 },
+    },
+    {
+        Name => 'Queue',
+        Field => loc('Queue'),
+        Op => {
+            Type => 'component',
+            Path => '/Elements/SelectBoolean',
+            Arguments => { TrueVal=> '=', FalseVal => '!=' },
+        },
+        Value => {
+            Type => 'component',
+            Path => '/Elements/SelectQueue',
+            Arguments => { NamedValues => 1, CheckQueueRight => 'ShowTicket' },
+        },
+    },
+    {
+        Name => 'Status',
+        Field => loc('Status'),
+        Op => {
+            Type => 'component',
+            Path => '/Elements/SelectBoolean',
+            Arguments => { TrueVal=> '=', FalseVal => '!=' },
+        },
+        Value => {
+            Type => 'component',
+            Path => '/Elements/SelectStatus',
+            Arguments => { SkipDeleted => 1 },
+        },
+    },
+    {
+        Name => 'Actor',
+        Field => {
+            Type    => 'select',
+            Options => [
+                Owner => loc('Owner'),
+                Creator => loc('Creator'),
+                LastUpdatedBy => loc('Last updated by'),
+            ],
+        },
+        Op => {
+            Type => 'component',
+            Path => '/Elements/SelectBoolean',
+            Arguments => { TrueVal=> '=', FalseVal => '!=' },
+        },
+        Value => {
+            Type => 'component',
+            Path => '/Elements/SelectOwner',
+            Arguments => { ValueAttribute => 'Name' },
+        },
+    },
+    {
+        Name => 'Watcher',
+        Field => {
+            Type => 'component',
+            Path => 'SelectPersonType',
+            Arguments => { Default => 'Requestor' },
+        },
+        Op => {
+            Type => 'component',
+            Path => '/Elements/SelectMatch',
+        },
+        Value => { Type => 'text', Size => 20 }
+    },
+    {
+        Name => 'Date',
+        Field => {
+            Type => 'component',
+            Path => '/Elements/SelectDateType',
+        },
+        Op => {
+            Type => 'component',
+            Path => '/Elements/SelectDateRelation',
+        },
+        Value => {
+            Type => 'component',
+            Path => '/Elements/SelectDate',
+            Arguments => { ShowTime => 0, Default => '' },
+        },
+    },
+    {
+        Name => 'Time',
+        Field => {
+            Type    => 'select',
+            Options => [
+                TimeWorked => loc('Time Worked'),
+                TimeEstimated => loc('Time Estimated'),
+                TimeLeft => loc('Time Left'),
+            ],
+        },
+        Op => {
+            Type => 'component',
+            Path => '/Elements/SelectEqualityOperator',
+        },
+        Value => [
+            { Type => 'text', Size => 5 },
+            {
+                Type => 'component',
+                Path => '/Elements/SelectTimeUnits',
+            },
+        ],
+    },
+    {
+        Name => 'Priority',
+        Field => {
+            Type    => 'select',
+            Options => [
+                Priority => loc('Priority'),
+                InitialPriority => loc('Initial Priority'),
+                FinalPriority => loc('Final Priority'),
+            ],
+        },
+        Op => {
+            Type => 'component',
+            Path => '/Elements/SelectEqualityOperator',
+        },
+        Value => { Type => 'text', Size => 5 }
+    },
+    {
+        Name => 'Links',
+        Field => { Type => 'component', Path => 'SelectLinks' },
+        Op => {
+            Type => 'component',
+            Path => '/Elements/SelectBoolean',
+            Arguments => { TrueVal=> '=', FalseVal => '!=' },
+        },
+        Value => { Type => 'text', Size => 5 }
+    },
+);
 
-<tr><td class="label">
-<& /Elements/SelectDateType, Name=>"DateField" &>
-</td><td>
-<& /Elements/SelectDateRelation, Name=>"DateOp" &>
-</td><td>
-<& /Elements/SelectDate, Name => "ValueOfDate", ShowTime => 0, Default => '' &>
-</td></tr>
+$m->comp('/Elements/Callback', Conditions => \@lines);
 
-<tr><td class="label">
-<select name="TimeField">
-<option value="TimeWorked"><&|/l&>Time Worked</&></option>
-<option value="TimeEstimated"><&|/l&>Time Estimated</&></option>
-<option value="TimeLeft"><&|/l&>Time Left</&></option>
-</select>
-</td><td>
-<& /Elements/SelectEqualityOperator, Name => "TimeOp" &>
-</td><td>
-<input name="ValueOfTime" size="5">
-<& /Elements/SelectTimeUnits, Name =>'ValueOfTime' &>
-</td></tr>
-
-<tr><td class="label">
-<select name="PriorityField">
-<option value="Priority"><&|/l&>Priority</&></option>
-<option value="InitialPriority"><&|/l&>Initial Priority</&></option>
-<option value="FinalPriority"><&|/l&>Final Priority</&></option>
-</select>
-</td><td>
-<& /Elements/SelectEqualityOperator, Name => "PriorityOp" &>
-</td><td>
-<input name="ValueOfPriority" size="5">
-</td></tr>
-
-<tr><td class="label">
-<& SelectLinks, Name=>"LinksField" &>
-</td><td>
-<& /Elements/SelectBoolean, Name => "LinksOp", 
-			    True => loc("is"), 
-  			    False => loc("isn't"), 
-			    TrueVal=> '=', 
-			    FalseVal => '!=' &>  
-</td><td>
-<input name="ValueOfLinks" value="" size="5">
-</td></tr>
-
-<%INIT>
 </%INIT>

Modified: rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/PickCFs
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/PickCFs	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/PickCFs	Sat Dec 17 21:10:22 2005
@@ -43,22 +43,8 @@
 %# those contributions and any derivatives thereof.
 %# 
 %# END BPS TAGGED BLOCK }}}
-% while ( my $CustomField = $CustomFields->Next ) {
-% my $name = "'CF.{" . $CustomField->Name . "}'";
-<tr><td class="label">
-<% $CustomField->Name %> 
-</td>
-<td>
-        <& /Elements/SelectCustomFieldOperator, Name => $name . "Op", 
-                                    True => loc("is"), 
-                                    False => loc("isn't"), 
-                                    TrueVal=> '=', FalseVal => '!=' &>
-</td>
-<td>
-<& /Elements/SelectCustomFieldValue, Name => "ValueOf" . $name,
-                            CustomField => $CustomField,
-                            &>
-</td></tr>
+% foreach( @lines ) {
+<& ConditionRow, Condition => $_ &>
 % }
 <%INIT>
 my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'});
@@ -71,6 +57,31 @@
 }
 $CustomFields->LimitToGlobal();
 
+
+my @lines;
+while ( my $CustomField = $CustomFields->Next ) {
+    my %line;
+    $line{'Name'} = "'CF.{" . $CustomField->Name . "}'";
+    $line{'Field'} = $CustomField->Name;
+    $line{'Op'} = {
+        Type => 'component',
+        Path => '/Elements/SelectCustomFieldOperator',
+        Arguments => { True => loc("is"),
+                       False => loc("isn't"),
+                       TrueVal=> '=',
+                       FalseVal => '!=',
+                     },
+    };
+    $line{'Value'} = {
+        Type => 'component',
+        Path => '/Elements/SelectCustomFieldValue',
+        Arguments => { CustomField => $CustomField },
+    };
+    push @lines, \%line;
+}
+
+$m->comp('/Elements/Callback', Conditions => \@lines, Queues => \%cfqueues );
+
 </%INIT>
 
 <%ARGS>


More information about the Rt-commit mailing list