[Astpp-commit] SF.net SVN: astpp:[2293] trunk
Brought to you by:
darrenkw
|
From: <dar...@us...> - 2009-10-17 21:46:29
|
Revision: 2293
http://astpp.svn.sourceforge.net/astpp/?rev=2293&view=rev
Author: darrenkw
Date: 2009-10-17 21:46:20 +0000 (Sat, 17 Oct 2009)
Log Message:
-----------
Add menus so that when you click the main menu in the interface it brings up sub menus in the window below rather than failing.
Modified Paths:
--------------
trunk/web_interface/astpp-admin.cgi
Added Paths:
-----------
trunk/templates/sub_menu.tpl
Added: trunk/templates/sub_menu.tpl
===================================================================
--- trunk/templates/sub_menu.tpl (rev 0)
+++ trunk/templates/sub_menu.tpl 2009-10-17 21:46:20 UTC (rev 2293)
@@ -0,0 +1,11 @@
+<div align="center">
+ <table width="100%" border="0">
+ <TR>
+ <TD align="center"> MENU </TD>
+ <TR>
+ <TMPL_LOOP NAME="menu">
+ <TR>
+ <TD align="center"><a href="astpp-admin.cgi?mode=<TMPL_VAR NAME="value">"> <TMPL_VAR NAME="value"> </a></TD>
+ </TR>
+ </TMPL_LOOP>
+</table>
Modified: trunk/web_interface/astpp-admin.cgi
===================================================================
--- trunk/web_interface/astpp-admin.cgi 2009-10-17 20:41:31 UTC (rev 2292)
+++ trunk/web_interface/astpp-admin.cgi 2009-10-17 21:46:20 UTC (rev 2293)
@@ -322,6 +322,22 @@
return "";
}
+sub build_menu() {
+ my (@items) = @_;
+ my @menu_list;
+ my $template = HTML::Template->new(
+ filename => '/var/lib/astpp/templates/sub_menu.tpl',
+ die_on_bad_params => $config->{template_die_on_bad_params}
+ );
+ foreach my $tmp (@items) {
+ my %row;
+ $row{value} = $tmp;
+ push( @menu_list, \%row );
+ }
+ $template->param( menu => \@menu_list );
+ return $template->output;
+}
+
sub build_menu_ts() {
my ($selected) = @_;
my ( $tmp, $body, $x );
@@ -352,6 +368,28 @@
}
sub build_body() {
+ return &build_homepage()
+ if $params->{mode} eq gettext("Home Page")
+ || $params->{mode} eq gettext("Home")
+ || $params->{mode} eq ""
+ || $params->{mode} eq gettext("Login")
+ || $params->{mode} eq gettext("Logout");
+
+ # Make sure that the main menus are covered
+ return &build_menu(@Accounts) if $params->{mode} eq gettext("Accounts");
+ return &build_menu(@AdminReports) if $params->{mode} eq gettext("Admin Reports");
+ return &build_menu(@CallShops) if $params->{mode} eq gettext("Call Shops");
+ return &build_menu(@Callingcards) if $params->{mode} eq gettext("Calling Cards");
+ return &build_menu(@DIDs) if $params->{mode} eq gettext("DIDs");
+ return &build_menu(@LCR) if $params->{mode} eq gettext("LCR");
+ return &build_menu(@Rates) if $params->{mode} eq gettext("Rates");
+ return &build_menu(@Statistics) if $params->{mode} eq gettext("Statistics");
+ return &build_menu(@SwitchConfig) if $params->{mode} eq gettext("Switch Config");
+ return &build_menu(@System) if $params->{mode} eq gettext("System");
+ return &build_menu(@CallShops) if $params->{mode} eq gettext("CallShops");
+ return &build_menu(@Booths) if $params->{mode} eq gettext("Booths");
+
+ # Cover all the submenus
if ( $params->{logintype} == 2 ) { #Admin Login
return &build_providers() if $params->{mode} eq gettext("Providers");
return &build_trunks() if $params->{mode} eq gettext("Trunks");
@@ -379,8 +417,6 @@
return &build_account_info()
if $params->{mode} eq gettext("View Details");
return &build_list_accounts()
- if $params->{mode} eq gettext("Accounts");
- return &build_list_accounts()
if $params->{mode} eq gettext("List Accounts");
return &build_edit_account()
if $params->{mode} eq gettext("Edit Account");
@@ -443,12 +479,6 @@
return &build_admin_vendor_report()
if $params->{mode} eq gettext("Vendor Report");
- return &build_homepage()
- if $params->{mode} eq gettext("Home Page")
- || $params->{mode} eq gettext("Home")
- || $params->{mode} eq ""
- || $params->{mode} eq gettext("Login")
- || $params->{mode} eq gettext("Logout");
return gettext("Not Available!") . "\n";
}
elsif ( $params->{logintype} == 3 ) { #Vendor Login
@@ -479,8 +509,6 @@
if $params->{mode} eq gettext("Calc Charge");
return &build_dids()
if $params->{mode} eq gettext("Manage DIDs");
- return &build_dids()
- if $params->{mode} eq gettext("DIDs");
return &build_sip_devices()
if $params->{mode} eq gettext("Asterisk(TM) SIP Devices");
return &build_iax_devices()
@@ -556,14 +584,7 @@
return &build_counters()
if $params->{mode} eq gettext("Counters");
- return &build_homepage()
- if $params->{mode} eq gettext("Home Page")
- || $params->{mode} eq gettext("Home")
- || $params->{mode} eq ""
- || $params->{mode} eq gettext("Login")
- || $params->{mode} eq gettext("Logout");
return gettext("Not Available!") . "\n";
- return gettext("Not Available!") . "\n";
}
elsif ( $params->{logintype} == 5 ) { #Call Shop Login
return &build_pricelists() if $params->{mode} eq gettext("Pricelists");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|