EPrints Technical Mailing List Archive

Message: #03642


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

[EP-tech] Re: Antwort: inserting irstats on abstract/detail page


Add this:

   $page->appendChild( $session->make_element( "a", name => "stat" ) );
   my $irstats = $session->make_element( "div", class=>"ep_block_left");
my $irstatsLastMonthLink = "/irstats.cgi?page=last_month&set=eprint_" . $eprint->get_value( "eprintid" ); my $irstatsLastMonthImg = $session->make_element( "img", src=>$irstatsLastMonthLink ); my $irstatsLastYearLink = "/irstats.cgi?page=last_year&set=eprint_" . $eprint->get_value( "eprintid" ); my $irstatsLastYearImg = $session->make_element( "img", src=>$irstatsLastYearLink );
   $irstats->appendChild( $session->html_phrase(
             "page:irstats",
             img_last_month => $irstatsLastMonthImg,
             img_last_year => $irstatsLastYearImg ) );
   $page->appendChild( $irstats );

with


    <epp:phrase id="page:irstats"><h2>Download statistics</h2>

in phrases

these are 2 images, generated by irstats cgi, one last month an one last year, for the current eprint.

Basically, use $eprint->get_value( "eprintid" ) to get the eprint id, for the link, go to /irstats.cgi and play around to find urls and parameters.

Plus, this code adds an anchor #stat so you can link or go directly to stats (it is handy to have such a link at the begin of the abstract, expecially when the eprint abstract is very long).

Il 05/12/2014 05:11, Ajunk Pracetio ha scritto:
I already open archives/{repo}/cfg/cfg.d/eprint_render.pl <http://eprint_render.pl> and at bottom page, there is a code like this :
 # IRSTATS CODE STARTS HERE
if ($repository->get_repository->can_call('irstats_abstract_content'))
                {
$page->appendChild($repository->get_repository->call('irstats_abstract_content', $repository, $eprint));
                }
                # END IRSTATS

But, when I removed the # and run generate, there nothing graph except text "Document Downloads".
Is it okay if I insert this script at that line :
<div id="mytable" class="irstats_table"/>

<script type="text/javascript">
document.observe( "dom:loaded", function() {

         new EPJS_Stats_Table( {
                 'context': { 'datatype': 'downloads' },
                 'options': { 'container_id': 'mytable', 'top': 'eprint', 'view': 'Table', 'limit': '5' }
         } );

});
</script>

I'm don't know about perl :(

Any help very appreciate.

Thank you
Best regards
Agung


On Fri, Nov 28, 2014 at 1:41 PM, <martin.braendle@id.uzh.ch <mailto:martin.braendle@id.uzh.ch>> wrote:

    Hi,

    the abstract/detail page is rendered by
    archives/{repo}/cfg/cfg.d/eprint_render.pl <http://eprint_render.pl>

    http://eprints.github.io/irstats2/api.html describes the functions
    to obtain statistics data and gives some examples.

    Best regards,

    Martin

    --
    Dr. Martin Brändle
    Zentrale Informatik
    Universität Zürich
    Winterthurerstr. 190
    CH-8057 Zürich

    mail: martin.braendle@id.uzh.ch <mailto:martin.braendle@id.uzh.ch>
    phone: +41 44 63 56705
    fax: +41 44 63 54505
    http://www.id.uzh.ch

    Inactive hide details for Ajunk Pracetio ---28/11/2014
    04:43:23---Hi, I'd like to insert irstats on abstract/detail page.
    Is thAjunk Pracetio ---28/11/2014 04:43:23---Hi, I'd like to
    insert irstats on abstract/detail page. Is there any guide hoq

    Von: Ajunk Pracetio <prazetyo@gmail.com <mailto:prazetyo@gmail.com>>
    An: "eprints-tech@ecs.soton.ac.uk
    <mailto:eprints-tech@ecs.soton.ac.uk>"
    <eprints-tech@ecs.soton.ac.uk <mailto:eprints-tech@ecs.soton.ac.uk>>
    Datum: 28/11/2014 04:43
    Betreff: [EP-tech]  inserting irstats on abstract/detail page
    Gesendet von: eprints-tech-bounces@ecs.soton.ac.uk
    <mailto:eprints-tech-bounces@ecs.soton.ac.uk>

    ------------------------------------------------------------------------



    Hi,

    I'd like to insert irstats on abstract/detail page. Is there any
    guide hoq to make it?

    Thank you

    Best Regards,
    Agung P.W

-- Life isn't valuable if you don't have someone to care*** Options:
    http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
    *** Archive: http://www.eprints.org/tech.php/
    *** EPrints community wiki: http://wiki.eprints.org/
    *** EPrints developers Forum: http://forum.eprints.org/


    *** Options:
    http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
    *** Archive: http://www.eprints.org/tech.php/
    *** EPrints community wiki: http://wiki.eprints.org/
    *** EPrints developers Forum: http://forum.eprints.org/




--
Life isn't valuable if you don't have someone to care


*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/