diff options
Diffstat (limited to 'httemplate/browse')
-rw-r--r-- | httemplate/browse/circuit_provider.html | 11 | ||||
-rw-r--r-- | httemplate/browse/circuit_termination.html | 11 | ||||
-rw-r--r-- | httemplate/browse/circuit_type.html | 11 | ||||
-rw-r--r-- | httemplate/browse/elements/browse-simple.html | 57 |
4 files changed, 90 insertions, 0 deletions
diff --git a/httemplate/browse/circuit_provider.html b/httemplate/browse/circuit_provider.html new file mode 100644 index 000000000..12f653251 --- /dev/null +++ b/httemplate/browse/circuit_provider.html @@ -0,0 +1,11 @@ +<& elements/browse-simple.html, + 'table' => 'circuit_provider', + 'title' => 'Circuit providers', + 'menubar' => [ 'Circuit types' => 'circuit_type.html', + 'Circuit terminations' => 'circuit_termination.html' + ], + 'name_singular' => 'provider', + 'name_header' => 'Provider name', + 'name_col' => 'provider', + 'acl' => 'Configuration', +&> diff --git a/httemplate/browse/circuit_termination.html b/httemplate/browse/circuit_termination.html new file mode 100644 index 000000000..830ccf7fb --- /dev/null +++ b/httemplate/browse/circuit_termination.html @@ -0,0 +1,11 @@ +<& elements/browse-simple.html, + 'table' => 'circuit_termination', + 'title' => 'Circuit terminations', + 'menubar' => [ 'Circuit types' => 'circuit_type.html', + 'Circuit providers' => 'circuit_provider.html' + ], + 'name_singular' => 'termination type', + 'name_header' => 'Termination type', + 'name_col' => 'termination', + 'acl' => 'Configuration', +&> diff --git a/httemplate/browse/circuit_type.html b/httemplate/browse/circuit_type.html new file mode 100644 index 000000000..a145d54d9 --- /dev/null +++ b/httemplate/browse/circuit_type.html @@ -0,0 +1,11 @@ +<& elements/browse-simple.html, + 'table' => 'circuit_type', + 'title' => 'Circuit types', + 'menubar' => [ 'Circuit providers' => 'circuit_provider.html', + 'Circuit terminations' => 'circuit_termination.html' + ], + 'name_singular' => 'circuit type', + 'name_header' => 'Circuit type', + 'name_col' => 'typename', + 'acl' => 'Configuration', +&> diff --git a/httemplate/browse/elements/browse-simple.html b/httemplate/browse/elements/browse-simple.html new file mode 100644 index 000000000..cfa27e882 --- /dev/null +++ b/httemplate/browse/elements/browse-simple.html @@ -0,0 +1,57 @@ +<& browse.html, + 'query' => { 'table' => $table }, + 'count_query' => "SELECT COUNT(*) FROM $table", + 'header' => [ '#', $opt{name_header} ], + 'fields' => [ $table_key, $opt{name_col} ], + 'links' => [ '', '' ], + 'link_onclicks' => [ '', $sub_edit_popup ], + 'disableable' => 1, + 'disabled_statuspos' => 2, + 'html_init' => $html_init, + %opt, +&> +<%doc> +A simple wrapper around search/elements/search.html for browsing/editing +tables that only have a primary key, a 'disabled' field, and one other column +which is the object's name or description. Usage: + +<& browse-simple.html, + # required + 'table' => 'mytable', + 'title' => 'My Things', + 'name_singular' => 'thing', + 'name_col' => 'thingname', + 'name_header' => 'Thing name' + 'acl' => 'Configure things', +&> + +</%doc> +<%init> +my %opt = @_; + +my $table = delete $opt{table}; +my $name_singular = $opt{name_singular}; + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right($opt{acl}); + +my $table_key = dbdef->table($table)->primary_key; +my $sub_edit_popup = sub { + my $pkey = $_[0]->get($table_key); + include('/elements/popup_link_onclick.html', + 'action' => $p."edit/$table.html?$pkey", + 'actionlabel' => "Edit $name_singular", + 'width' => 350, + 'height' => 220, + ); +}; + +my $html_init = include('/elements/popup_link.html', + 'action' => $p."edit/$table.html?", + 'actionlabel' => "Add $name_singular", + 'width' => 350, + 'height' => 220, + 'label' => "Add a new $name_singular", +) . '<BR>'; + +</%init> |