<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Hi Jens,</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">I think you can try in 2 ways:</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-weight:600;">The first, (very simple)</span> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">you can add this js script in <span style=" font-weight:600;">cfg/static/javascript/auto/z_hidden_something.js</span>:</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;">document.observe("dom:loaded", function() {</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> if (window.location.href.indexOf('cgi/search') != -1 ) {</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $$('.ep_tm_header .ep_tm_searchbar td form').each(function(name,index) {name.hide();})</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> }</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;">});</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-weight:600;">The second ways:</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">A) In the template replace the <span style=" font-style:italic;"><form method="get" accept-charset="utf-8" ... style="display:inline"> ... <form></span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Con il nuovo pin <span style=" font-weight:600;"><epc:pin ref="dyn_search_form"/></span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">B) Then in <span style=" font-weight:600;">cfg/cfg.d/</span> add the <span style=" font-weight:600;">script z_dinamic_serch_form.pl</span> with this content:</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;">$c->add_trigger( EP_TRIGGER_DYNAMIC_TEMPLATE, sub {</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> my %params = @_;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> my $repo = $params{repository};</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> my $pins = $params{pins};</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> my $searchform = $repo->make_doc_fragment;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> my $form=$repo->make_element("form",method=>"get","accept-charset"=>"utf-8", action=>"/search", style=>"display:inline");</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $searchformappendChild($form);</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> my $input=$repo->make_element("input", class=>"ep_tm_searchbarbox", size=>"20", type=>"text", name=>"q");</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $form->appendChild($input);</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $input=$repo->make_element("input",class=>"ep_tm_searchbarbutton", value=>$repo->phrase('lib/searchexpression:action_search'), type=>"submit", name=>"_action_search");</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $form->appendChild($input);</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $input=$repo->make_element("input",type=>"hidden", name=>"_action_search", value=>"Search");</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $form->appendChild($input);</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $input=$repo->make_element("input",type=>"hidden", name=>"_order", value=>"bytitle");</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $form->appendChild($input);</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $input=$repo->make_element("input",type=>"hidden", name=>"basic_srchtype", value=>"ALL");</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $form->appendChild($input);</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $input=$repo->make_element("input",type=>"hidden", name=>"_satisfyall", value=>"ALL");</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $form->appendChild($input);</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> if ( $repo->current_url() !~/\/cgi\/search/ ) {</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> if( defined $pins->{dyn_search_form} ) {</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $searchform->appendChild( $pins->{dyn_search_form} );</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $pins->{dyn_search_form} = $searchform;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> }</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> else {</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> $pins->{dyn_search_form} = $searchform;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> }</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> }</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;"> return EP_TRIGGER_OK;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-size:0.75em; font-style:italic;">});</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">C) then restart Apache web server.</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">hope I have not made mistake, I did not do any testing</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">In data mercoledì 13 luglio 2016 12:58:18 CEST, jens.vieler@id.uzh.ch ha scritto:<br /></p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'sans-serif'; font-size:small;">Again,</span><br /><br /><span style=" font-family:'sans-serif'; font-size:small;">how to find out, which ist the current URL of a page?</span><br /><br /><span style=" font-family:'sans-serif'; font-size:small;">We found out, that perl_lib/EPrints/Script.pm supports current_user and current_lang, but why there is no current_url?</span><br /><br /><span style=" font-family:'sans-serif'; font-size:small;">Line 86:</span><br /><span style=" font-family:'sans-serif'; font-size:small;">$state->{current_user} = $state->{session}->current_user;</span><br /><span style=" font-family:'sans-serif'; font-size:small;">$state->{current_lang} = [$state->{session}->get_langid, "STRING" ];</span><br /><span style=" font-family:'sans-serif'; font-size:small;">$state->{current_url} = [$state->{session}->current_url, "STRING" ];</span><br /><br /><span style=" font-family:'sans-serif'; font-size:small;">Works fine within a templates <epc...>-statement!</span><br /><br /><span style=" font-family:'sans-serif'; font-size:small;">Are there alternatives?<br />Cheers</span><br /><span style=" font-family:'sans-serif'; font-size:small;"> Jens</span><br /><br /><span style=" font-family:'sans-serif'; font-size:small;">-- <br />Jens Vieler<br />Informatikdienste<br />Universität Zürich<br />Stampfenbachstrasse 73<br />CH-8006 Zürich<br /><br />mail: jens.vieler@id.uzh.ch<br />phone: +41 44 63 56777<br /></span><a href="http://www.id.uzh.ch"><span style=" font-family:'sans-serif'; font-size:small; text-decoration: underline; color:#2980b9;">http://www.id.uzh.ch</span></a><br /><br /><img src="cid:1371041111@KDE" width="16" height="16" /><span style=" font-family:'sans-serif'; font-size:small; color:#424282;">jens.vieler---12.07.2016 15:49:26---Dear List, i want to show (or not) content, ruled by a template, depending on the</span><br /><br /><span style=" font-family:'sans-serif'; color:#5f5f5f;">Von: </span><span style=" font-family:'sans-serif';">jens.vieler@id.uzh.ch</span><br /><span style=" font-family:'sans-serif'; color:#5f5f5f;">An: </span><span style=" font-family:'sans-serif';">(eprints-tech@ecs.soton.ac.uk) <eprints-tech@ecs.soton.ac.uk></span><br /><span style=" font-family:'sans-serif'; color:#5f5f5f;">Datum: </span><span style=" font-family:'sans-serif';">12.07.2016 15:49</span><br /><span style=" font-family:'sans-serif'; color:#5f5f5f;">Betreff: </span><span style=" font-family:'sans-serif';">[EP-tech] Template action depending on a documents URL</span><br /><span style=" font-family:'sans-serif'; color:#5f5f5f;">Gesendet von: </span><span style=" font-family:'sans-serif';">eprints-tech-bounces@ecs.soton.ac.uk</span><br /></p>
<hr width="100%"/>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br /><br /><br /><span style=" font-family:'sans-serif'; font-size:small;">Dear List,</span><span style=" font-family:'serif'; font-size:medium;"><br /></span><span style=" font-family:'sans-serif'; font-size:small;"><br />i want to show (or not) content, ruled by a template, depending on the documents URL. Specific problem: the default template is serving a search<br />input field, which doesn't make sense for the search itself. So i want to exclude this form if i am already inside simple od advanced search.</span><span style=" font-family:'serif'; font-size:medium;"><br /></span><span style=" font-family:'sans-serif'; font-size:small;"><br />Does anybody could give me a 3-line code example of howto deal with <epc:if...> in context with the url of a document?</span><span style=" font-family:'serif'; font-size:medium;"><br /></span><span style=" font-family:'sans-serif'; font-size:small;"><br />Best regards<br />Jens</span><span style=" font-family:'serif'; font-size:medium;"><br /></span><span style=" font-family:'sans-serif'; font-size:small;"><br />-- <br />Jens Vieler<br />Informatikdienste<br />Universität Zürich<br />Stampfenbachstrasse 73<br />CH-8006 Zürich<br /><br />mail: jens.vieler@id.uzh.ch<br />phone: +41 44 63 56777</span><span style=" font-family:'sans-serif'; font-size:small; text-decoration: underline; color:#0000ff;"><br /></span><a href="http://www.id.uzh.ch/"><span style=" font-family:'sans-serif'; font-size:small; text-decoration: underline; color:#0000ff;">http://www.id.uzh.ch</span></a><span style=" font-family:'Courier New,courier'; font-size:small;">*** Options: </span><a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech"><span style=" font-family:'Courier New,courier'; font-size:small; text-decoration: underline; color:#2980b9;">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</span></a><span style=" font-family:'Courier New,courier'; font-size:small;"><br />*** Archive: </span><a href="http://www.eprints.org/tech.php/"><span style=" font-family:'Courier New,courier'; font-size:small; text-decoration: underline; color:#2980b9;">http://www.eprints.org/tech.php/</span></a><span style=" font-family:'Courier New,courier'; font-size:small;"><br />*** EPrints community wiki: </span><a href="http://wiki.eprints.org/"><span style=" font-family:'Courier New,courier'; font-size:small; text-decoration: underline; color:#2980b9;">http://wiki.eprints.org/</span></a><span style=" font-family:'Courier New,courier'; font-size:small;"><br />*** EPrints developers Forum: </span><a href="http://forum.eprints.org/"><span style=" font-family:'Courier New,courier'; font-size:small; text-decoration: underline; color:#2980b9;">http://forum.eprints.org/</span></a><span style=" font-family:'Courier New,courier'; font-size:small;"><br /></span><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br /><br /></p></body></html>