package Eludia::Presentation::Skins::Classic; use Data::Dumper; BEGIN { require Eludia::Presentation::Skins::Generic; delete $INC {"Eludia/Presentation/Skins/Generic.pm"}; our $lrt_bar = '\n"; our $replacement = { error => 'JS', redirect => 'JS', }; } ################################################################################ sub options { return {}; } ################################################################################ sub _icon_path { -r $r -> document_root . "/i/_skins/Classic/$_[0].gif" ? "$_REQUEST{__static_url}/$_[0].gif?$_REQUEST{__static_salt}" : "/i/buttons/$_[0].gif" } ################################################################################ sub register_hotkey { my ($_SKIN, $hashref) = @_; $hashref -> {label} =~ s{\&(.)}{$1} or return undef; my $c = $1; if ($c eq '<') { return 37; } elsif ($c eq '>') { return 39; } elsif (lc $c eq 'æ') { return 186; } elsif (lc $c eq 'ý') { return 222; } else { $c =~ y{ÉÖÓÊÅÍÃØÙÇÕÚÔÛÂÀÏÐÎËÄÆÝß×ÑÌÈÒÜÁÞéöóêåíãøùçõúôûâàïðîëäæýÿ÷ñìèòüáþ}{qwertyuiop[]asdfghjkl;'zxcvbnm,.qwertyuiop[]asdfghjkl;'zxcvbnm,.}; return (ord ($c) - 32); } } ################################################################################ sub static_path { my ($package, $file) = @_; my $path = __FILE__; $path =~ s{\.pm}{/$file}; return $path; }; ################################################################################ sub draw_hr { my ($_SKIN, $options) = @_; return < EOH } ################################################################################ sub draw_calendar { my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime (time); $year += 1900; $_REQUEST {__clock_separator} ||= ':'; return <$i18n->{today}: $mday $i18n->{months}->[$mon] $year    EOH } ################################################################################ sub draw_auth_toolbar { my ($_SKIN, $options) = @_; my $calendar = draw_calendar (); my $subset_selector = ''; if (@{$_SKIN -> {subset} -> {items}} > 1) { $subset_selector = < '; } return < @{[ $_REQUEST {__help_url} ? < EOHELP $subset_selector
   $$options{user_label}   $calendar [$$i18n{F1}]  
$$options{top_banner} EOH } ################################################################################ sub draw_window_title { my ($_SKIN, $options) = @_; return '' if $_REQUEST {select}; return <   $$options{label} EOH } ################################################################################ # FORMS & INPUTS ################################################################################ sub _draw_bottom { my ($_SKIN, $options) = @_; unless ($options -> {menu}) { return < EOH } my $items = $options -> {menu}; my ($tr1, $tr2, $tr3) = ('', ''); $tr3 .= qq{}; $tr2 .= qq{}; $tr1 .= qq{}; my $class = $items -> [0] -> {is_active} ? 'bgr0' : 'bgr6'; $tr1 .= qq{}; $tr3 .= qq{}; for (my $i = 0; $i < 0 + @$items; $i++) { my $item = $items -> [$i]; my $active = $item -> {is_active}; my $class = $active ? 'bgr0' : 'bgr6'; $tr1 .= qq{}; $tr2 .= qq{ $$item{label} }; $tr3 .= qq{}; if ($i < -1 + @$items) { my $aa = $active . ($items -> [$i + 1] -> {is_active}); my $class = $aa ne '00' ? 'bgr0' : 'bgr6'; $tr1 .= qq{}; $tr3 .= qq{}; } else { my $class = $active ? 'bgr0' : 'bgr6'; $tr1 .= qq{}; $tr3 .= qq{}; } } $tr3 .= qq{}; $tr1 .= qq{}; return < $tr3 $tr2 $tr1 EOH } ################################################################################ sub _draw_input_datetime { my ($_SKIN, $options) = @_; # $r -> header_in ('User-Agent') =~ /MSIE 5\.0/ or return draw_form_field_string (@_); $options -> {id} ||= '' . $options; $options -> {onClose} ||= 'null'; $options -> {onKeyDown} ||= 'null'; $options -> {onKeyPress} ||= 'if (window.event.keyCode != 27) is_dirty=true'; # $options -> {no_read_only} or $options -> {attributes} -> {readonly} = 1; my $attributes = dump_attributes ($options -> {attributes}); my $shows_time = $options -> {no_time} ? 'false' : 'true'; my $html = < EOH unless ($options -> {no_clear_button} || $options -> {no_read_only}) { $html .= qq{ }; } $html .= < EOH return $html; } ################################################################################ sub draw_form { my ($_SKIN, $options) = @_; if ($_REQUEST {__only_field}) { return ''; } my $html = $options -> {hr}; $html .= _draw_bottom (@_); $html .= $options -> {path}; $options -> {target} = '_self' if ($_REQUEST {select}); $html .= <
EOH foreach (@{$options -> {keep_params}}) { $html .= qq{\n\t\t\t\t}; } foreach my $row (@{$options -> {rows}}) { my $tr_id = $row -> [0] -> {tr_id}; $html .= qq{
}; foreach (@$row) { $html .= $_ -> {html} }; $html .= qq{}; } $html .= '
'; $html .= $options -> {bottom_toolbar}; return $html; } ################################################################################ sub draw_path { my ($_SKIN, $options, $list) = @_; my $path = <
  EOH if ($conf -> {core_show_icons} || $_REQUEST {__core_show_icons}) { $path .= qq{ }; } for (my $i = 0; $i < @$list; $i ++) { if ($i > 0) { $path .= ' / '; if ($options -> {multiline}) { $path .= '
'; for (my $j = 0; $j < $i + 2; $j++) { $path .= '  ' } } } my $item = $list -> [$i]; $path .= qq{$$item{label}}; } $path .= <
EOH return $path; } ################################################################################ sub draw_form_field { my ($_SKIN, $field, $data) = @_; if ($field -> {type} eq 'banner') { my $colspan = 'colspan=' . ($field -> {colspan} + 1); return qq{$$field{html}}; } elsif ($field -> {type} eq 'hidden') { return $field -> {html}; } my $colspan = $field -> {colspan} ? 'colspan=' . $field -> {colspan} : ''; my $label_width = $field -> {label_width} ? 'width=' . $field -> {label_width} : ''; my $cell_width = $field -> {cell_width} ? 'width=' . $field -> {cell_width} : ''; return <\n$$field{label} \n$$field{html} EOH } ################################################################################ sub draw_form_field_banner { my ($_SKIN, $field, $data) = @_; return $field -> {label}; } ################################################################################ sub draw_form_field_button { my ($_SKIN, $options, $data) = @_; return qq {}; } ################################################################################ sub draw_form_field_string { my ($_SKIN, $options, $data) = @_; return ' {attributes}) . ' onKeyPress="if (window.event.keyCode != 27) is_dirty=true" onKeyDown="tabOnEnter()" onFocus="scrollable_table_is_blocked = true; " onBlur="scrollable_table_is_blocked = false; ">'; } ################################################################################ sub draw_form_field_datetime { my ($_SKIN, $options, $data) = @_; $options -> {name} = '_' . $options -> {name}; $options -> {onKeyDown} ="tabOnEnter()"; return $_SKIN -> _draw_input_datetime ($options); } ################################################################################ sub draw_form_field_file { my ($_SKIN, $options, $data) = @_; my $attributes = dump_attributes ($options -> {attributes}); return < EOH } ################################################################################ sub draw_form_field_hidden { my ($_SKIN, $options, $data) = @_; return qq {}; } ################################################################################ sub draw_form_field_hgroup { my ($_SKIN, $options, $data) = @_; my $html = ''; foreach my $item (@{$options -> {items}}) { next if $item -> {off}; $html .= $item -> {label} if $item -> {label}; $html .= $item -> {html}; $html .= ' '; } return $html; } ################################################################################ sub draw_form_field_text { my ($_SKIN, $options, $data) = @_; my $attributes = dump_attributes ($options -> {attributes}); return <$$options{value} EOH } ################################################################################ sub draw_form_field_password { my ($_SKIN, $options, $data) = @_; my $attributes = dump_attributes ($options -> {attributes}); return qq {}; } ################################################################################ sub draw_form_field_static { my ($_SKIN, $options, $data) = @_; my $html = ''; if ($options -> {href}) { my $state = $data -> {fake} == -1 ? 'deleted' : $_REQUEST {__read_only} ? 'passive' : 'active'; $options -> {a_class} ||= "form-$state-inputs"; $html = qq{}; } $html .= "" if ($options -> {color}); if (ref $options -> {value} eq ARRAY) { for (my $i = 0; $i < @{$options -> {value}}; $i++) { $html .= '
' if $i; $html .= $options -> {value} -> [$i] -> {label}; } } else { $html .= $options -> {value}; } $html .= '
' if ($options -> {color}); if ($options -> {href}) { $html .= '
'; } $html .= qq {} if ($options -> {add_hidden}); return $html; } ################################################################################ sub draw_form_field_checkbox { my ($_SKIN, $options, $data) = @_; my $attributes = dump_attributes ($options -> {attributes}); return qq {}; } ################################################################################ sub draw_form_field_radio { my ($_SKIN, $options, $data) = @_; my $html = ''; foreach my $value (@{$options -> {values}}) { delete $value -> {attributes} -> {name}; delete $value -> {attributes} -> {value}; delete $value -> {attributes} -> {id}; delete $value -> {attributes} -> {onclick}; my $attributes = dump_attributes ($value -> {attributes}); $html .= qq {\n
 $$value{label}}; $value -> {html} or next; $html .= qq{\n\t\t
$$value{html}
}; } $html .= '
'; return $html; } ################################################################################ sub draw_form_field_select { my ($_SKIN, $options, $data) = @_; my $attributes = dump_attributes ($options -> {attributes}); if (defined $options -> {other}) { $options -> {other} -> {width} ||= 600; $options -> {other} -> {height} ||= 400; my $d_style_top = "d.style.top = " . (defined $options -> {other} -> {top} ? "${$$options{other}}{top};" : "this.offsetTop + this.offsetParent.offsetTop + this.offsetParent.offsetParent.offsetTop;"); my $d_style_left = "d.style.left = " . (defined $options -> {other} -> {left} ? "${$$options{other}}{left};" : "this.offsetLeft + this.offsetParent.offsetLeft + this.offsetParent.offsetParent.offsetLeft;"); my $onchange = < {no_confirm} ||= $conf -> {core_no_confirm_other}; if ($options -> {no_confirm}) { $options -> {onChange} .= < {onChange} .= < EOH if (defined $options -> {empty}) { $html .= qq {\n}; } foreach my $value (@{$options -> {values}}) { $html .= qq {\n}; } if (defined $options -> {other}) { $html .= qq {}; } $html .= ''; my $width; if (defined $options -> {other} -> {width}) { $width = "${$$options{other}}{width}"; } elsif (defined $options -> {other} -> {left}) { $width = "expression(this.offsetParent.offsetWidth)"; } else { $width = "expression(getElementById('_$$options{name}_select').offsetParent.offsetWidth - 10)"; } if (defined $options -> {other}) { $options -> {other} -> {height} ||= 300; $html .= <