From: Janusz Dobrowolski Date: Fri, 26 Nov 2010 14:24:09 +0000 (+0000) Subject: Improved reports menu display. X-Git-Tag: v2.4.2~19^2~450 X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=4a07578898a905fcbb526f25322f215d87163034 Improved reports menu display. --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 6267f8a7..ffb7eef5 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -20,6 +20,12 @@ Legend: $ -> Affected files 26-Nov-2010 Janusz Dobrowolski +! [0000282] Improved reports menu display. +$ /js/inserts.js + /js/utils.js + /js/reports.js (new) + /reporting/reports_main.php + /reporting/includes/reports_classes.inc # [0000283] Fixed potential vulnerability (Mithy) $ /admin/db/security_db.inc # Fixed hotkeys support. diff --git a/js/inserts.js b/js/inserts.js index e486c6c4..a17519ef 100644 --- a/js/inserts.js +++ b/js/inserts.js @@ -303,6 +303,16 @@ var inserts = { return false; } }, + 'a.repopts_link': function(l) { + l.onclick = function() { + save_focus(this); + var replinks = document.getElementsBySelector('a.repopts_link'); + for(var i in replinks) + replinks[i].style.fontWeight = replinks[i]==this ? 'bold' : 'normal'; + JsHttpRequest.request(this, null); + return false; + } + }, 'a': function(e) { // traverse menu e.onkeydown = function(ev) { ev = ev||window.event; diff --git a/js/reports.js b/js/reports.js new file mode 100644 index 00000000..1c24875e --- /dev/null +++ b/js/reports.js @@ -0,0 +1,63 @@ +/********************************************************************** + Copyright (C) FrontAccounting, LLC. + Released under the terms of the GNU General Public License, GPL, + as published by the Free Software Foundation, either version 3 + of the License, or (at your option) any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License here . +***********************************************************************/ +var replinks = { + 'a, button': function(e) { // traverse menu + e.onkeydown = function(ev) { + ev = ev||window.event; + key = ev.keyCode||ev.which; + if(key==37 || key==38 || key==39 || key==40) { + move_focus(key, e, document.links); + ev.returnValue = false; + return false; + } + } + }, + 'a.repopts_link': function(e) { + e.onclick = function() { + save_focus(this); + set_options(this); + JsHttpRequest.request(this, null); + return false; + } + }, + 'a.repclass_link': function(e) { + e.onclick = function() { + save_focus(this); + showClass(this.id.substring(5)); // id=classX + return false; + } + } +} + +function set_options(e) +{ + var replinks = document.getElementsBySelector('a.repopts_link'); + for(var i in replinks) + replinks[i].style.fontWeight = replinks[i]==e ? 'bold' : 'normal'; +} + +function showClass(pClass) { + var classes = document.getElementsBySelector('.repclass'); + for(var i in classes) { + cl = classes[i]; + cl.style.display = (cl.id==('TAB_'+pClass)) ? "block" : "none"; + } + var classlinks = document.getElementsBySelector('a.repclass_link'); + for(var i in classlinks) + classlinks[i].style.fontWeight = classlinks[i].id == ('class'+pClass) ? + 'bold' : 'normal'; + + set_options(); // clear optionset links + document.getElementById('rep_form').innerHTML = ''; + return false; +} + +Behaviour.register(replinks); \ No newline at end of file diff --git a/js/utils.js b/js/utils.js index 0474ae23..51a7a491 100644 --- a/js/utils.js +++ b/js/utils.js @@ -295,7 +295,8 @@ function move_focus(dir, e0, neighbours) for(var i=0; ip0.y)) || (dir==38 && (p.yp0.x)))) { var l1 = (p.y-p0.y)*(p.y-p0.y)+(p.x-p0.x)*(p.x-p0.x); diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc index 9aad89c5..72be5bbf 100644 --- a/reporting/includes/reports_classes.inc +++ b/reporting/includes/reports_classes.inc @@ -55,26 +55,37 @@ class BoxReports $st_reports = ""; $st_params = ""; $st_classes = "" . _("Report Classes:") . "
"; + + if (isset($_GET['Class'])) + set_focus('class'.$_GET['Class']); + foreach($this->ar_classes as $class_id => $name) { if (!isset($this->ar_reports[$class_id])) continue; // e.g. no dimensions - $style = $class_id==$_REQUEST['Class'] ? '' : "style='display:none'"; -// $cname = access_string($key, true); -// $style = $_REQUEST['Class']==$cname ? '' : "style='display:none'"; + $acc = access_string($name); $st_classes .= "$acc[0]
"; + ." style='font-weight:". ($_REQUEST['Class'] == $class_id ? 'bold' : 'normal')."'" + ." class='repclass_link' id='".'class'.$class_id."'" + ."$acc[1]>$acc[0]
"; + + $style = $class_id==$_REQUEST['Class'] ? '' : "style='display:none'"; $st_reports .= "\n"; foreach($this->ar_reports[$class_id] as $rep_id => $report) { $acc = access_string($report->name); - $st_reports .= "
" . _("Reports For Class: ") . " $name
id'" - ." id='".default_focus()."'" + $st_reports .= "
id'" + ." style='font-weight:". (@$_GET['rep_id'] == $report->id ? 'bold' : 'normal')."'" + ." id='".$id = default_focus()."'" ."$acc[1]>$acc[0]
\n"; + + if (@$_REQUEST['rep_id'] == $report->id) { + $Ajax->activate($id); + } + if (isset($_REQUEST['rep_id']) && $_REQUEST['rep_id']==$report->id) { $action = $path_to_root.'/reporting/prn_redirect.php'; @@ -96,28 +107,7 @@ class BoxReports $st_params = "
". "$st_params
"; - - $st = " - "; - $st .= ""; + $st = "
"; $st .= ""; $st .= ""; $st .= ""; diff --git a/reporting/reports_main.php b/reporting/reports_main.php index 635505c3..718484a0 100644 --- a/reporting/reports_main.php +++ b/reporting/reports_main.php @@ -20,6 +20,9 @@ include_once($path_to_root . "/reporting/includes/reports_classes.inc"); $js = ""; if ($use_date_picker) $js .= get_js_date_picker(); + +add_js_file('reports.js'); + page(_($help_context = "Reports and Analysis"), false, false, "", $js); $reports = new BoxReports; @@ -390,13 +393,6 @@ $reports->addReport(RC_GL, 710, _('Audit Trail'), add_custom_reports($reports); -echo " -"; echo $reports->getDisplay(); end_page();
$st_classes$st_reports$st_params