inline reading

Showing results for 
Search instead for 
Did you mean: 
Member II

inline reading

I've created a new panel under the content panel and now I want If you click on a content(html or text file) that the content of it( the text of the document) comes in that panel and not on a different page.
Can someone help me?
9 Replies
Member II

Re: inline reading

hey guys,

I've got a testpanel on browse.jsp where i want to read my .txt documents from that page.

include on browse.jsp

<%– TestPanel –%>
<%@ include file="../parts/testpanel.jsp" %>


<tr valign=top>
   <td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width=4></td>
   <td style="padding:4px">
      <aSmiley Tongueanel id="content-panel" border="white" bgcolor="white" titleBorder="blue" titleBgcolor="#D3E6FE" styleClass="mainSubTitle" label="#{msg.browse_content}">
      <h:inputTextarea id="textArea" rows="24" cols="112" value="#{CheckinCheckoutBean.editorOutput}" />
      </aSmiley Tongueanel>
   <td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)" width=4></td>

Now, when i open my textfile on browse.jsp, the textfile will open on a new page.
With the inputtextfield, i just used the methode from the edit-text-inline.jsp page but i'm now a little confused.

What I would like to try:
When i click on the link from the file, the file must not open in a new page, but the content must be show in te inputfieldbox.
But here, i'm a little struggled.

I tought i got it fixed with addapting the link from inline editing but i don't know where i can change the link, so that it will not link to edit-text-inline, but back browse.jsp

Anyone a answer?

Active Member II

Re: inline reading

The content download links are generated by In this method:
public void setupCommonBindingProperties(Node node)
a property resolver anonymous inner class is referenced which provides the URL to download the content using the DownloadContentServlet.

If you wish to perform an action instead of downloading the content, then you need to change the action in "browse.jsp" to work like other JSF actions e.g. not point directly to a servlet but instead to perform a JSF action where you can write your custom code. From the information in your post I think you are most of the way there… This section of "browse.jsp" contains the components which display the generated download link for the various view modes:

   <%– Primary column for details view mode –%>
   <a:column primary="true" width="200" style="padding:2px;text-align:left" rendered="#{BrowseBean.browseViewMode == 'details'}">
      <f:facet name="header">
         <a:sortLink label="#{}" value="name" mode="case-insensitive" styleClass="header"/>
      <f:facet name="small-icon">
         <a:actionLink value="#{}" href="#{r.url}" target="new" image="#{r.fileType16}" showLink="false" styleClass="inlineAction" />
      <a:actionLink value="#{}" href="#{r.url}" target="new" />
      <r:lockIcon value="#{r.nodeRef}" align="absmiddle" />
   <%– Primary column for icons view mode –%>
   <a:column primary="true" style="padding:2px;text-align:left;vertical-align:top;" rendered="#{BrowseBean.browseViewMode == 'icons'}">
      <f:facet name="large-icon">
         <a:actionLink value="#{}" href="#{r.url}" target="new" image="#{r.fileType32}" showLink="false" styleClass="inlineAction" />
      <a:actionLink value="#{}" href="#{r.url}" target="new" styleClass="header" />
      <r:lockIcon value="#{r.nodeRef}" align="absmiddle" />
   <%– Primary column for list view mode –%>
   <a:column primary="true" style="padding:2px;text-align:left" rendered="#{BrowseBean.browseViewMode == 'list'}">
      <f:facet name="large-icon">
         <a:actionLink value="#{}" href="#{r.url}" target="new" image="#{r.fileType32}" showLink="false" styleClass="inlineAction" />
      <a:actionLink value="#{}" href="#{r.url}" target="new" styleClass="title" />
      <r:lockIcon value="#{r.nodeRef}" align="absmiddle" />

The lines you are interested in are these:

<a:actionLink value="#{}" href="#{r.url}" target="new" />
This style of actionlink component uses a direct generated HREF to download the content, if you change this to a JSF style action link that executes your custom code such as:

<a:actionLink value="#{}" actionListener="#{MyBean.myMethod}" />
So as you have already worked out, you will want to put similar code in your bean actionlistener method as you can see in the CheckinCheckoutBean - basically you need to get the content from the node, set the content into a field that has a getter method (similar to getEditorOutput() in CheckinCheckoutBean ) and then bind your textarea to that getter.

