The solution that I told you about is like this:
In a separate page, let's say 'Main.MyCalendar', paste this piece of
code that is copied from 'XWiki.CalendarSheet' (I also added 2.0 wiki
syntax but this is mandatory -> you can keep the 1.0 syntax):


#set($cview = $xwiki.calendar)
#set($cparams = $cview.calendarParams)
$cparams.put("month", $request.get("month"))
$cparams.put("year", $request.get("year"))
#set($rqcategories = $util.arrayList)
#foreach($rqcateg in $request.get("category").split(","))
#set($discard = $rqcategories.add($rqcateg.trim()))
$cparams.put("categories", $rqcategories)

{{html wiki=true}}
[[Add New Event>>Main.EventCalendar]]
$cview.getHTMLCalendar($cparams, $xwiki.getDocument('Main.EventCalendar'), "")

Now, in 'XWiki.CalendarSheet' just remove the lines that you've put in
'Main.MyCalendar'. You can also remove the piece of code that lists
the current event (the '#foreach($event in
$doc.getObjects("XWiki.CalendarEvent"))' block), depending on what you
want to display in the form page.

And finally, in 'XWiki.CalendarSheet' change the action of the creation form:
<form action="$xwiki.getDocument('Main.MyCalendar').getURL('objectadd')"
(this will allow adding calendar events to the  'Main.MyCalendar' page)

and the redirect url:
<input type="hidden" name="xredirect"
value="${xwiki.getDocument('Main.MyCalendar').getURL('view')}" />
(this will redirect to the 'Main.MyCalendar' page after submitting the
creation form)

This way you don't need extra JavaScript code to hide parts of the
code and your application is modular.


On Wed, Aug 25, 2010 at 5:24 AM, Lockie <loc...@gmail.com> wrote:
> I worked out a way to hide the form in a way so that the user doesn't have to
> go to another page to fill it out. It hides the div and provides a link to
> reveal it, so I guess it could be used for anything. I thought I'd just
> share it for future reference.
> Go to XWiki.CalendarSheet and Edit>Objects then add a JavaScriptExtension
> object with the following properties:
> Name:
> (blank)
> Code:
> function toggle() {
>        var ele = document.getElementById("toggleText");
>        var text = document.getElementById("displayText");
>        if(ele.style.display == "block") {
>                ele.style.display = "none";
>                text.innerHTML = "Click to view and create events...";
>        }
>        else {
>                ele.style.display = "block";
>                text.innerHTML = "Hide form";
>        }
> }
> Use this extension:
> Always on this wiki
> Parse content:
> No
> Caching policy:
> Default
> Then edit CalendarSheet in Source mode (Note: I converted mine from 1.0
> syntax to 2.0 previously) and add these lines straight after
> $cview.getHTMLCalendar($cparams, ""):
> Click to view events and make events...
> <div id="toggleText" style="display: none">
> Remove the ? from href above. Don't forget the </div> tag at the end:
> #end
> </div>
> {{/html}}
> {{/velocity}}
> And I think that ends my questions about the calendar
> Cheers,
> Lockie.
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/Calendar-Application-on-XE-2-4-not-working-properly-tp5420827p5459543.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
users mailing list

Reply via email to