summaryrefslogtreecommitdiff
path: root/httemplate/browse
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/browse')
-rw-r--r--httemplate/browse/deploy_zone.html6
-rw-r--r--httemplate/browse/msg_template/email.html (renamed from httemplate/browse/msg_template.html)30
-rw-r--r--httemplate/browse/msg_template/http.html68
-rwxr-xr-xhttemplate/browse/part_pkg.cgi1
-rwxr-xr-xhttemplate/browse/part_svc.cgi2
-rw-r--r--httemplate/browse/template_image.html68
6 files changed, 163 insertions, 12 deletions
diff --git a/httemplate/browse/deploy_zone.html b/httemplate/browse/deploy_zone.html
index 3bd9d07dd..a1bd57f15 100644
--- a/httemplate/browse/deploy_zone.html
+++ b/httemplate/browse/deploy_zone.html
@@ -17,6 +17,7 @@
'Market',
'Advertised Mbps',
'Contractual Mbps',
+ 'Vertices',
'Census blocks',
],
fields => [ 'zonenum',
@@ -42,6 +43,9 @@
)
},
sub { my $self = shift;
+ FS::deploy_zone_vertex->count('zonenum = '.$self->zonenum)
+ },
+ sub { my $self = shift;
FS::deploy_zone_block->count('zonenum = '.$self->zonenum)
},
],
@@ -53,7 +57,7 @@
'(cir_speed_down, cir_speed_up)',
],
links => [ $link_fixed, $link_fixed, ],
- align => 'clllllr',
+ align => 'cllllrrr',
nohtmlheader => 1,
disable_maxselect => 1,
disable_total => 1,
diff --git a/httemplate/browse/msg_template.html b/httemplate/browse/msg_template/email.html
index ef0b2dafd..d0ef4e3e9 100644
--- a/httemplate/browse/msg_template.html
+++ b/httemplate/browse/msg_template/email.html
@@ -1,9 +1,9 @@
-<% include( 'elements/browse.html',
+<& /browse/elements/browse.html,
'title' => 'Message templates',
'name_singular' => 'template',
'menubar' => \@menubar,
- 'query' => { 'table' => 'msg_template', },
- 'count_query' => 'SELECT COUNT(*) FROM msg_template',
+ 'query' => $query,
+ 'count_query' => $count_query,
'disableable' => 1,
'disabled_statuspos' => (scalar(@locales) + 3),
'agent_virt' => 1,
@@ -14,8 +14,7 @@
'links' => [ $link, @locale_links, '' ],
'link_onclicks' => [ '', map('', @locale_links), $disable_link ],
'cell_style' => [ '', '', map ($locale_style, @locales), $locale_style ],
- )
-%>
+&>
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
@@ -26,10 +25,21 @@ die "access denied"
my @menubar = ();
if ( $curuser->access_right(['Edit templates', 'Edit global templates']) ) {
- push @menubar, 'Add a new template' => $p.'edit/msg_template.html';
+ push @menubar, 'Add a new template' => $fsurl.'edit/msg_template/email.html';
}
+push @menubar, 'Template images' => $fsurl.'browse/template_image.html';
-my $link = [ "${p}edit/msg_template.html?msgnum=", 'msgnum' ];
+push @menubar, 'External message interfaces' => $fsurl.'browse/msg_template/http.html';
+
+my $query = {
+ 'table' => 'msg_template',
+ 'select' => '*',
+ 'hashref' => { 'msgclass' => 'email' },
+};
+
+my $count_query = "SELECT COUNT(*) FROM msg_template WHERE msgclass = 'email'";
+
+my $link = [ $fsurl.'edit/msg_template/email.html?msgnum=', 'msgnum' ];
my $locale_style = 'font-size:0.8em; padding:3px';
@@ -42,17 +52,17 @@ foreach my $l ( FS::Locales->locales ) {
};
push @locale_links, sub {
my $content = $_[0]->content_locales->{$l} or return '';
- [ "${p}edit/msg_template.html?locale=$l;msgnum=", 'msgnum' ];
+ [ $fsurl."edit/msg_template/email.html?locale=$l;msgnum=", 'msgnum' ];
};
}
my $disable_link = sub {
my $template = shift;
include('/elements/popup_link_onclick.html',
- action => $p.'misc/disable-msg_template.cgi?msgnum=' .
+ action => $fsurl.'misc/disable-msg_template.cgi?msgnum=' .
$template->msgnum .
($template->disabled ? ';enable=1' : ''),
- actionlabel => 'Disable lemplate',
+ actionlabel => 'Disable template',
);
};
diff --git a/httemplate/browse/msg_template/http.html b/httemplate/browse/msg_template/http.html
new file mode 100644
index 000000000..888fda441
--- /dev/null
+++ b/httemplate/browse/msg_template/http.html
@@ -0,0 +1,68 @@
+<& /browse/elements/browse.html,
+ 'title' => 'External message interfaces',
+ 'name_singular' => 'interface', # what else do we call them?
+ 'menubar' => \@menubar,
+ 'query' => $query,
+ 'count_query' => $count_query,
+ 'disableable' => 1,
+ 'disabled_statuspos' => 4,
+ 'agent_virt' => 1,
+ 'agent_null_right' => ['View global templates','Edit global templates'],
+ 'agent_pos' => 1,
+ 'header' => [ 'Name',
+ # 'Agent',
+ 'Prepare',
+ 'Send',
+ '' ],
+ 'fields' => [ 'msgname',
+ 'prepare_url',
+ 'send_url',
+ $disable_link_label
+ ],
+ 'links' => [ $link, ],
+ 'link_onclicks' => [ '', '', '', $disable_link ],
+ 'cell_style' => [ '', '', $url_style, $url_style ],
+&>
+<%init>
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+die "access denied"
+ unless $curuser->access_right([ 'View templates', 'View global templates',
+ 'Edit templates', 'Edit global templates', ]);
+
+my @menubar = ();
+if ( $curuser->access_right(['Edit templates', 'Edit global templates']) ) {
+ push @menubar, 'Add a new interface' => $fsurl.'edit/msg_template/http.html';
+}
+push @menubar, 'Email templates' => $fsurl.'browse/msg_template/email.html';
+push @menubar, 'Template images' => $fsurl.'browse/template_image.html';
+
+my $query = {
+ 'table' => 'msg_template',
+ 'select' => '*',
+ 'hashref' => { 'msgclass' => 'http' },
+};
+
+my $count_query = "SELECT COUNT(*) FROM msg_template WHERE msgclass = 'http'";
+
+my $link = [ $fsurl.'edit/msg_template/http.html?msgnum=', 'msgnum' ];
+
+my $url_style = 'font-size:0.8em; padding:3px'; # also for (disable) label
+
+my $disable_link = sub {
+ my $template = shift;
+ include('/elements/popup_link_onclick.html',
+ action => $fsurl.'misc/disable-msg_template.cgi?msgnum=' .
+ $template->msgnum .
+ ($template->disabled ? ';enable=1' : ''),
+ actionlabel => 'Disable template',
+ );
+};
+
+my $disable_link_label = sub {
+ my $template = shift;
+ $template->disabled ? '(enable)' : '(disable)' ;
+};
+
+</%init>
diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi
index c2f1430d7..07f104e55 100755
--- a/httemplate/browse/part_pkg.cgi
+++ b/httemplate/browse/part_pkg.cgi
@@ -591,6 +591,7 @@ push @fields,
},
];
}
+ sort
grep { $options{$_} =~ /\S/ }
grep { $_ !~ /^(setup|recur)_fee$/
and $_ !~ /^report_option_\d+$/ }
diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi
index ec5f321dd..88f8d8d19 100755
--- a/httemplate/browse/part_svc.cgi
+++ b/httemplate/browse/part_svc.cgi
@@ -161,7 +161,7 @@ function part_export_areyousure(href) {
% }
%
% my($n1)='';
-% foreach my $field ( @fields ) {
+% foreach my $field ( sort @fields ) {
%
% #a few lines of false laziness w/edit/part_svc.cgi
% my $def = FS::part_svc->svc_table_fields($svcdb)->{$field};
diff --git a/httemplate/browse/template_image.html b/httemplate/browse/template_image.html
new file mode 100644
index 000000000..eb4325f15
--- /dev/null
+++ b/httemplate/browse/template_image.html
@@ -0,0 +1,68 @@
+<% include('/elements/init_overlib.html') %>
+
+<% include( 'elements/browse.html',
+ 'title' => 'Template images',
+ 'name_singular' => 'image',
+ 'menubar' => \@menubar,
+ 'query' => { 'table' => 'template_image', },
+ 'count_query' => 'SELECT COUNT(*) FROM template_image',
+ 'agent_virt' => 1,
+ 'agent_null_right' => ['View global templates','Edit global templates'],
+ 'agent_pos' => 1,
+ 'header' => [ 'Name', '', '' ],
+ 'fields' => [ 'name', $tag, $delete_text ],
+ 'links' => [ '', '', '' ],
+ 'cell_style' => [ '', '', '' ],
+ )
+%>
+
+<% include('/elements/template_image-dialog.html',
+ 'url' => $p.'browse/template_image.html'
+ ) %>
+
+<%init>
+use FS::template_image;
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+die "access denied"
+ unless $curuser->access_right([ 'View templates', 'View global templates',
+ 'Edit templates', 'Edit global templates', ]);
+
+my $canedit = $curuser->access_right(['Edit templates', 'Edit global templates']);
+
+my @menubar = ();
+if ($canedit) {
+ push @menubar, 'Upload a new image' => 'javascript:insertImageDialog(\'upload\')';
+}
+push @menubar, ( 'View message templates' => $p.'browse/msg_template.html' );
+
+my $tag = sub { qq!<A HREF="javascript:insertImageDialog(! . $_[0]->imgnum . qq!)">view</A>! };
+
+my $delete_text = $canedit ? sub {
+ my $image = shift;
+ my $imgnum = $image->imgnum;
+ unless ($image->agentnum) {
+ unless ($FS::CurrentUser::CurrentUser->access_right('Edit global templates')) {
+ return '';
+ }
+ }
+ my $out = <<EOF;
+<FORM name="delete_template_image_$imgnum">
+<INPUT TYPE="hidden" name="imgnum" value="$imgnum">
+</FORM>
+EOF
+ $out .= include('/elements/progress-init.html',
+ "delete_template_image_$imgnum",
+ [ 'imgnum' ],
+ $p.'misc/process/template_image-delete.cgi',
+ $p.'browse/template_image.html',
+ "imgnum$imgnum",
+ );
+ my $onclick = 'if ( confirm(\'';
+ $onclick .= emt('Are you sure you want to delete template image ') . $imgnum;
+ $onclick .= '\') ) { imgnum' . $imgnum . 'process() }';
+ return $out . '<A HREF="javascript:void(0)" ONCLICK="' . $onclick . '">delete</A>';
+} : '';
+
+</%init>