OW2 Consortium
Search OW2 Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | exoplatform List | October 2006 Index

<--  Date Index  --> <--  Thread Index  -->

RE: [exoplatform] nodetype with image data


Hi Gennady,

 

Just wanted to let you know, that I with Andrew Wacker just managed to create exo:image nodetype that extends nt:file, so I can create document and view the image.

 

My mistake was to use nested nt:file.

 

So the issue is that we need to store multiple images in a node. How can I do it with a nodetype that extends nt:file, e.g. like image and thumbnail?

 

Below is example of nodetype I was thinking about.

 

Thank you!

 

<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"

  xmlns:jcr="http://www.jcp.org/jcr/1.0">

 

  <nodeType name="exo:image3" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">

    <supertypes>

      <supertype>nt:file</supertype>

    </supertypes>

    <propertyDefinitions>

      <propertyDefinition name="exo:text" requiredType="String" autoCreated="false" mandatory="false" >

        protected="false" multiple="false">

        <valueConstraints/>

      </propertyDefinition>      

    </propertyDefinitions>

    <childNodeDefinitions>

      <childNodeDefinition name="exo:thumbnail" defaultPrimaryType="nt:file" autoCreated="false" mandatory="false"

        protected="false" sameNameSiblings="true">

        <requiredPrimaryTypes>

          <requiredPrimaryType>nt:file</requiredPrimaryType>

        </requiredPrimaryTypes>

      </childNodeDefinition>

    </childNodeDefinitions>  </nodeType>  

</nodeTypes>

 

 

 

 

 


From: Gennady Azarenkov [mailto:gennady.azarenkov@xxxxxxxxxxxxxxx]
Sent: Sunday, October 08, 2006 3:22 PM
To: Andriy Zhdanov
Cc: exoplatform@xxxxxxxxxxxxx; Volodymyr Turanskyy
Subject: Re: [exoplatform] nodetype with image data

 

it does not take in account node type containing jcr:data not jcr:data... anyway as i you we are about

to make some refactoring to gain more flexibility that will suit requirements of everyone unless one decide

not to use nt:resource for content data, so stay tuned

 

gennady

----- Original Message -----

Sent: Sunday, October 08, 2006 2:43 PM

Subject: RE: [exoplatform] nodetype with image data

 

Hi Gennady,

 

Why do you think it does not take in account jcr:data? The solution just makes it possible to work with other node types then nt:file or exo:article, and it still uses jcr:data to show content.

 

Please check it again.  Thank you.

 


From: Gennady Azarenkov [mailto:gennady.azarenkov@xxxxxxxxxxxxxxx]
Sent: Sunday, October 08, 2006 2:35 PM
To: Andriy Zhdanov
Cc: exoplatform@xxxxxxxxxxxxx; Volodymyr Turanskyy
Subject: Re: [exoplatform] nodetype with image data

 

hi,

 

1. the solution you are talking about is not correct stricly speaking as does not take in account node type

of showing jcr:data...

 

2. so far it is not possible to delete/modify nodetype... perhaps will have this feature in JCR version 1.2 but not earlier

 

BR,

 

Gennady

 

----- Original Message -----

Sent: Saturday, October 07, 2006 5:13 PM

Subject: RE: [exoplatform] nodetype with image data

 

Hi Gennady,

 

I seem to get your idea, thank you for your patience, so we return to the origin of this discussion thread. If I create a nodetype with child node nt:file, and use DisplayResourceCommand for this inner resource to display it as the image, it (DisplayResourceCommand) throws “Invalid node type, expected nt:file or exo:article, have exo:image at /test” exception.

 

Please consider solution proposed by Massimo Gai at the very bottom of my letter. His idea is right I think, since view template for exo:article gives relativePath parameter, and we can do the same, but DisplayResourceCommand does not use it now.

 

And please answer his another question: Is it possible to delete (or modify ) existing  nodetype without create another that extend the first? How can I manage change in nodetype?

 

Thank you!

 


From: Gennady Azarenkov [mailto:gennady.azarenkov@xxxxxxxxxxxxxxx]
Sent: Monday, September 11, 2006 4:04 PM
To: Andriy Zhdanov; exoplatform@xxxxxxxxxxxxx
Subject: Re: [exoplatform] nodetype with image data

 

>It sounds like a workaround

I do not think there is something "artificial" for content oriented application, nt:resource/nt:file are designed especially for storing the kind of content that we usually call "[web] resource" so IMO it is rather logical :)...

 

Note, that in fact you need DisplayResourceServlet/Command for inner resources only - for instance for <img src="" inside other resource, ECM is used flexible Velocity templates mechanism (look the docs for details) for edit/view nodes

 

----- Original Message -----

Sent: Sunday, September 10, 2006 1:09 AM

Subject: RE: [exoplatform] nodetype with image data

 

It sounds like a workaround, and frankly speaking it is not clear for me: just created nt:test at demo.exoplatform.org, but it does not appear in ECM file explorer.

 

Even if it will appear, can I edit description and upload image on the same form in ECM file explorer?

 

Also, I’ve just noticed there is new type exo:podcast, and I guess it was added programmatically, but not with ECM admin, was not it?

 

Well, here are more details: we need node type e.g. with name and description, user must be able to add documents of it in ECM file explorer and upload image for it on the single form like exo:article or exo:podcast. Then documents of this type need to be displayed in Browse Content portlet with specific template.

 

In general, we want to create image gallery, video gallery, and news panel. Think about more. So, again, question is, how exoplatform recommends to do it? I guess ECM with Browse Content was created exactly for this.

 

