summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2008-01-04 02:23:20 +0000
committerivan <ivan>2008-01-04 02:23:20 +0000
commit93838a89d0010da5c4757a5dc4f626d6bfe806f8 (patch)
treea9e667398d85216116cc48e50c3d5efcb7e2ec7b
parentf3dcab6b9862f3e4f85cdbeed428861e34271a51 (diff)
reprocussions: backporting elements from HEAD needed for edit.html
-rw-r--r--httemplate/elements/hidden.html11
-rw-r--r--httemplate/elements/tablebreak-tr-title.html5
-rw-r--r--httemplate/elements/tr-checkbox.html25
-rw-r--r--httemplate/elements/tr-fixed-country.html10
-rw-r--r--httemplate/elements/tr-fixed-state.html10
-rw-r--r--httemplate/elements/tr-fixed.html15
-rw-r--r--httemplate/elements/tr-input-money.html13
-rw-r--r--httemplate/elements/tr-input-percentage.html8
-rw-r--r--httemplate/elements/tr-input-text.html44
-rw-r--r--httemplate/elements/tr-select.html61
-rw-r--r--httemplate/elements/tr-td-label.html17
11 files changed, 219 insertions, 0 deletions
diff --git a/httemplate/elements/hidden.html b/httemplate/elements/hidden.html
new file mode 100644
index 000000000..831108121
--- /dev/null
+++ b/httemplate/elements/hidden.html
@@ -0,0 +1,11 @@
+<INPUT TYPE = "hidden"
+ NAME = "<% $opt{field} %>"
+ ID = "<% $opt{field} %>"
+ VALUE = "<% $opt{curr_value} || $opt{value} |h %>"
+>
+
+<%init>
+
+my %opt = @_;
+
+</%init>
diff --git a/httemplate/elements/tablebreak-tr-title.html b/httemplate/elements/tablebreak-tr-title.html
new file mode 100644
index 000000000..35dc05d8b
--- /dev/null
+++ b/httemplate/elements/tablebreak-tr-title.html
@@ -0,0 +1,5 @@
+</TABLE>
+
+<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
+
+<% include('tr-title.html', @_ ) %>
diff --git a/httemplate/elements/tr-checkbox.html b/httemplate/elements/tr-checkbox.html
new file mode 100644
index 000000000..2e6d1f107
--- /dev/null
+++ b/httemplate/elements/tr-checkbox.html
@@ -0,0 +1,25 @@
+<% include('tr-td-label.html', @_ ) %>
+
+ <TD <% $style %>>
+ <INPUT TYPE = "checkbox"
+ NAME = "<% $opt{field} %>"
+ ID = "<% $opt{id} %>"
+ VALUE = "<% $opt{value} %>"
+ <% $opt{curr_value} eq $opt{value} ? ' CHECKED' : '' %>
+ <% $onchange %>
+ >
+ </TD>
+
+</TR>
+
+<%init>
+
+my %opt = @_;
+
+my $onchange = $opt{'onchange'}
+ ? 'onChange="'. $opt{'onchange'}. '(this)"'
+ : '';
+
+my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
+
+</%init>
diff --git a/httemplate/elements/tr-fixed-country.html b/httemplate/elements/tr-fixed-country.html
new file mode 100644
index 000000000..806d92cd6
--- /dev/null
+++ b/httemplate/elements/tr-fixed-country.html
@@ -0,0 +1,10 @@
+<% include('tr-fixed.html', %opt ) %>
+<%init>
+
+my %opt = @_;
+
+my $value = $opt{'curr_value'} || $opt{'value'};
+
+$opt{'formatted_value'} = code2country($value). " ($value)";
+
+</%init>
diff --git a/httemplate/elements/tr-fixed-state.html b/httemplate/elements/tr-fixed-state.html
new file mode 100644
index 000000000..eea30ddc5
--- /dev/null
+++ b/httemplate/elements/tr-fixed-state.html
@@ -0,0 +1,10 @@
+<% include('tr-fixed.html', %opt ) %>
+<%init>
+
+my %opt = @_;
+
+my $value = $opt{'curr_value'} || $opt{'value'};
+
+$opt{'formatted_value'} = state_label($value, $opt{'object'}->country);
+
+</%init>
diff --git a/httemplate/elements/tr-fixed.html b/httemplate/elements/tr-fixed.html
new file mode 100644
index 000000000..095e1bce9
--- /dev/null
+++ b/httemplate/elements/tr-fixed.html
@@ -0,0 +1,15 @@
+<% include('tr-td-label.html', @_ ) %>
+
+ <TD BGCOLOR="#dddddd" <% $style %>><% $opt{'formatted_value'} || $opt{'curr_value'} || $opt{'value'} |h %></TD>
+
+</TR>
+
+<% include('hidden.html', %opt ) %>
+
+<%init>
+
+my %opt = @_;
+
+my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
+
+</%init>
diff --git a/httemplate/elements/tr-input-money.html b/httemplate/elements/tr-input-money.html
new file mode 100644
index 000000000..88014192d
--- /dev/null
+++ b/httemplate/elements/tr-input-money.html
@@ -0,0 +1,13 @@
+<% include('tr-input-text.html', @_,
+ 'type' => 'text',
+ 'prefix' => $money_char,
+ 'size' => 8,
+ )
+%>
+<%once>
+
+my $conf = new FS::Conf;
+my $money_char = $conf->config('money_char') || '$';
+
+</%once>
+
diff --git a/httemplate/elements/tr-input-percentage.html b/httemplate/elements/tr-input-percentage.html
new file mode 100644
index 000000000..ae553a93c
--- /dev/null
+++ b/httemplate/elements/tr-input-percentage.html
@@ -0,0 +1,8 @@
+<% include('tr-input-text.html', @_,
+ 'type' => 'text',
+ 'postfix' => '%',
+ 'size' => 5, #6? check in IE (not a big deal)
+ 'maxlength' => 7,
+ 'text-align' => 'right',
+ )
+%>
diff --git a/httemplate/elements/tr-input-text.html b/httemplate/elements/tr-input-text.html
new file mode 100644
index 000000000..c8bec5ea6
--- /dev/null
+++ b/httemplate/elements/tr-input-text.html
@@ -0,0 +1,44 @@
+<% include('tr-td-label.html', @_ ) %>
+
+ <TD <% $style %>>
+
+ <% $opt{'prefix'} %><INPUT TYPE = "<% $opt{type} || 'text' %>"
+ NAME = "<% $opt{field} %>"
+ ID = "<% $opt{id} %>"
+ VALUE = "<% $value |h %>"
+ <% $size %>
+ <% $maxlength %>
+ <% $align %>
+ <% $onchange %>
+ ><% $opt{'postfix'} %>
+
+ </TD>
+
+</TR>
+
+<%init>
+
+my %opt = @_;
+
+my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value};
+
+my $onchange = $opt{'onchange'}
+ ? 'onChange="'. $opt{'onchange'}. '(this)"'
+ : '';
+
+my $size = $opt{'size'}
+ ? 'SIZE="'. $opt{'size'}. '"'
+ : '';
+
+my $maxlength = $opt{'maxlength'}
+ ? 'MAXLENGTH="'. $opt{'maxlength'}. '"'
+ : '';
+
+my $align = $opt{'text-align'}
+ ? 'STYLE="text-align: '. $opt{'text-align'}. '"'
+ : '';
+
+
+my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
+
+</%init>
diff --git a/httemplate/elements/tr-select.html b/httemplate/elements/tr-select.html
new file mode 100644
index 000000000..07b0a01d5
--- /dev/null
+++ b/httemplate/elements/tr-select.html
@@ -0,0 +1,61 @@
+<% include('tr-td-label.html', @_ ) %>
+
+ <TD <% $style %>>
+
+ <SELECT NAME = "<% $opt{field} %>"
+ ID = "<% $opt{id} %>"
+ previousValue = "<% $curr_value %>"
+ previousText = "<% $labels->{$curr_value} || $curr_value %>"
+ <% $onchange %>
+ >
+
+% if ( $opt{options} ) {
+%
+% foreach my $option ( @{ $opt{options} } ) { #just arrayref for now
+
+ <OPTION VALUE="<% $option %>"
+ <% $opt{curr_value} eq $option ? 'SELECTED' : '' %>
+ >
+ <% $labels->{$option} || $option %>
+ </OPTION>
+
+% }
+%
+% } else { #deprecated weird value hashref used only by reason.html
+%
+% my $aref = $opt{'value'}->{'values'};
+% my $vkey = $opt{'value'}->{'vcolumn'};
+% my $ckey = $opt{'value'}->{'ccolumn'};
+% foreach my $v (@$aref) {
+
+ <OPTION VALUE="<% $v->$vkey %>"
+ <% ($opt{curr_value} eq $v->$vkey) ? 'SELECTED' : '' %>
+ >
+ <% $v->$ckey %>
+ </OPTION>
+
+% }
+%
+% }
+
+ </SELECT>
+
+ </TD>
+
+</TR>
+
+<%init>
+
+my %opt = @_;
+
+my $onchange = $opt{'onchange'}
+ ? 'onChange="'. $opt{'onchange'}. '(this)"'
+ : '';
+
+my $labels = $opt{'option_labels'} || $opt{'labels'};
+
+my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
+
+my $curr_value = $opt{'curr_value'};
+
+</%init>
diff --git a/httemplate/elements/tr-td-label.html b/httemplate/elements/tr-td-label.html
new file mode 100644
index 000000000..77c048405
--- /dev/null
+++ b/httemplate/elements/tr-td-label.html
@@ -0,0 +1,17 @@
+<TR>
+
+ <TD ALIGN="right" VALIGN="top" STYLE="<% $style %>" ID="<% $opt{label_id} || $opt{id}. '_label0' %>">
+
+ <% $opt{label} %>
+
+ </TD>
+
+<%init>
+
+my %opt = @_;
+
+my $style = 'padding-top: 3px';
+$style .= '; '. $opt{'cell_style'}
+ if $opt{'cell_style'};
+
+</%init>