<!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; ">&nbsp;</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; ">&nbsp;</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(&quot;dom:loaded&quot;, 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; ">&nbsp;</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;">&lt;form method=&quot;get&quot; accept-charset=&quot;utf-8&quot; ... style=&quot;display:inline&quot;&gt; ... &lt;form&gt;</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;">&lt;epc:pin ref=&quot;dyn_search_form&quot;/&gt;</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; ">&nbsp;</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-&gt;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-&gt;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-&gt;make_element(&quot;form&quot;,method=&gt;&quot;get&quot;,&quot;accept-charset&quot;=&gt;&quot;utf-8&quot;, action=&gt;&quot;/search&quot;, style=&gt;&quot;display:inline&quot;);</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-&gt;make_element(&quot;input&quot;, class=&gt;&quot;ep_tm_searchbarbox&quot;, size=&gt;&quot;20&quot;, type=&gt;&quot;text&quot;, name=&gt;&quot;q&quot;);</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-&gt;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-&gt;make_element(&quot;input&quot;,class=&gt;&quot;ep_tm_searchbarbutton&quot;, value=&gt;$repo-&gt;phrase('lib/searchexpression:action_search'), type=&gt;&quot;submit&quot;, name=&gt;&quot;_action_search&quot;);</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-&gt;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-&gt;make_element(&quot;input&quot;,type=&gt;&quot;hidden&quot;, name=&gt;&quot;_action_search&quot;, value=&gt;&quot;Search&quot;);</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-&gt;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-&gt;make_element(&quot;input&quot;,type=&gt;&quot;hidden&quot;, name=&gt;&quot;_order&quot;, value=&gt;&quot;bytitle&quot;);</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-&gt;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-&gt;make_element(&quot;input&quot;,type=&gt;&quot;hidden&quot;, name=&gt;&quot;basic_srchtype&quot;, value=&gt;&quot;ALL&quot;);</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-&gt;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-&gt;make_element(&quot;input&quot;,type=&gt;&quot;hidden&quot;, name=&gt;&quot;_satisfyall&quot;, value=&gt;&quot;ALL&quot;);</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-&gt;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-&gt;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-&gt;{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-&gt;appendChild( $pins-&gt;{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-&gt;{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-&gt;{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; ">&nbsp;</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; ">&nbsp;</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-&gt;{current_user} = $state-&gt;{session}-&gt;current_user;</span><br /><span style=" font-family:'sans-serif'; font-size:small;">$state-&gt;{current_lang} = [$state-&gt;{session}-&gt;get_langid, &quot;STRING&quot; ];</span><br /><span style=" font-family:'sans-serif'; font-size:small;">$state-&gt;{current_url} = [$state-&gt;{session}-&gt;current_url, &quot;STRING&quot; ];</span><br /><br /><span style=" font-family:'sans-serif'; font-size:small;">Works fine within a templates &lt;epc...&gt;-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) &lt;eprints-tech@ecs.soton.ac.uk&gt;</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 &lt;epc:if...&gt; 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>