Hope this helps!

Member II

Re: inline reading

Thx kevin,

now, it works with the .txt & html files.

I show the content with:
outputText value="#{CheckinCheckoutBean.documentContent}"
Now, when i want to show the .txt files, the text will be shown straigt after each other, so, there is no more structure in it.
Can i convert .txt files to html files when i make a new file?
of is this not possible?

Or do you know an other way to make sure that, when I want to show the content of a txt file, that the stucture will be the same?

Member II

Re: inline reading

Did you modify the actionlistener and create a new bean as Kevin suggested or did you just change the outputText value?

I'm very interested in getting this functionality, and it seems there are a couple of ways to do it.  I'm interested in doing it the 'right way', if I knew what that was.

It seems that displaying the content should be a function of BrowseBean, since it is responsible for displaying and navigating the rest of the nodes.  In this case it is just extending the browsing down one more level into the actual content.

The actual way to display a particular content might vary of course.  I would also like to see a panel that would display images inline and also display an embedded control for media playback for those filetypes.

As far as generating your custom panel, were you following some document for that?  I'm confused on how to create a custom panel and link it to the web interface, or a given contentType.
Member II

Re: inline reading

I used the methode from the bean CheckinCheckoutBean but I created a new Bean "InlinereadingBean" sow where i implemented and adjusted that methode.

(I think it was the "editfile" in the Bean.)
here, you put the content of a document in a string and then, you can work with it

outputText value="#{InlinereadingBean.documentContent}"

Everything we programmed, we also docemented it, but i've got these files not at this computer at the moment.
We also added a Tree structure underneed the shelff etc.

we are testing and experimenting all the time with alfresco.

Later in the week, I'll be experimenting with Inline reading of images, .docs, …
Hope that this will be a succes.

Member II

Re: inline reading

Could you share the complete code of your changes?  I would like to implement your changes and contribute to your efforts.
Member II

Re: inline reading


I have a problem

First, i search for a file type with:

// looking for the type of file
               if (MimetypeMap.MIMETYPE_TEXT_PLAIN.equals(mimetype) ||
                   MimetypeMap.MIMETYPE_XML.equals(mimetype) ||
                   MimetypeMap.MIMETYPE_TEXT_CSS.equals(mimetype) ||

If it isn't a text/html file, then I search for images

               {  if (MimetypeMap.MIMETYPE_IMAGE_JPEG.equals(mimetype) ||
                       MimetypeMap.MIMETYPE_IMAGE_GIF.equals(mimetype) ||

just for now, I test it with

Later, I will try to put the image into the setDocumentContent (if it's possible)

now, when I click on the image, sometimes, the images will open on a normal way (not inline) and sometimes, i'll get a nullpointerexception.

someone an idea?
Member II

Re: inline reading

i found the problem

I just needed to set the "inline editing" on by images, so, then, i can view the images inline.
Member II

Re: inline reading

In our inline reading panel, I added 2 icons in the panel for 2 actions.

<hSmiley TongueanelGroup id="inline-panel-facets">
                    <f:facet name="title">
                          <a:actionLink id="panelLink1-inline" value="Close Content" action="#{CheckinCheckoutBean.closeContent}" showLink="false" image="/images/icons/close.gif" />
                          <a:actionLink id="panelLink2-inline" value="Resize" action="#{PanelBean.resizePanels}" showLink="false" image="/images/icons/fullscreen.gif" />
                 </hSmiley TongueanelGroup>

<aSmiley Tongueanel label="#{CheckinCheckoutBean.titleContent}" id="inline-details-panel" facetsId="inline-panel-facets" progressive="true"
                                       border="white" bgcolor="white" titleBorder="blue" titleBgcolor="#D3E6FE"
                                       expanded='#{PanelBean.panels["inline_details"]}' expandedActionListener="#{PanelBean.expandPanel}">

This is te same like in the document-details.jsp (first panel) but i use none permissionevaluator.

But, alfresco shows only the first icon, and not the second one.

Someone an idea?