$ -> 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.
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;
--- /dev/null
+/**********************************************************************
+ 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 <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+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
for(var i=0; i<neighbours.length; i++) {
var e = neighbours[i];
var p = element_pos(e);
- if (p!=null && (e.className=='menu_option' || e.className=='printlink')) {
+ if (p!=null && (e.className=='menu_option' || e.className=='printlink'
+ || e.className == 'repclass_link' || e.className == 'repopts_link')) {
if (((dir==40) && (p.y>p0.y)) || (dir==38 && (p.y<p0.y))
|| ((dir==37) && (p.x<p0.x)) || ((dir==39 && (p.x>p0.x)))) {
var l1 = (p.y-p0.y)*(p.y-p0.y)+(p.x-p0.x)*(p.x-p0.x);
$st_reports = "";
$st_params = "";
$st_classes = "<b>" . _("Report Classes:") . "</b><br>";
+
+ 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 .= "<a href='"
.$_SERVER['PHP_SELF']."?Class=$class_id'"
- ." class='menu_option' id='".default_focus()."'"
- ." onclick='return showClass(\"$class_id\");'$acc[1]>$acc[0]</a> <br>";
+ ." style='font-weight:". ($_REQUEST['Class'] == $class_id ? 'bold' : 'normal')."'"
+ ." class='repclass_link' id='".'class'.$class_id."'"
+ ."$acc[1]>$acc[0]</a> <br>";
+
+ $style = $class_id==$_REQUEST['Class'] ? '' : "style='display:none'";
$st_reports .= "<table class='repclass' id='TAB_" . $class_id ."' $style cellpadding=0 cellspacing=0 border=0 width='100%'><tr><td><b>" . _("Reports For Class: ") . " $name</b></td></tr>\n";
foreach($this->ar_reports[$class_id] as $rep_id => $report)
{
$acc = access_string($report->name);
- $st_reports .= "<tr><td><a class='printlink' href='"
- .$_SERVER['PHP_SELF']."?Class=$class_id&rep_id=$report->id'"
- ." id='".default_focus()."'"
+ $st_reports .= "<tr><td><a class='repopts_link'"
+ ." href='".$_SERVER['PHP_SELF']."?Class=$class_id&rep_id=$report->id'"
+ ." style='font-weight:". (@$_GET['rep_id'] == $report->id ? 'bold' : 'normal')."'"
+ ." id='".$id = default_focus()."'"
."$acc[1]>$acc[0]</a><tr><td>\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';
$st_params = "<div id='rep_form'>".
"$st_params</div>";
-
- $st = "<script language='javascript'>
- 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\";
- }
- document.getElementById('rep_form').innerHTML = '';
-// document.getElementById('rep_form').style.display = 'none';
- return false;
- }
- function checkDate(pObj) {
- var re = /^(3[01]|0[1-9]|[12]\d)\/(0[1-9]|1[012])\/\d{4}/;
- if (re.test(pObj.value)==false) {
- alert('" . _("Invalid date format") . "')
- }
- }
- </script>
- ";
- $st .= "<table align='center' width='80%' style='border:1px solid #cccccc;'><tr valign='top'>";
+ $st = "<table align='center' width='80%' style='border:1px solid #cccccc;'><tr valign='top'>";
$st .= "<td width='30%'>$st_classes</td>";
$st .= "<td width='35%' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc;padding-left:3px;'>$st_reports</td>";
$st .= "<td width='35%'>$st_params</td>";
$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;
add_custom_reports($reports);
-echo "<script language='javascript'>
- function onWindowLoad() {
- showClass(" . $_GET['Class'] . ")
- }
- Behaviour.addLoadEvent(onWindowLoad);
- </script>
-";
echo $reports->getDisplay();
end_page();