On Wed, Aug 25, 2010 at 10:26 AM, Raluca Stavro
<raluca.morosan(a)xwiki.com> wrote:
Hi,
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):
{{velocity}}
$xwiki.ssx.use('XWiki.CalendarSheet')
#set($cview = $xwiki.calendar)
#set($cparams = $cview.calendarParams)
#if($request.month)
$cparams.put("month", $request.get("month"))
#end
#if($request.year)
$cparams.put("year", $request.get("year"))
#end
#set($rqcategories = $util.arrayList)
#foreach($rqcateg in $request.get("category").split(","))
#if(!$rqcateg.trim().equals(""))
#set($discard = $rqcategories.add($rqcateg.trim()))
#end
#end
$cparams.put("categories", $rqcategories)
{{html wiki=true}}
[[Add New Event>>Main.EventCalendar]]
$cview.getHTMLCalendar($cparams, $xwiki.getDocument('Main.EventCalendar'),
"")
{{/html}}
{{/velocity}}
For your case ignore all starting from here. The next explanations are
for the case where you want to add events to another page than
'Main.EventCalendar'.
Raluca.
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.getURL('Main.MyCalendar',
'objectadd')"
method="get">
(this will allow adding calendar events to the 'Main.MyCalendar' page)
and the redirect url:
<input type="hidden" name="xredirect"
value="${xwiki.getURL('Main.MyCalendar', '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.
Raluca.
On Wed, Aug 25, 2010 at 5:24 AM, Lockie <lockie(a)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-workin…
Sent from the XWiki- Users mailing list archive at
Nabble.com.
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users