From d04a09bce767a848b3f8a252a430d612e350db66 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Sat, 9 Jun 2012 22:55:37 -0400 Subject: [PATCH] Bug 6828 follow-up: adapt dashboard to new staff client theme This follow-up makes a few cosmetic changes: * Moves the dashboard to underneath the "pending" panel * Switches the layout to CSS-based instead of table-based * Makes the error message translatable * Reindents some sections of the added code to make things more readable Signed-off-by: Kyle M Hall --- koha-tmpl/intranet-tmpl/prog/css/staff-global.css | 20 ++ .../intranet-tmpl/prog/en/modules/intranet-main.tt | 210 +++++++------- mainpage.pl | 302 ++++++++++----------- 3 files changed, 269 insertions(+), 263 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/css/staff-global.css index 6b22201..cee06db 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/css/staff-global.css @@ -2969,3 +2969,23 @@ fieldset.rows + fieldset.action { .yui-u .rows li p label.widelabel { width: auto; } + +#dashboard td { + text-align: left; +} + +.dashboardleftpane { + margin-left: 1em; + margin-bottom: 1em; + float: left; +} + +.dashboardrightpane { + margin-right: 1em; + margin-bottom: 1em; + float: right; +} + +.dashboardempty { + background-color: #E8E8E8; +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt index 76886ac..b4856c4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt @@ -166,6 +166,106 @@ [% END %] + + [% IF DashBoardDisplayed %] + [% UNLESS nofile %] +
+ Koha library dashboard +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OverviewSystemMy Library
Number of Biblios[% number_of_biblios %]
Biblios added in last 7 days[% biblios_7days %]
Number of Items[% items_system %][% items_library %]
Number of items added in last 7 days [% items_7days_system %][% items_7days_system %]
Registered Borrowers[% borrowers_system %][% borrowers_library %]
Expired Borrowers[% expired_borrowers_system %][% expired_borrowers_library %]
 
+ Last updated: [% last_updated %] +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CirculationSystemMy Library
Items on Loan[% issues_system %][% issues_library %]
Loan History[% loan_history_system %][% loan_history_library %]
Items Overdue[% overdues_system %][% overdues_library %]
Overdue within 7 days[% overdues_7days_system %][% overdues_7days_library %]
Overdue 8-14 days[% overdues_14days_system %][% overdues_14days_library %]
Overdue 15-21 days[% overdues_21days_system %][% overdues_21days_library %]
Very Overdue Items[% very_overdue_system %][% very_overdue_library %]
+
+
+ [% ELSE %] + Dashboard is set to "Show." However there is no XML file to read. Have you run it at least once? + [% END %] + [% END %] + [% IF ( IntranetmainUserblock ) %]
@@ -196,117 +296,7 @@
[% END %] - -[% IF DashBoardDisplayed %] -[% UNLESS nofile %] -
-Koha Library Dashboard - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OverviewSystemMy Library
Number of Biblios - [% number_of_biblios %]
Biblios added in last 7 days[% biblios_7days %]
Number of Items[% items_system %][% items_library %]
Number of items added in last 7 days [% items_7days_system %][% items_7days_system %]
Registered Borrowers[% borrowers_system %][% borrowers_library %]
Expired Borrowers[% expired_borrowers_system %][% expired_borrowers_library %]
 
- Last updated: [% last_updated %] -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CirculationSystemMy Library
Items on Loan - [% issues_system %][% issues_library %]
Loan History[% loan_history_system %][% loan_history_library %]
Items Overdue[% overdues_system %][% overdues_library %]
Overdue within 7 days[% overdues_7days_system %][% overdues_7days_library %]
Overdue 8-14 days[% overdues_14days_system %][% overdues_14days_library %]
Overdue 15-21 days[% overdues_21days_system %][% overdues_21days_library %]
Very Overdue Items[% very_overdue_system %][% very_overdue_library %]
-
-
- - -[% END %] -[% END %] -[% IF nofile %] -[% nofile %] -[% END %] [% MACRO jsinclude BLOCK %] diff --git a/mainpage.pl b/mainpage.pl index 19ed9b8..924523f 100755 --- a/mainpage.pl +++ b/mainpage.pl @@ -92,177 +92,173 @@ unless ($loggedinuser) { } # Dashboard (If on in SysPref) -my $nofile = "Dashboard is set to \"ON\". However there is no XML file to read. Have you run it at least once?"; if ( C4::Context->preference('DashBoardDisplayed') ) { my $koha_conf = $ENV{'KOHA_CONF'}; my ($base,$file) = $koha_conf =~ m|^(.*[/\\])([^/\\]+?)$|; my $xml_read = "dashboard_xml.out"; my $xml_file = "$base"."$xml_read"; -if (-e $xml_file) { - my $xml = new XML::Simple; - my $dash = $xml->XMLin($xml_file); - my $login_branch_name = $template->{VARS}{LoginBranchcode}; - my $number_of_biblios; - my $biblios_7days; - my $items_7days_system; - my $items_7days_library; - my $borrowers_system; - my $expired_borrowers_library; - my $expired_borrowers_system; - my $loan_history_system; - my $loan_history_library; - my $overdues_library; - my $overdues_system; - my $overdues_7days_library; - my $overdues_7days_system; - my $overdues_14days_library; - my $overdues_14days_system; - my $overdues_21days_library; - my $overdues_21days_system; - my $very_overdue_library; - my $very_overdue_system; - my $borrowers_library; - my $issues_library; - my $issues_system; - my $items_library; - my $items_system; - my $last_updated; + if (-e $xml_file) { + my $xml = new XML::Simple; + my $dash = $xml->XMLin($xml_file); + my $login_branch_name = $template->{VARS}{LoginBranchcode}; + my $number_of_biblios; + my $biblios_7days; + my $items_7days_system; + my $items_7days_library; + my $borrowers_system; + my $expired_borrowers_library; + my $expired_borrowers_system; + my $loan_history_system; + my $loan_history_library; + my $overdues_library; + my $overdues_system; + my $overdues_7days_library; + my $overdues_7days_system; + my $overdues_14days_library; + my $overdues_14days_system; + my $overdues_21days_library; + my $overdues_21days_system; + my $very_overdue_library; + my $very_overdue_system; + my $borrowers_library; + my $issues_library; + my $issues_system; + my $items_library; + my $items_system; + my $last_updated; - $number_of_biblios = $dash->{biblios}->{NumberOfBiblios}; - $biblios_7days = $dash->{biblio_7days}->{NumberOfBiblio7Days}; - $items_7days_system = $dash->{items_7days_system}->{NumberOfItems7Days}; - $borrowers_system = $dash->{number_of_borrowers_system}->{NumberofBorrowersSystem}; - $loan_history_system = $dash->{loan_history_system}->{NumberOfLoans}; - $items_system = $dash->{items_system}->{NumberOfItemsSystem}; - $expired_borrowers_system = $dash->{expired_borrowers_system}->{ExpiredBorrowers}; - $issues_system = $dash->{issues_system}->{NumberOfIssuesSystem}; - $overdues_system = $dash->{overdues_system}->{NumberOfOverdues}; - $overdues_7days_system = $dash->{overdues_7days_system}->{NumberOfOverdues}; - $overdues_14days_system = $dash->{overdues_14days_system}->{NumberOfOverdues14Days}; - $overdues_21days_system = $dash->{overdues_21days_system}->{NumberOfOverdues21Days}; - $very_overdue_system = $dash->{very_overdue_system}->{Overdues}; - $last_updated = $dash->{last_updated}->{UpdatedTime}; + $number_of_biblios = $dash->{biblios}->{NumberOfBiblios}; + $biblios_7days = $dash->{biblio_7days}->{NumberOfBiblio7Days}; + $items_7days_system = $dash->{items_7days_system}->{NumberOfItems7Days}; + $borrowers_system = $dash->{number_of_borrowers_system}->{NumberofBorrowersSystem}; + $loan_history_system = $dash->{loan_history_system}->{NumberOfLoans}; + $items_system = $dash->{items_system}->{NumberOfItemsSystem}; + $expired_borrowers_system = $dash->{expired_borrowers_system}->{ExpiredBorrowers}; + $issues_system = $dash->{issues_system}->{NumberOfIssuesSystem}; + $overdues_system = $dash->{overdues_system}->{NumberOfOverdues}; + $overdues_7days_system = $dash->{overdues_7days_system}->{NumberOfOverdues}; + $overdues_14days_system = $dash->{overdues_14days_system}->{NumberOfOverdues14Days}; + $overdues_21days_system = $dash->{overdues_21days_system}->{NumberOfOverdues21Days}; + $very_overdue_system = $dash->{very_overdue_system}->{Overdues}; + $last_updated = $dash->{last_updated}->{UpdatedTime}; # Looping for "logged in branch" dependant data - foreach my $numissl(@{$dash->{issues_library}}) - { - if($numissl->{BranchCode} eq $login_branch_name) - { - $issues_library = $numissl->{NumberOfIssues} - } - } - foreach my $numitm(@{$dash->{items_library}}) - { - if($numitm->{BranchCode} eq $login_branch_name) - { - $items_library = $numitm->{NumberOfItems} - } - } - foreach my $numbor(@{$dash->{borrowers_library}}) - { - if($numbor->{BranchCode} eq $login_branch_name) - { - $borrowers_library = $numbor->{NumberOfBorrowers} - } - } - foreach my $numex(@{$dash->{expired_borrowers_library}}) - { - if($numex->{BranchCode} eq $login_branch_name) - { - $expired_borrowers_library = $numex->{ExpiredBorrowers} - } - } - - foreach my $numitm7(@{$dash->{items_7days_library}}) - { - if($numitm7->{BranchCode} eq $login_branch_name) - { - $items_7days_library = $numitm7->{NumberOfItems7DaysLibrary} - } - } - - foreach my $oldiss(@{$dash->{loan_history_library}}) - { - if($oldiss->{BranchCode} eq $login_branch_name) - { - $loan_history_library = $oldiss->{NumberOfLoans} - } - } - - foreach my $ovdlib(@{$dash->{overdues_library}}) - { - if($ovdlib->{BranchCode} eq $login_branch_name) - { - $overdues_library = $ovdlib->{NumberOfOverdues} - } - } + foreach my $numissl(@{$dash->{issues_library}}) + { + if($numissl->{BranchCode} eq $login_branch_name) + { + $issues_library = $numissl->{NumberOfIssues} + } + } + foreach my $numitm(@{$dash->{items_library}}) + { + if($numitm->{BranchCode} eq $login_branch_name) + { + $items_library = $numitm->{NumberOfItems} + } + } + foreach my $numbor(@{$dash->{borrowers_library}}) + { + if($numbor->{BranchCode} eq $login_branch_name) + { + $borrowers_library = $numbor->{NumberOfBorrowers} + } + } + foreach my $numex(@{$dash->{expired_borrowers_library}}) + { + if($numex->{BranchCode} eq $login_branch_name) + { + $expired_borrowers_library = $numex->{ExpiredBorrowers} + } + } - foreach my $ovd7day(@{$dash->{overdues_7days_library}}) - { - if($ovd7day->{BranchCode} eq $login_branch_name) - { - $overdues_7days_library = $ovd7day->{NumberOfOverdues7Days} - } - } + foreach my $numitm7(@{$dash->{items_7days_library}}) + { + if($numitm7->{BranchCode} eq $login_branch_name) + { + $items_7days_library = $numitm7->{NumberOfItems7DaysLibrary} + } + } - foreach my $ovd14day(@{$dash->{overdues_14days_library}}) - { - if($ovd14day->{BranchCode} eq $login_branch_name) - { - $overdues_14days_library = $ovd14day->{NumberOfOverdues14Days} - } - } + foreach my $oldiss(@{$dash->{loan_history_library}}) + { + if($oldiss->{BranchCode} eq $login_branch_name) + { + $loan_history_library = $oldiss->{NumberOfLoans} + } + } - foreach my $ovd21day(@{$dash->{overdues_21days_library}}) - { - if($ovd21day->{BranchCode} eq $login_branch_name) - { - $overdues_21days_library = $ovd21day->{NumberOfOverdues21Days} - } - } + foreach my $ovdlib(@{$dash->{overdues_library}}) + { + if($ovdlib->{BranchCode} eq $login_branch_name) + { + $overdues_library = $ovdlib->{NumberOfOverdues} + } + } - foreach my $vryod(@{$dash->{very_overdue_library}}) - { - if($vryod->{BranchCode} eq $login_branch_name) - { - $very_overdue_library = $vryod->{NumberOfVeryOverdue} - } - } + foreach my $ovd7day(@{$dash->{overdues_7days_library}}) + { + if($ovd7day->{BranchCode} eq $login_branch_name) + { + $overdues_7days_library = $ovd7day->{NumberOfOverdues7Days} + } + } - $template->param('number_of_biblios' => $number_of_biblios, - 'biblios_7days' => $biblios_7days, - 'items_7days_system' => $items_7days_system, - 'items_7days_library' => $items_7days_library, - 'borrowers_system' => $borrowers_system, - 'expired_borrowers_library' => $expired_borrowers_library, - 'expired_borrowers_system' => $expired_borrowers_system, - 'overdues_library' => $overdues_library, - 'overdues_system' => $overdues_system, - 'overdues_7days_library' => $overdues_7days_library, - 'overdues_7days_system' => $overdues_7days_system, - 'overdues_14days_library' => $overdues_14days_library, - 'overdues_14days_system' => $overdues_14days_system, - 'overdues_21days_library' => $overdues_21days_library, - 'overdues_21days_system' => $overdues_21days_system, - 'very_overdue_library' => $very_overdue_library, - 'very_overdue_system' => $very_overdue_system, - 'loan_history_system' => $loan_history_system, - 'loan_history_library' => $loan_history_library, - 'issues_library' => $issues_library, - 'issues_system' => $issues_system, - 'items_library' => $items_library, - 'items_system' => $items_system, - 'borrowers_library' => $borrowers_library, - 'last_updated' => $last_updated + foreach my $ovd14day(@{$dash->{overdues_14days_library}}) + { + if($ovd14day->{BranchCode} eq $login_branch_name) + { + $overdues_14days_library = $ovd14day->{NumberOfOverdues14Days} + } + } - ); -} + foreach my $ovd21day(@{$dash->{overdues_21days_library}}) + { + if($ovd21day->{BranchCode} eq $login_branch_name) + { + $overdues_21days_library = $ovd21day->{NumberOfOverdues21Days} + } + } -elsif(!-e $xml_file) { - $template->param('nofile' => $nofile,); + foreach my $vryod(@{$dash->{very_overdue_library}}) + { + if($vryod->{BranchCode} eq $login_branch_name) + { + $very_overdue_library = $vryod->{NumberOfVeryOverdue} + } } + $template->param('number_of_biblios' => $number_of_biblios, + 'biblios_7days' => $biblios_7days, + 'items_7days_system' => $items_7days_system, + 'items_7days_library' => $items_7days_library, + 'borrowers_system' => $borrowers_system, + 'expired_borrowers_library' => $expired_borrowers_library, + 'expired_borrowers_system' => $expired_borrowers_system, + 'overdues_library' => $overdues_library, + 'overdues_system' => $overdues_system, + 'overdues_7days_library' => $overdues_7days_library, + 'overdues_7days_system' => $overdues_7days_system, + 'overdues_14days_library' => $overdues_14days_library, + 'overdues_14days_system' => $overdues_14days_system, + 'overdues_21days_library' => $overdues_21days_library, + 'overdues_21days_system' => $overdues_21days_system, + 'very_overdue_library' => $very_overdue_library, + 'very_overdue_system' => $very_overdue_system, + 'loan_history_system' => $loan_history_system, + 'loan_history_library' => $loan_history_library, + 'issues_library' => $issues_library, + 'issues_system' => $issues_system, + 'items_library' => $items_library, + 'items_system' => $items_system, + 'borrowers_library' => $borrowers_library, + 'last_updated' => $last_updated + ); + } else { + $template->{VARS}->{'nofile'} = 1; + } + } # Dashboard end -- 2.1.4