cancel
Showing results for 
Search instead for 
Did you mean: 

How to trap the file name

Former Member
0 Kudos

Hello,

Whenever User clicks on a particular document from the Search results list....I want to store the file name in a variable...any help would be highly appreciated.

Regards

V.

Accepted Solutions (1)

Accepted Solutions (1)

detlev_beutner
Active Contributor
0 Kudos

Hi Vaib,

see - now let the link point to some AbstractPortalComponent, memorizing the file name and redirecting to KM docs component. (If this doesn't fulfill your needs, please specify the use case in detail.)

Hope it helps

Detlev

Former Member
0 Kudos

Hello Detlev,

I understood what you are trying to tell me and i think this would help me in achieving my goal also. I'll explain what i want in detail:-

-> User clicks on a Search Button

-> Display of the Search results

-> User clicks on a particular document

-> Document opens in a New Window.

Now What we are looking at:-

-> User clicks on a Search Button

-> Display of the Search results

-> User Clicks on a particular document ( will trap the location of the document and raise an event here)

-> subscribe to raised event and display the document.

Please help in achieving this

V.

detlev_beutner
Active Contributor
0 Kudos

Hi Vaib,

-> User Clicks on a particular document ( will trap the location of the document and raise an event here)

-> subscribe to raised event and display the document.

Could you elaborate this more in detail? Where should the event be subscribed? Are you thinking of EPCF?

Best regards

Detlev

Former Member
0 Kudos

Hi Detlev,

Yes exactly i'm referring to EPCF as i have used the EPCF to display the search results also in the same window. Now what i'm thinking is...When user clicks on a document at that time i'll trap the document URL and store it in the Variable. Now i'll raise an event with that Variable and then subscribe to that event.

Hope it helps....

Now my question is to how can i trap the document URL.

Vaib

detlev_beutner
Active Contributor
0 Kudos

Hi Vaib,

ok, if you implement the renderer - that is construct a link object - you have full control over it's htmlb settings, for example you can define the JavaScript to be run by onClientClick. There you can throw the EPCF event, for which you have registered before at aonther place on the page.

The resource renderer knows the resource, so you can put the name of the resource or the RID directly into the JS output. No problems so far.

Hope it helps

Detlev

PS: Please consider rewarding points for helpful answers; this also holds for the parallel thread referred to above.

Former Member
0 Kudos

Everything is fine and i understood what you are trying to tell me. The problem is i dont know how to implement the renderer as i'm not much into the Development side...that's why seeking help from you guys..if you could give me an example how can a renderer be implemented..that would be really helpful for me....

Points are guaranteed for both the threads....:)

V.

detlev_beutner
Active Contributor
0 Kudos

Hi Vaib,

just implement an AbstractPropertyRenderer, overwrite <i>public Component renderProperty(IProperty property, IResource resource, int maxlength) throws WcmException</i>. To make that work you also need a RFWrapper to add your implementation to the CrtClassLoaderRegistry.

See https://media.sdn.sap.com/html/submitted_docs/nw_kmc/ide/projects/Setting%20Up%20a%20KMC%20Project.h... for the last and https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/kmc/knowledge management and collaboration developers guide.html for some general introduction.

Hope it helps

Detlev

Former Member
0 Kudos

Hi detlev,

Thanks for all your effort and support however i found an easy method to open the document also within the Portal itself. If you goto the following location:-

System Admin -> System Config -> KM -> Content Mgmt -> User Interface -> Settings -> Resource Renderer Settings -> Resource Renderer Settings -> SearchResourceRenderer -> Look at the Property 'Target WIndow Type' and i have set this to 'Self'.

Now have a look at the follwing link:-

http://help.sap.com/saphelp_nw04/helpdata/en/50/041142e862654ca98ced1607386c9c/frameset.htm

Which clearly says that 'Target Window Type's is used to open the resource in the same window if set to 'self'.

Now unfortunately this is not working, Please help.

Vaib

detlev_beutner
Active Contributor
0 Kudos

Hi Vaib,

yeah, great, that obviously should work. Anyhow, on some resource renderer, I think I have seen a hardcoded "_blank". So if this does not work, please open a OSS message to get this clarified.

And please come back with any results from that.

Thanks in advance

Detlev

Former Member
0 Kudos

Hey Detlev,

Now that's what my problem is..because even after setting the 'Target Window Type = self' in the search results page still you can see the 'A href' targets are set to "_blank".

Now How can i determine whether it's hardcoded in the renderer, <b>is there any place where i can check whether it's hardcoded or not. If there's a Par file for this.</b>..then do let me know the Name of the par file..i'll try to modify that.

I've already created an OSS message for this and that's forwarded to the development support in germany. So i'm still waiting for the response.

Regards

Vaib

detlev_beutner
Active Contributor
0 Kudos

Hi Vaib,

> i'm still waiting for the response

First, wait for that. It doesn't make too many sense to do the search in parallel (I would do it if I wouldn't be ill at the moment and if there wouldn't be another 120 threads waiting for being read, but that's the situation, and for the high probability that it's a bug, the OSS message is the most appropriate way).

Best regards

Detlev

Former Member
0 Kudos

Hey Detlev,

I really dint know that you are ill...take care man...health is more important than the unread threads...:) Just kidding.....

