summaryrefslogtreecommitdiff
path: root/httemplate/edit/part_virtual_field.html
diff options
context:
space:
mode:
authorlevinse <levinse>2011-07-22 18:59:27 +0000
committerlevinse <levinse>2011-07-22 18:59:27 +0000
commitc405e80203f323a83b447d6fc899dbba32d52f2a (patch)
treeaa7cc7ad31c43eb012ad3d9b787ee0a51bb6b4ac /httemplate/edit/part_virtual_field.html
parent99e8e2006117bd4b97ebb1daf897cc257265dc3f (diff)
custom fields, RT11714
Diffstat (limited to 'httemplate/edit/part_virtual_field.html')
-rw-r--r--httemplate/edit/part_virtual_field.html44
1 files changed, 44 insertions, 0 deletions
diff --git a/httemplate/edit/part_virtual_field.html b/httemplate/edit/part_virtual_field.html
new file mode 100644
index 000000000..f3fb53065
--- /dev/null
+++ b/httemplate/edit/part_virtual_field.html
@@ -0,0 +1,44 @@
+<% include('elements/edit.html',
+ 'name_singular' => 'custom field',
+ 'viewall_dir' => 'browse',
+ 'table' => 'part_virtual_field',
+ 'labels' => { 'vfieldpart' => '',
+ 'dbtable' => 'Table',
+ 'name' => 'Name',
+ 'length' => 'Length',
+ 'label' => 'Label',
+ 'dbtable_dummy' => 'Table',
+ },
+ 'fields' => [
+ { field=>'vfieldpart', type=>'hidden', },
+ { field=>'name', type=>'text', },
+ { field => 'dbtable',
+ type => 'select',
+ options => [ 'svc_broadband', 'router', 'cust_main', ],
+ },
+ { field=>'label', type=>'text', },
+ { field=>'length', type=>'text', },
+ ],
+ 'edit_callback' => $callback,
+ 'error_callback' => $callback,
+ 'html_init' => 'Please be patient after clicking the button as
+ this process may take more than 10 seconds.
+ <br><br>',
+ )
+%>
+<%init>
+
+my $callback = sub {
+ my ($cgi, $object, $fields) = (shift, shift, shift);
+ my @edit_fixed_fields = qw( dbtable name length );
+ foreach my $f ( @{$fields} ) {
+ # XXX: editing anything other than label is disabled for now
+ $f->{type} = 'fixed'
+ if $object->vfieldpart && grep { $f->{field} eq $_ } @edit_fixed_fields;
+ }
+};
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>