Heitor Mayer a écrit :
> First of all, thank you for your answer.
> I tried to change the type of Editor to WUSIWYG, but even after the change, 
> the field appears like this one :
>  
> (∗) TXProblema: 
>  
>
> I have been using public java.lang.String display(java.lang.String fieldname,
>                                 java.lang.String mode) with mode = "edit" in 
> order to display the field
>  
> I already tried mode = "inline", but nothing happens
>  
> My problem is just that I need the embedded html editor. 
> When I call the page in inline mode, it shows every field in inline mode 
> along with many different buttons, what I do not want, because I want to have 
> only one button(my own button) to save the page content, so this is the 
> reason I want only one field(of the type Text Area) in inline mode.
>  
> Thank you in advance.
>   
Hi Heitor

Here is a piece of code that might help you : it is an extract from one 
of my class sheets, where I customized the inline edit :

#if($context.action=="inline")
  #set($class = $doc.getObject("XWiki.USClass").xWikiClass)
  #set($hasProps = false)
  #foreach($prop in $class.properties)
    #if($velocityCount == 1)
      #set($hasProps = true)
      <dl>
    #end
##Here, I choose not to display some of the fields.
    #if 
((${prop.prettyName}!="id")&&(${prop.prettyName}!="name")&&(${prop.prettyName}!="actor"))
      <dt> ${prop.prettyName} </dt>
      <dd>$doc.display($prop.getName())</dd>
    #end
    #if (${prop.prettyName}=="id")
      ##<dt> ${prop.prettyName} (DO NOT MODIFY)</dt>
      ##<dd>$doc.display($prop.getName())</dd>
    #end
  #end
  #if($hasProps)
    </dl>
  #end
##From here, I display some external fields in view mode (not for edition)
  $context.setDisplayMode("view")
  <table>
  <tr><th>Release</th><th>Sprint</th></tr>
  <tr>
 
<td>#set($allReleaseLinks=$xwiki.getDocument("Project.ReleaseLinks").getObjects("XWiki.ReleaseUSLinkClass"))
          #foreach($link in $allReleaseLinks)
            #if($link.get("usId")==${doc.display("id")})
              #set($url="Project."+$link.get("releaseId"))
              #set($releasedoc=$xwiki.getDocument($url))
              #set($release=$releasedoc.getObject("ReleaseClass"))
              [$release.get("name")>$url]    <a 
href="../../view/Project/planner?backlog=${doc.display("id").substring(0,1)}&usId=${doc.display("id")}&releaseId=${link.releaseId}">X</a>
 
\\
            #end
          #end
          <a 
href="../../view/Project/ReleaseLinks?backlog=${doc.display("id").substring(0,1)}&usId=${doc.display("id")}">Add</a></td>
        

    
<td>#set($allSprintLinks=$xwiki.getDocument("Project.SprintLinks").getObjects("XWiki.SprintUSLinkClass"))
          #foreach($link in $allSprintLinks)
            #if($link.get("usId")==${doc.display("id")})
              #set($url="Project."+$link.get("sprintId"))
              #set($sprintdoc=$xwiki.getDocument($url))
              #set($sprint=$sprintdoc.getObject("SprintClass"))
              [$sprint.get("name")>$url]   <a 
href="../../view/Project/planner?backlog=${doc.display("id").substring(0,1)}&usId=${doc.display("id")}&sprintId=${link.sprintId}">X</a>\\
            #end
          #end
          <a 
href="../../view/Project/SprintLinks?backlog=${doc.display("id").substring(0,1)}&usId=${doc.display("id")}">Add</a></td>
  </tr>
  </table>
#end


Note that you might need to put a $context.setDisplayMode("inline") at 
the end (it's the end of my page so I did not put it)

Like that you can use the XWiki buttons to save the changes (it's inline 
mode after all).

I think that if you want to do that in another page, you might want to 
switch between inline mode and view mode using the 
$context.setDisplayMode() to display your field.

I hope that might help you.

Best regards

Jean

-- 
----
Jean Couteau
Code Lutin - http://www.codelutin.com
44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire
Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28 

_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to