Open-AudIT

What's on your network?
It is currently Wed Jan 17, 2018 9:29 pm

All times are UTC + 10 hours




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Disk Graphs
PostPosted: Thu Jun 23, 2011 5:45 am 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 179
Location: Massachusetts
OAv2 Beta 1.1: I have noticed that the disk graphs don't show up in IE8, but they work fine with Google Chrome.

With IE8 I get the following error

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.3; .NET4.0E; MS-RTC LM 8; AskTbFXTV5/5.9.1.14019)
Timestamp: Wed, 22 Jun 2011 19:28:43 UTC

Message: 'window.G_vmlCanvasManager' is null or not an object
Line: 1249
Char: 13
Code: 0
URI: http://localhost/theme-tango/tango-file ... .jqplot.js

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Thu Jun 23, 2011 7:55 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1223
Interesting. I get nothing when I view the graphs with IE 9. If I use the F12 Developer Tools to change the User Agent String to Firefox or Chrome it works fine. If I try IE8 or IE7 modes all of OAv2 is messed up.


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Thu Jun 23, 2011 10:15 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 07, 2004 11:48 am
Posts: 1933
Location: Brisbane, Australia
I have IE8 (I think) at work - I'll try and check this tomorrow.

_________________
Support and Development hours available from Opmantek.
Please consider a purchase to help make Open-AudIT better for everyone.


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Fri Jun 24, 2011 12:46 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 07, 2004 11:48 am
Posts: 1933
Location: Brisbane, Australia
OK, so I fired up IE8.
As long as you are using the actual IE8 (browser / document) mode, page's display fine.
My browser had defaulted to another mode (not sure which - I don't really care) and wouldn't display the left side menu. It was very broken. Pressed F12 and checked the mode(s) - reset them and all fine.
HOWEVER - disk graphs do not seem to appear. :-(
Will see what I can do before beta2 is released.

_________________
Support and Development hours available from Opmantek.
Please consider a purchase to help make Open-AudIT better for everyone.


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Fri Jun 24, 2011 1:09 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 07, 2004 11:48 am
Posts: 1933
Location: Brisbane, Australia
OK, so I've made some progress.
It's a bit weird...
There were a couple of errors - fixed them, fine.
Now, when viewing the source in IE8, I get the following output
Code:
line1 = ];

In firefox I get the following output
Code:
line1 = [['2011-06-10', 87], ['2011-06-12', 87], ['2011-06-13', 87], ['2011-06-14', 87], ['2011-06-15', 87], ['2011-06-16', 87], ['2011-06-17', 87], ['2011-06-18', 87], ['2011-06-19', 87], ['2011-06-20', 87], ['2011-06-21', 87], ['2011-06-22', 87], ['2011-06-23', 87], ['2011-06-24', 87]];

Obviously this code is the javascript (inside v_partition_graph.php) that generate's the graph line.
The actual code from v_partition_graph is
Code:
$line1 = "[";
foreach ($query as $partition)
{
   $line1 .= "['" . $partition->timestamp . "', " . $partition->percent_used . "], ";
}
$line1 = substr($line1, 0, (strlen($line1) - 2));
$line1 = $line1 . "];";

foreach ($partition_details as $partition)
{
   $graph_title = str_replace("\\", "\\\\", $partition->partition_mount_point) . " (" . $partition->partition_mount_type . ")";
}
...
some other lines
...
line1 = <?php echo $line1 . "\n"; ?>

If anyone has any idea why IE would not be generating / accepting / reformatting / whatever else, the generated code, feel free to comment. Any help or pointers appreciated.

For what it's worth - if I paste the generated code from firefox into v_partition_graph, the graph does display in IE8. Obviously this is then hardcoded for that exact server - but it proves it will render correctly if I can get it there in the first place... grrrr.

_________________
Support and Development hours available from Opmantek.
Please consider a purchase to help make Open-AudIT better for everyone.


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Fri Jun 24, 2011 2:04 pm 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1223
When I looked at it I saw you get $line = ]; because $query is empty. I didn't attempt to track down what would cause that. Where does $query come from?


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Fri Jun 24, 2011 2:05 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 07, 2004 11:48 am
Posts: 1933
Location: Brisbane, Australia
UPDATE

It seem's the entire code block below is not being executed when the page is served to IE. WTH ? The PHP output (the javascript variables) are not appearing in the source of a page viewed in IE. They are being displayed when the source of a Firefox page is being viewed. Very weird. The page in question is v_partition_graph.php.