Any way, thank you, Gennady, for your assistance!

 


From: Gennady Azarenkov [mailto:gennady.azarenkov@xxxxxxxxxxxxxxx]
Sent: Saturday, September 09, 2006 11:40 AM
To: Andriy Zhdanov; exoplatform@xxxxxxxxxxxxx
Subject: Re: [exoplatform] nodetype with image data

 

So create nodetype with 2 nt:file childNodes - image and description so when DisplayJCRContentServlet call

/path/to/your/node/image - image will be displayed

/path/to/your/node/description - description will be displayed

does it help?

----- Original Message -----

Sent: Friday, September 08, 2006 3:31 PM

Subject: RE: [exoplatform] nodetype with image data

 

We want to have composite document containing image and description, but not an exo:article

 


From: Gennady Azarenkov [mailto:gennady.azarenkov@xxxxxxxxxxxxxxx]
Sent: Friday, September 08, 2006 3:25 PM
To: Andriy Zhdanov; exoplatform@xxxxxxxxxxxxx
Subject: Re: [exoplatform] nodetype with image data

 

>We experienced similar problem, and solved 2nd one similarly to you.

 

>I’m wondering how explatform thinks it is possible to use ECM with other resources than exo:article and nt:file? Is >there any documentation/guide line for extending ECM with node types?

 

any example of *impossibility* to use (extension of) nt:file for storing/displaying content?

 

 

 

----- Original Message -----

Sent: Friday, September 08, 2006 1:43 PM

Subject: RE: [exoplatform] nodetype with image data

 

Hi,

 

We experienced similar problem, and solved 2nd one similarly to you.

 

I’m wondering how explatform thinks it is possible to use ECM with other resources than exo:article and nt:file? Is there any documentation/guide line for extending ECM with node types?

 


From: Massimo.Gai@xxxxxx [mailto:Massimo.Gai@xxxxxx]
Sent: Friday, September 08, 2006 1:37 PM
To: exoplatform@xxxxxxxxxxxxx
Subject: [exoplatform] nodetype with image data

 


Hi,
I'm a developer in java portal application and I'm looking for a open source portal .
Now I try exo platform 2.0 features, in particolar exo ECM functionality.
I've a question and a suggestion:
- Is it possible to delete (or modify ) existing  nodetype without create another that extend the first? How can I manage change in nodetype?

- if I create a new nodetype with image data, when I add it in the CMS and save it (with the correct mime-type), I don't view  this image in the browser.
I look src versione v2.x (in particular this file : DisplayResourceCommand.java) : seems that this function is limitated at nt:file and exo:article nodetype.

I modify execute method adding follow line in red , getting nodetype name from request and using relativePath parameter:


public boolean execute(Context context) throws Exception {
   GenericWebAppContext webCtx = (GenericWebAppContext)context;
   HttpServletResponse response = webCtx.getResponse();
   HttpServletRequest request = webCtx.getRequest();

String relativePath=(String)request.getParameter("relativePath");
log.debug("RelativePath="+relativePath);

   Node file = (Node)webCtx.getSession().getItem((String)context.get(pathKey));
   //// temporary refresh due to prb in session
   //file.refresh(false);
   ////
   
Node content=file.getNode(relativePath);
if (content==null ) return true;


/*   Node content;
   if(file.isNodeType("nt:file")) {
     content = file.getNode("jcr:content");
   } else if(file.isNodeType("exo:article")) {
     content = file.getNode("exo:image");
   } else
     throw new Exception("Invalid node type, expected nt:file or exo:article, have "+file.getPrimaryNodeType().getName()+" at "+file.getPath());
*/

   Property data = "">    String mime = content.getProperty("jcr:mimeType").getString();

   // standalone request?
   String servletPath = request.getPathInfo();
   boolean doClose = true;
   // or included?
   if(servletPath == null) {
     servletPath = (String)request.getAttribute("javax.servlet.include.path_info");
     if(servletPath != null)
       doClose = false;
   }
   
   MimeTypeResolver resolver = new MimeTypeResolver();
   String ext = resolver.getExtension(mime);
   response.setContentType(mime+"; charset=UTF-8");
   response.setHeader("Cache-Control","no-cache");
   response.setHeader("Content-disposition", "attachment; filename=" + file.getName() + "." + ext) ;

   if(mime.startsWith("text")) {
     PrintWriter out = response.getWriter();
     out.write(data.getString());

     out.flush();
     if(doClose)
       out.close();
   }
   else {     // if(mime.startsWith("image") || mime.startsWith("application"))
     InputStream is = data.getStream();

     byte[] buf = new byte[is.available()];
     is.read(buf);

     ServletOutputStream os = response.getOutputStream();
     os.write(buf);
     os.flush();
     if(doClose)
       os.close();
   }

   return true;
 }

As far as you concerned , is it correct make this change in code  ?

Massimo Gai
CSI Piemonte
Progetti multimediali e di comunicazione in rete
Corso Unione Sovietica, 216                                          
10134  Torino  Italy                                                
Tel.     +39 011 3165639                                                                                
E-mail: massimo.gai@xxxxxx

Legal Disclaimer: The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message



--
You receive this message as a subscriber of the exoplatform@xxxxxxxxxxxxx mailing list.
To unsubscribe: mailto:exoplatform-unsubscribe@xxxxxxxxxxxxx
For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

Legal Disclaimer: The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message

Legal Disclaimer: The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message

Legal Disclaimer: The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message

Legal Disclaimer: The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message



<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 2006-2007, OW2 Consortium | contact | webmaster.