[Rt-commit] r2893 - in rt/branches/CHALDEA-EXPERIMENTAL/html:
Elements NoAuth
autrijus at bestpractical.com
autrijus at bestpractical.com
Wed May 18 09:22:31 EDT 2005
Author: autrijus
Date: Wed May 18 09:22:30 2005
New Revision: 2893
Removed:
rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/EditCustomFieldCascaded
Modified:
rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/EditCustomFieldSelect
rt/branches/CHALDEA-EXPERIMENTAL/html/NoAuth/webrt.css
Log:
* cascaded select lands.
Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/EditCustomFieldSelect
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/EditCustomFieldSelect (original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/Elements/EditCustomFieldSelect Wed May 18 09:22:30 2005
@@ -46,18 +46,10 @@
<select name="<%$NamePrefix%><%$CustomField->Id%>-Values"
size="<%$Rows%>"
<% $Multiple && 'MULTIPLE' %>>
-% my $selected;
-% my $CFVs = $CustomField->Values;
-% while ($CFVs and my $value = $CFVs->Next ) {
- <option value="<%$value->Name%>"
-% if ($Values) {
- <% $Values->HasEntry($value->Name) && ($selected = 1) && 'SELECTED' %>
-% } elsif ($Default) {
- <% ($Default eq $value->Name) && ($selected = 1) && 'SELECTED' %>
-% }
- ><% $value->Name%></option>
-% }
+% my $selected = 0;
+% my $out = $m->scomp('SELF:options', %ARGS, SelectedRef => \$selected);
<option value="" <% !$selected && 'SELECTED' %>><&|/l&>(no value)</&></option>
+% $m->out($out);
</select>
<%ARGS>
$Object => undef
@@ -68,3 +60,46 @@
$Multiple => 0
$Rows => undef
</%ARGS>
+
+<%method options>
+% my $selected;
+% my $CFVs = $CustomField->Values;
+% my @levels;
+% while ($CFVs and my $value = $CFVs->Next ) {
+% my $category = $value->Category;
+% if (length $category) {
+% my $level = (split(/\s/, $category))[0];
+% while (@levels) {
+% if ($levels[-1] eq $level) {
+% undef $level;
+% last;
+% } elsif (index($level, $levels[-1]) != 0) {
+ </optgroup>
+% pop @levels;
+% } else {
+% last;
+% }
+% }
+% if (defined $level) {
+ <optgroup label="<% ' ' x @levels |n %><%$category%>">
+% push @levels, $level;
+% }
+% }
+ <option value="<%$value->Name%>"
+% if ($Values) {
+ <% $Values->HasEntry($value->Name) && ($$SelectedRef = 1) && 'SELECTED' %>
+% } elsif ($Default) {
+ <% ($Default eq $value->Name) && ($$SelectedRef = 1) && 'SELECTED' %>
+% }
+ ><% $value->Name%></option>
+% }
+% for (@levels) {
+ </optgroup>
+% }
+<%args>
+$CustomField
+$Default
+$Values
+$SelectedRef
+</%args>
+</%method>
Modified: rt/branches/CHALDEA-EXPERIMENTAL/html/NoAuth/webrt.css
==============================================================================
--- rt/branches/CHALDEA-EXPERIMENTAL/html/NoAuth/webrt.css (original)
+++ rt/branches/CHALDEA-EXPERIMENTAL/html/NoAuth/webrt.css Wed May 18 09:22:30 2005
@@ -620,6 +620,15 @@
width: 100%;
}
+select optgroup {
+ background-color: #ddd;
+}
+
+select optgroup option {
+ background-color: white;
+}
+
+
%# Provide a callback for adding/modifying the style sheet.
%# http://www.w3.org/TR/REC-CSS1 - section 3.2, says:
%# "latter specified rule wins"
More information about the Rt-commit
mailing list