Any idea's or help much appreciated.

Code:
<?php
$line1 = "[";

foreach ($query as $partition)
{
   $line1 .= "['" . $partition->timestamp . "', " . $partition->percent_used . "], ";
}

$line1 = mb_substr($line1, 0, (mb_strlen($line1) - 2));
$line1 = $line1 . "];";

foreach ($partition_details as $partition) {
   $graph_title = str_replace("\\", "\\\\", $partition->partition_mount_point) . " (" . $partition->partition_mount_type . ")";
}
?>

_________________
Support and Development hours available from Opmantek.
Please consider a purchase to help make Open-AudIT better for everyone.


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Fri Jun 24, 2011 2:09 pm 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1223
I'm pretty sure the code is executed but the $query is empty and so it breaks. Where does $query come from?


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Fri Jun 24, 2011 2:33 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 07, 2004 11:48 am
Posts: 1933
Location: Brisbane, Australia
Quote:
Where does $query come from?


Controller "main", Function "disk_graph" calls Model "m_partition", Function "get_partition_graph".
That returns the data to main which then calls the view "v_partition_graph".

What's weird is that is works for Firefox. By my reasoning, it should be working for IE or any other browser. This is all calculated THEN sent to the browser. The browser just receives the data. Why the PHP code in v_partition_graph is not being executed when being called by IE is a complete mystery to me.
Even dumping in a "print_r($query);" into v_partition_graphs reports that $query is an empty array. How can this be when it is a data filled array when viewed in Firefox.

Call me stumped... :cry:

_________________
Support and Development hours available from Opmantek.
Please consider a purchase to help make Open-AudIT better for everyone.


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Fri Jun 24, 2011 5:37 pm 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1223
I tested a bit and sometimes when switching modes in IE the partition_id value would get set to 0 rather than the proper value and $query would then be empty because it's not finding any data. I think this is because of weird caching issues with IE.

After messing with it a bit I decided to go a bit lower in the chain. I replaced jqplot with the latest from the devel site and added the excanvas.js for IE less than 9. The graphs are now displayed with IE 9 in it's various modes as long as I have made sure that I'm not affected by the caching problem noted above and IE doesn't have any data to graph.


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Sat Jun 25, 2011 1:22 am 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 179
Location: Massachusetts
After searching the error for a while, I found references to including a "excanvas".

Looking in the jquery.jqplot.js file, I found this info which I think could be the key:

About: Introduction
*
* jqPlot requires jQuery (1.4+ required for certain features). jQuery 1.4.1 is included in the distribution.
* To use jqPlot include jQuery, the jqPlot jQuery plugin, the jqPlot css file and optionally
* the excanvas script for IE support in your web page:
*
* > <!--[if IE]><script language="javascript" type="text/javascript" src="excanvas.js"></script><![endif]-->
* > <script language="javascript" type="text/javascript" src="jquery-1.4.2.min.js"></script>
* > <script language="javascript" type="text/javascript" src="jquery.jqplot.min.js"></script>
* > <link rel="stylesheet" type="text/css" href="jquery.jqplot.css" />

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Sat Jun 25, 2011 1:54 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1223
I tried including the excanvas.js that was already in the OA distribution. That didn't work until I also updated the jqplot code to the latest. I think it should be "<!--[if lt IE 9]>" as well.


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Tue Jun 28, 2011 5:07 am 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 179
Location: Massachusetts
Sorry for my ignorance but which file should I put this <!--[if lt IE 9]> code into?

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Tue Jun 28, 2011 6:21 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1223
Yeah, I don't really explain things 'cause I'm lazy. Sorry.

So this is what I did.
Downloaded the latest jqplot.
Extracted archive.
Renamed dist directory to jqplot.
Replaced OAv2\www\theme-tango\tango-files\jquery\js\jqplot with new jqplot.
Added excanvas call to OAv2\code_igniter\system\application\views\theme-tango\v_partition_graph.php.

Tested the disk usage graphing which seems to work. Or not if you do the same and it doesn't work. Didn't test anything else so the above steps could break all kinds of other things. That's for Mark to fix. :lol:

v_partition_graph.php
Code:

