reprocussions: backporting elements from HEAD needed for edit.html
authorivan <ivan>
Fri, 4 Jan 2008 02:23:20 +0000 (02:23 +0000)
committerivan <ivan>
Fri, 4 Jan 2008 02:23:20 +0000 (02:23 +0000)
httemplate/elements/hidden.html [new file with mode: 0644]
httemplate/elements/tablebreak-tr-title.html [new file with mode: 0644]
httemplate/elements/tr-checkbox.html [new file with mode: 0644]
httemplate/elements/tr-fixed-country.html [new file with mode: 0644]
httemplate/elements/tr-fixed-state.html [new file with mode: 0644]
httemplate/elements/tr-fixed.html [new file with mode: 0644]
httemplate/elements/tr-input-money.html [new file with mode: 0644]
httemplate/elements/tr-input-percentage.html [new file with mode: 0644]
httemplate/elements/tr-input-text.html [new file with mode: 0644]
httemplate/elements/tr-select.html [new file with mode: 0644]
httemplate/elements/tr-td-label.html [new file with mode: 0644]

diff --git a/httemplate/elements/hidden.html b/httemplate/elements/hidden.html
new file mode 100644 (file)
index 0000000..8311081
--- /dev/null
@@ -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 (file)
index 0000000..35dc05d
--- /dev/null
@@ -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 (file)
index 0000000..2e6d1f1
--- /dev/null
@@ -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 (file)
index 0000000..806d92c
--- /dev/null
@@ -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 (file)
index 0000000..eea30dd
--- /dev/null
@@ -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 (file)
index 0000000..095e1bc
--- /dev/null
@@ -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 (file)
index 0000000..8801419
--- /dev/null
@@ -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 (file)
index 0000000..ae553a9
--- /dev/null
@@ -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 (file)
index 0000000..c8bec5e
--- /dev/null
@@ -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 (file)
index 0000000..07b0a01
--- /dev/null
@@ -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 (file)
index 0000000..77c0484
--- /dev/null
@@ -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>