- Timestamp:
- 01/22/10 14:48:55 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrForms.pm
r698 r699 294 294 /^text(-\w+)?(?::(\d+))?/ and do { 295 295 my $flag = $1 || ''; 296 my $textf = sprintf( 297 '<input type="text" id="%s" name="%s" value="%s" size="%d">', 298 $self->escape($htmlname), 299 $self->escape($htmlname), 300 $self->escape($self->attr_raw_value($attr)), 301 $2 || 30, 302 ); 303 if ($flag =~ /A/) { 304 $textf .= qq|<span id="${htmlname}_auto_complete"></span>|; 305 $textf .= "\n"; 306 $textf .= $self->{c}->prototype->auto_complete_field( 307 $htmlname, 308 { 309 update => "${htmlname}_auto_complete", 310 url => $self->{c}->uri_for('/ajax', 'attrvalues', $self->otype, $attr), 311 indicator => "${htmlname}_stat", min_chars => 1, 312 with => "'val='+document.getElementById('$htmlname').value", 313 frequency => 2, 296 if (my @allowed = $self->base->obj_attr_allowed_values( 297 $self->{otype}, $attr)) { 298 my $cvalue = $self->attr_raw_value($attr); 299 my $textf = sprintf('<select id="%s" name="%s">', 300 $self->escape($htmlname), 301 $self->escape($htmlname)) . "\n"; 302 $textf .= '<option value="">--</option>' . "\n"; 303 foreach (sort @allowed) { 304 $textf .= sprintf('<option value="%s"%s>%s</option>' . "\n", 305 $self->escape($_), 306 (($cvalue || '') eq $_ ? ' selected="selected"' : ''), 307 $self->escape($_), 308 ); 314 309 } 315 ); 310 $textf .= "</select>\n"; 311 return $textf; 312 } else { 313 my $textf = sprintf( 314 '<input type="text" id="%s" name="%s" value="%s" size="%d">', 315 $self->escape($htmlname), 316 $self->escape($htmlname), 317 $self->escape($self->attr_raw_value($attr)), 318 $2 || 30, 319 ); 320 if ($flag =~ /A/) { 321 $textf .= qq|<span id="${htmlname}_auto_complete"></span>|; 322 $textf .= "\n"; 323 $textf .= $self->{c}->prototype->auto_complete_field( 324 $htmlname, 325 { 326 update => "${htmlname}_auto_complete", 327 url => $self->{c}->uri_for('/ajax', 'attrvalues', $self->otype, $attr), 328 indicator => "${htmlname}_stat", min_chars => 1, 329 with => "'val='+document.getElementById('$htmlname').value", 330 frequency => 2, 331 } 332 ); 333 } 334 if ($flag =~ /U/) { 335 $textf .= qq|<span id="${htmlname}_observer_uniq"></span>|; 336 $textf .= "\n"; 337 $textf .= $self->{c}->prototype->observe_field( 338 $htmlname, 339 { 340 update => "${htmlname}_observer_uniq", 341 url => $self->{c}->uri_for('/ajax', 'objattrexist', 342 $self->otype, $attr), 343 frequency => 2, 344 indicator => "${htmlname}_stat", min_chars => 1, 345 with => "'val='+document.getElementById('$htmlname').value" . 346 ($self->{object} ? "+'&exclude=" . $self->{object}->id . "'" : 347 ''), 348 } 349 ); 350 } 351 $textf .= qq|<span style="display:none" id="${htmlname}_stat">Searching...</span>|; 352 353 return $textf; 316 354 } 317 if ($flag =~ /U/) {318 $textf .= qq|<span id="${htmlname}_observer_uniq"></span>|;319 $textf .= "\n";320 $textf .= $self->{c}->prototype->observe_field(321 $htmlname,322 {323 update => "${htmlname}_observer_uniq",324 url => $self->{c}->uri_for('/ajax', 'objattrexist',325 $self->otype, $attr),326 frequency => 2,327 indicator => "${htmlname}_stat", min_chars => 1,328 with => "'val='+document.getElementById('$htmlname').value" .329 ($self->{object} ? "+'&exclude=" . $self->{object}->id . "'" :330 ''),331 }332 );333 }334 $textf .= qq|<span style="display:none" id="${htmlname}_stat">Searching...</span>|;335 336 return $textf;337 355 }; 338 356 }
Note: See TracChangeset
for help on using the changeset viewer.