<!--[if lt IE 9]><script src="<?php echo base_url() . 'theme-' . $user_theme . '/' . $user_theme . '-files/jquery/js/jqplot/excanvas.min.js'; ?>" type="text/javascript"></script><![endif]-->
<script src="<?php echo base_url() . 'theme-' . $user_theme . '/' . $user_theme . '-files/jquery/js/jqplot/jquery.jqplot.js'; ?>" type="text/javascript"></script>
<script src="<?php echo base_url() . 'theme-' . $user_theme . '/' . $user_theme . '-files/jquery/js/jqplot/plugins/jqplot.logAxisRenderer.js'; ?>" type="text/javascript"></script>
<script src="<?php echo base_url() . 'theme-' . $user_theme . '/' . $user_theme . '-files/jquery/js/jqplot/plugins/jqplot.canvasTextRenderer.js'; ?>" type="text/javascript"></script>
<script src="<?php echo base_url() . 'theme-' . $user_theme . '/' . $user_theme . '-files/jquery/js/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js'; ?>" type="text/javascript"></script>
<script src="<?php echo base_url() . 'theme-' . $user_theme . '/' . $user_theme . '-files/jquery/js/jqplot/plugins/jqplot.canvasAxisTickRenderer.js'; ?>" type="text/javascript"></script>
<script src="<?php echo base_url() . 'theme-' . $user_theme . '/' . $user_theme . '-files/jquery/js/jqplot/plugins/jqplot.dateAxisRenderer.js'; ?>" type="text/javascript"></script>
<script src="<?php echo base_url() . 'theme-' . $user_theme . '/' . $user_theme . '-files/jquery/js/jqplot/plugins/jqplot.categoryAxisRenderer.js'; ?>" type="text/javascript"></script>
<script src="<?php echo base_url() . 'theme-' . $user_theme . '/' . $user_theme . '-files/jquery/js/jqplot/plugins/jqplot.barRenderer.js'; ?>" type="text/javascript"></script>
<script src="<?php echo base_url() . 'theme-' . $user_theme . '/' . $user_theme . '-files/jquery/js/jqplot/plugins/jqplot.trendline.min.js'; ?>" type="text/javascript"></script>

<script src="<?php echo base_url() . 'theme-' . $user_theme . '/' . $user_theme . '-files/jquery/js/jqplot/plugins/jqplot.highlighter.min.js'; ?>" type="text/javascript"></script>
<script src="<?php echo base_url() . 'theme-' . $user_theme . '/' . $user_theme . '-files/jquery/js/jqplot/plugins/jqplot.cursor.min.js'; ?>" type="text/javascript"></script>

<?php

#echo "<pre>\n";
#print_r($query);
#echo "</pre>\n";

$line1 = "[";
foreach ($query as $partition)
{
   $line1 .= "['" . $partition->timestamp . "', " . $partition->percent_used . "], ";
}
$line1 = substr($line1, 0, (strlen($line1) - 2));
$line1 .= "];";

foreach ($partition_details as $partition)
{
   $graph_title = str_replace("\\", "\\\\", $partition->partition_mount_point) . " (" . $partition->partition_mount_type . ")";
}
?>

<script type="text/javascript" language="javascript">
$(document).ready(function(){

   $.jqplot.config.enablePlugins = true;
   line1 = <?php echo $line1 . "\n"; ?>
   plot1 = $.jqplot('chart1', [line1], {
      title:'<?php echo $graph_title; ?>',
      legend: {show:false},
      axesDefaults: {
         tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
         tickOptions: {
            angle: -45,
            fontSize: '10pt'
         }
      },
      axes:{
         xaxis:{
            autoscale: true,
            renderer:$.jqplot.DateAxisRenderer,
            tickInterval:'1 day'
         },
         yaxis:{
            min:0,
            max:100,
            tickOptions:{formatString:'%% %.2i'}
         }
      },
      highlighter: {sizeAdjust: 7.5},
      cursor: {show: false}
   });

});
</script>


<br /><br /><br /><br /><br /><br />
<div class="jqplot" id="chart1"></div>



   


Top
 Profile  
Reply with quote  
 Post subject: Re: Disk Graphs
PostPosted: Wed Jun 29, 2011 12:33 am 
Offline
Contributor
User avatar

Joined: Thu Mar 02, 2006 4:41 am
Posts: 179
Location: Massachusetts
Perfect... Works for me too. Thanks alot, jpa

_________________
Server Info: running on a CentOS 7 vm
OA Version: 2.0.6 @ 500 devices


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group