Whenever you get time...please let me know where i can see the code for the resource renderers. It's really important for me....

Regards

V.

detlev_beutner
Active Contributor
0 Kudos

Hi Vaib,

> I really dint know that you are ill

You couldn't... It's just a strong cold, have had better days...

> where i can see the code for the resource renderers

Within the SearchResourceRenderer setting, check the "Resource Renderer" property, it's "ResourceRenderer" (you can click on that). This leads to the mapping of the class com.sapportals.wcm.rendering.resource.cm.ResourceRenderer. Decompile that and check the inner logic.

Hope it helps

Detlev

PS: Two threads now without one lousy point rewarded - nothing has been of help so far?!

Former Member
0 Kudos

Hi Detlev,

I'm so sorry for not giving the points on this. Bu this time i've given the full points....:)

I had a look at the Class file for the ResourceRenderer..but Now 2 questions arises:-

1. Where we can fidn this Class file (In which par file)

2. Even if we find it...how to change the code in the Class file...

Do we need to ask SAP for the new Class file or Par file...

Regards

Vaib

detlev_beutner
Active Contributor
0 Kudos

Hi Vaib,

> Where we can fidn this Class file (In which par file)

Just type "classlocator detlev" into SDN search and have a look at the first search result...

> Even if we find it...

> how to change the code in the Class file...

Before changing it, you should check it For this, use a decompiler like JAD.

If you see that it makes sense to change it, create the class in NWDS, set all necessary build pathes, do the changes, replace the original class and restart the server. For a "clean" deployment, you could also import the whole PAR, include the JARs into the import, exclude the class in question from the JARs, create the class from the original source, do the changes, and redeploy the PAR.

This has been now a very short introduction in "how to change code"... Anyhow, if one asks first "how to find the class", this indicates that one has not the experience which I would say which is needed for such tasks. No offense meant! It's just that I don't want you to run into further trouble.

As said before, I would advise to wait for the OSS message result.

Hope it helps

Detlev

Former Member
0 Kudos

Hey detlev,

No offenses..:)

Actually as i said earlier also i'm not much into the development and there's always a first time though..:)

SO you mean..in the ClassLocator i have to give the path to the location where all the PARS files are (For exapmple /pcd)..and it will locate the 'Class' file automatically.

Also, if you could tell me the download location of the 'JAD' because the link you have given, it;s not working.

Regards

Vaib

Former Member
0 Kudos

Hello Detlev,

You must be knowing the code i've written to get the Search Results in the same frame...(updated in one of the thread also..)

Now if you test that code...you will get the Search Results in the same window however your Navigation Panel will be hidden or gone...for that reason Ankur suggested me to use the EPCM.doNavigate..which would work i know..:)

Now the problem is On click of a Search button my navigation panel is there..but no search results are there.. which is a bad sign....

This is my Code in ToolArea and ContentArea:-

In ToolArea.par:-

var searchURL= "http://"location.hostname":50000""<%=url%>" QueryString;

//raising an event here

EPCM.raiseEvent('urn:myOwnNameSpace','searchResult', searchURL );

ContentArea.par:-

//Subscribing to the event in the Content Area

EPCM.subscribeEvent('urn:myOwnNameSpace','searchResult', handle_searchResult_Event);

function handle_searchResult_Event( evt )

{

self.location.href = evt.dataObject;

//Now i have added this to display the Navigation Panel

//also

EPCM.doNavigate(path to the ToolArea.ivu)

}

Now i need to know what should i pass in the doNavigate to display the Search Results with Navigation Panel.

This is been suggested by Ankur in one of my thread:-

[Do a EPCM.doNavigate to a iView passing the URL.

That iView should basically have a IFrame whose source url will be the one that you capture from the Search button.]

Hope it helps you finding the right parameter for the doNavigate method.

Regards

Vaib

detlev_beutner
Active Contributor
0 Kudos

Hi Vaib,

> there's always a first time though

Yeah, for sure, but the question is if one is not used to climb if one should start with the Mount Everest

> in the ClassLocator i have to give the path to the

> location where all the PARS files are

> (For exapmple /pcd

Yeah, you give some folder from where ClassLocator starts to index all JARs, normally you use for portal development ...\WEB-INF\portal\portalapps or a bit higher to also catch the portal runtime classes.

You can use DJ, which offers a nice GUI for JAD, the last non-commercial version is: ftp://ftp.sac.sk/pub/sac/utilprog/djdec377.zip

Hope it helps

Detlev

Former Member
0 Kudos

Hello Detlev,

SAP says that it's not possible in the current scenario...so if you could help me in this....I got to know the par file for this class:-

"com.sap.km.cm.ui.flex.par.bak"

IF you could help me in de-compiling the class..

Regards

Vaib

Former Member
0 Kudos

Hey Detlev,

You was right, "_blank" is hardcoded in the class file. Here's the code snippet:-

protected Component renderDetailsLink(IResource resource, Component comp)

throws WcmException

{

Link result = new Link(IDCounter.currentID());

result.setReference(RendererResourceLink.getResourcePropertiesLink(resource));

<b>result.setTarget("_blank");</b> result.addComponent(comp);

return result;

}

Now if you could tell me how can i re-compile it and then import it in the Portal...OR if you could re-compile it for me....i can send you the jar file to you.

Vaib

Answers (0)