EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #08353


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] New Issue : IRStats


Hi Laurent,

I have attached the diffs need to fix the main /cgi/stats/report graphs and the individual graphs on the abstract/summary pages for each item.  You will need to run "epadmin refresh_abstracts" once you have made the changes and reloaded your webserver so that each page is updated with the new Javascript code.  I would recommend manually applying the changes rather than trying to use as a patch file, as I have really just copied and pasted the changes for a couple of different changesets and these are changes may have been made to a different version of these files than the ones you have installed on your repository.

Regards

David Newman

On 23/10/2020 14:25, Laurent Cloarec wrote:
CAUTION: This e-mail originated outside the University of Southampton.

Hi

All my apologizes for the previous post, proceeding from a too fast copy and paste.

I sent almost at same time a support request to "EPrints Services" (and Justin experienced delays in receiving it, because of issues with mail servers) and a post to this list, because I figured out that it was not only a problem with our repository, but also with others repositories using "IRStats2"... And I was far too much in hurry while posting to the list, so I didn't take time enough to "clean" the content from its references to Southampton colleagues : sorry again
for all this.

And thank you for the "fix", but I confirm that the mail format is quite
"messy", both in the list archive and through the email client view...

Best regards
--
Laurent Cloarec
Service Commun de la Documentation - Service du Numérique Documentaire
Université Toulouse 1 Capitole



Le 23/10/2020 à 12:01, David R Newman a écrit :
Hi Laurent,

I don't know if Justin is being slow to respond so you felt driven to use the tech list but this is not really appropriate for contacting EPrints Services.

There is a fix for the problem you report.  I have actually posted this on the tech list recently.  I don't know if you have just joined the list or have been
on it a while.  Here is the message on the mailing list archive:

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.eprints.org%2Feptech%2Fmsg08317.html&amp;data=04%7C01%7C%7C722672712d064e7610d808d8775aaad2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637390578642814143%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=koyRhntPzEqjlYwYOezZ3V4h2Wwywuc7li2XRb7UycY%3D&amp;reserved=0

However, this seems to have broken the formatting of the diff I copied and pasted.  So it is probably best looking at this email in your email client if
you were on the mailing list back on 8th October.

Regards

David Newman


--
This email has been checked for viruses by AVG.
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.avg.com%2F&amp;data=04%7C01%7C%7C722672712d064e7610d808d8775aaad2%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637390578642824135%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=ZedqgvokHNtaOkof%2B8kbiSOlsp542u%2BIIdQDrYAWXpc%3D&amp;reserved=0
Index: plugins/EPrints/Plugin/Stats/View/KeyFigures.pm
===================================================================
--- plugins/EPrints/Plugin/Stats/View/KeyFigures.pm     (revision 16386)
+++ plugins/EPrints/Plugin/Stats/View/KeyFigures.pm     (revision 16387)
@@ -112,9 +112,11 @@

                $frag->appendChild( $self->{session}->make_element( "div", id => $name, class => "irstats2_googlespark" ) );
         $frag->appendChild( $self->{session}->make_javascript( <<DLSPARK ) );
-document.observe("dom:loaded",function(){
-       new EPJS_Stats_GoogleSpark( { 'context': $js_context, 'options': { 'container_id': '$name' } } );
-});
+       google.setOnLoadCallback(drawGoogleSpark_$name);
+        function drawGoogleSpark_$name()
+       {
+               new EPJS_Stats_GoogleSpark( { 'context': $js_context, 'options': { 'container_id': '$name' } } );
+       }
 DLSPARK

        my $div = $frag->appendChild( $self->{session}->make_element( 'span', class => 'irstats2_keyfigures_metric' ) );

Index: plugins/EPrints/Plugin/Stats/View.pm
===================================================================
--- plugins/EPrints/Plugin/Stats/View.pm        (revision 16386)
+++ plugins/EPrints/Plugin/Stats/View.pm        (revision 16387)
@@ -122,12 +122,12 @@

        # note: when called from a Browse View, the DOM is already loaded thus the dom:loaded Event will never fire. That's why we first test that the dom's already loaded below.
         $frag->appendChild( $session->make_javascript( <<CODE ) );
-       if( document.loaded )
-         new EPJS_Stats_$js_class( { 'context': $json_context, 'options': $view_options } );
-       else
-               document.observe("dom:loaded",function(){
-                         new EPJS_Stats_$js_class( { 'context': $json_context, 'options': $view_options } );
-               });
+       google.setOnLoadCallback(drawChart_$id);
+       function drawChart_$id()
+       {
+               new EPJS_Stats_$js_class( { 'context': $json_context, 'options': $view_options } );
+
+       }
 CODE

         return $frag;
		 
Index: lang/en/phrases/irstats2.xml
===================================================================
--- lang/en/phrases/irstats2.xml        (revision 16524)
+++ lang/en/phrases/irstats2.xml        (revision 16525)
@@ -106,7 +106,8 @@
 <!--<p style="text-align:center"><a href="#" id="irstats2_summary_page:link">View more statistics</a></p>-->
 </div>
 <script type="text/javascript">
-document.observe("dom:loaded",function(){
+       google.setOnLoadCallback(drawChart_eprint_<epc:pin name='eprintid'/>);
+       function drawChart_eprint_<epc:pin name='eprintid'/>(){

                var irstats2_summary_page_eprintid = '<epc:pin name='eprintid'/>';

@@ -120,7 +121,7 @@
                        'options': {
                        'container_id': 'irstats2_summary_page_downloads', 'date_resolution':'month','graph_type':'column'
                        } } );
-               });
+       }

 </script>
 </epp:phrase>