Hi Marius,
Thanks for your response, the get action works very well for rendering the
target link as a part of my current page if the target link is originally
for view action, now I need to edit this content, which is only a part of
the page, I only need to edit this part, I tried to use get action to get
the dom portion of the edit action content and render it for this area in
the page, but it does not work, with get, I can only get the dom for view
html content, not edit html content, for example, for this url:
, not the content for
the edit action, I like to display the edit inline form for this area so
users can edit this part and keep the other parts of the page unchanged.
Any suggestions?
Thanks very much for your thoughtful help.
David
On Sat, Dec 15, 2012 at 5:29 AM, Marius Dumitru Florea <
mariusdumitru.florea(a)xwiki.com> wrote:
On Sat, Dec 15, 2012 at 5:53 AM, Geo Du
<dddu88(a)gmail.com> wrote:
Hi Marius,
This works, but my problem is that I have a xwiki page, I have a link on
this page, when I click on this link, a javascript function is called,
with
the call, I want to include a new xwiki page at
the bottom of the current
page without reloading the current old content (like appending a new
page to
the current page without change of the old
content), the new appended
content could be in edit or view mode.
My question is the approach you have here is to use display macro, how to
trigger this macro inside javascript code? also how to avoid reloading
the
old content when appending new content? since in
the old page I have some
search results listed, I do not want to lose it and make users have to
search again.
You cannot (directly) use the display macro in JavaScript code because
they belong to two different worlds. The display macro is executed on
the server side long before the JavaScript is executed on the client
side, in the browser. What you have to do is to catch the click event
on the link, make an AJAX (
http://prototypejs.org/doc/latest/ajax/Ajax/index.html ) call to
retrieve the target of that link (another wiki page I assume) and
append it to the DOM document. In order to retrieve only the rendered
content of the target page, without the page header, footer, panels,
etc, you can use the 'get' action, e.g. /xwiki/bin/get/Sandbox/WebHome
.
Hope this helps,
Marius
Thanks for your help.
David
On Mon, Nov 5, 2012 at 3:33 AM, Marius Dumitru Florea
<mariusdumitru.florea(a)xwiki.com> wrote:
>
> The display macro works for me as you would expect. For instance, if I
> create a page with this content:
>
> ----------8<----------
> {{velocity}}
> Current action: $xcontext.action
> {{/velocity}}
>
> {{display reference="Blog.BlogIntroduction"/}}
> ---------->8----------
>
> in view mode I can see the blog post preceded by "Current action:
> view" and in "Inline Form" edit mode I can edit the blog post, which
> is preceded by "Current action: edit".
>
> Hope this helps,
> Marius
>
> On Fri, Nov 2, 2012 at 10:18 PM, Geo Du <dddu88(a)gmail.com> wrote:
> > Hi Marius,
> >
> > Thanks for your response, it works when I use display macro to include
> > the
> > testpage into the other page, but I need also to include (display) the
> > page
> > with inline mode inside the other page, since user can click the edit
> > pencil
> > button on the right corner of the testpage to edit it, right now the
> > edit
> > button will lead to the testpage in inline mode but the testpage is
not
> > inside the other page which originally
include(display) the testpage.
> >
> > So how to include or display a page with inline mode into another
page?
>
> Thanks for your help.
>
> David
>
> On Fri, Nov 2, 2012 at 3:06 AM, Marius Dumitru Florea
> <mariusdumitru.florea(a)xwiki.com> wrote:
>>
>> On Thu, Nov 1, 2012 at 10:51 PM, Geo Du <dddu88(a)gmail.com> wrote:
>> >
>> > Hi All,
>> >
>> > I want to include one page into another page in terms of content
>> > instead
>> > of
>> > velocity code, for example, the Blog.WebHome is a page without
>> > velocity
>> > code if you choose Edit->Wiki, but it has Blog.BlogClass if you
>> > select
>> > Edit->Objects, from Blog.WebHome page, I can create a new post with
>> > tile
>> > testpage, now the Blog.testpage is the new page created that I need
>> > to
>> > include into another page, this testpage has no velocity code from
>> > Edit_>Wiki. so how to include that page into a different page?
>> >
>>
>> > I tried: include Macro, includeInContext Macro, includeTopic Macro,
>> > none
>> > of
>> > them displays the testpage for me, any idea?
>>
>> "display" is the key. You want to display not to include. See
>>
http://extensions.xwiki.org/xwiki/bin/view/Extension/Display+Macro .
>>
>> Hope this helps,
>> Marius
>>
>> >
>> > Thanks very much for your help.
>> >
>> > David
>> > _______________________________________________
>> > devs mailing list
>> > devs(a)xwiki.org
>> >
http://lists.xwiki.org/mailman/listinfo/devs
>> _______________________________________________
>> devs mailing list
>> devs(a)xwiki.org
>>
http://lists.xwiki.org/mailman/listinfo/devs
>
>