[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] How to find out, which ist the current URL of a page?



Hi Jens,

I think you can try in 2 ways:
*The first, (very simple)* 
you can add this js script in *cfg/static/javascript/auto/z_hidden_something.js*:

/document.observe("dom:loaded", function() {/
/        if (window.location.href.indexOf('cgi/search') != -1 ) {/
/                $$('.ep_tm_header .ep_tm_searchbar td form').each(function(name,index) {name.hide();})/
/        }/
/});/

*The second ways:*
A) In the template replace the /<form method="get" accept-charset="utf-8" ... style="display:inline"> ... <form>/
Con il nuovo pin *<epc:pin ref="dyn_search_form"/>*
B) Then in *cfg/cfg.d/* add the *script z_dinamic_serch_form.pl* with this content:

/$c->add_trigger( EP_TRIGGER_DYNAMIC_TEMPLATE, sub {/
/        my %params = @_;/
/        my $repo = $params{repository};/
/        my $pins = $params{pins};/
/        my $searchform = $repo->make_doc_fragment;/
/        my $form=$repo->make_element("form",method=>"get","accept-charset"=>"utf-8", action=>"/search", style=>"display:inline");/
/        $searchformappendChild($form);/
/        my $input=$repo->make_element("input", class=>"ep_tm_searchbarbox", size=>"20", type=>"text", name=>"q");/
/        $form->appendChild($input);/
/        $input=$repo->make_element("input",class=>"ep_tm_searchbarbutton", value=>$repo->phrase('lib/searchexpression:action_search'), type=>"submit", name=>"_action_search");/
/        $form->appendChild($input);/
/        $input=$repo->make_element("input",type=>"hidden", name=>"_action_search", value=>"Search");/
/        $form->appendChild($input);/
/        $input=$repo->make_element("input",type=>"hidden", name=>"_order", value=>"bytitle");/
/        $form->appendChild($input);/
/        $input=$repo->make_element("input",type=>"hidden", name=>"basic_srchtype", value=>"ALL");/
/        $form->appendChild($input);/
/        $input=$repo->make_element("input",type=>"hidden", name=>"_satisfyall", value=>"ALL");/
/        $form->appendChild($input);/
/        if ( $repo->current_url() !~/\/cgi\/search/ ) {/
/                if( defined $pins->{dyn_search_form} ) {/
/                        $searchform->appendChild( $pins->{dyn_search_form} );/
/                        $pins->{dyn_search_form} = $searchform;/
/                }/
/                else {/
/                        $pins->{dyn_search_form} = $searchform;/
/                }/
/        }/
/        return EP_TRIGGER_OK;/
/});/
C) then restart Apache web server.

hope I have not made mistake, I did not do any testing

 
In data mercoled? 13 luglio 2016 12:58:18 CEST, jens.vieler at id.uzh.ch ha scritto:


Again,
how to find out, which ist the current URL of a page?
We found out, that perl_lib/EPrints/Script.pm supports current_user and current_lang, but why there is no current_url?
Line 86:
$state->{current_user} = $state->{session}->current_user;
$state->{current_lang} = [$state->{session}->get_langid, "STRING" ];
$state->{current_url} = [$state->{session}->current_url, "STRING" ];
Works fine within a templates <epc...>-statement!
Are there alternatives?Cheers
 Jens
-- Jens VielerInformatikdiensteUniversit?t Z?richStampfenbachstrasse 73CH-8006 Z?rich

mail:  jens.vieler at id.uzh.chphone: +41 44 63 56777

http://www.id.uzh.ch[1]
jens.vieler---12.07.2016 15:49:26---Dear List, i want to show (or not) content, ruled by a template, depending on the
Von: jens.vieler at id.uzh.ch
An: (eprints-tech at ecs.soton.ac.uk) <eprints-tech at ecs.soton.ac.uk>
Datum: 12.07.2016 15:49
Betreff: [EP-tech] Template action depending on a documents URL
Gesendet von: eprints-tech-bounces at ecs.soton.ac.uk

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

Dear List,








http://www.id.uzh.ch[2]*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech[3]
http://www.eprints.org/tech.php/[4]
http://wiki.eprints.org/[5]
http://forum.eprints.org/[6]





--------
[1] http://www.id.uzh.ch
[2] http://www.id.uzh.ch/
[3] http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
[4] http://www.eprints.org/tech.php/
[5] http://wiki.eprints.org/
[6] http://forum.eprints.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20160713/2d4e2c37/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 154 bytes
Desc: not available
Url : http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20160713/2d4e2c37/attachment-0001.png