Re: [xwiki-users] RES: RES: Calendar Application on XE 2.4 not working properly
On Wed, Aug 25, 2010 at 10:26 AM, Raluca Stavro 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: > method="get"> > (this will allow adding calendar events to the 'Main.MyCalendar' page) > > and the redirect url: > 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 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... >> >> >> Remove the ? from href above. Don't forget the tag at the end: >> #end >> >> {{/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 users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] RES: RES: Calendar Application on XE 2.4 not working properly
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}} 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: (this will allow adding calendar events to the 'Main.MyCalendar' page) and the redirect url: (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 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... > > > Remove the ? from href above. Don't forget the tag at the end: > #end > > {{/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 users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] RES: RES: Calendar Application on XE 2.4 not working properly
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... Remove the ? from href above. Don't forget the tag at the end: #end {{/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
Re: [xwiki-users] RES: RES: Calendar Application on XE 2.4 not working properly
Ah nevermind I found the answer in the FAQ, was alot simpler than I thought: -- #foreach ($item in $xwiki.searchDocuments("where doc.web='SpaceName'")) * [$item] #end -- Lockie. -- View this message in context: http://xwiki.475771.n2.nabble.com/Calendar-Application-on-XE-2-4-not-working-properly-tp5420827p5455565.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
Re: [xwiki-users] RES: RES: Calendar Application on XE 2.4 not working properly
Raluca Stavro wrote: > > Yes, you can do that. > You have to change the parameters for the getHTMLCalendar method. > See > http://svn.xwiki.org/svnroot/xwiki/platform/xwiki-plugins/trunk/calendar/src/main/java/com/xpn/xwiki/plugin/calendar/CalendarPluginApi.java > . > So this is what you should do in your homepage: > > ... > ## Set the calendar parameters > ... > ## Display calendar > $cview.getHTMLCalendar($cparams, > $xwiki.getDocument('MySpace.MyEventCalendarPage'), "") > > Where 'MySpace.MyEventsPage' is 'Main.EventCalendar' by default. > > Raluca. > Thanks Raluca for all the help I really appreciate it. I don't really understand what I'm meant to do though. I tried putting the code you provided on the homepage and in different places but I can't seem to get it to work. Can you tell me exactly where to put it, and am I meant to edit the calendar parameters java code? I have made a new page that users will use to fill out the calendar form. It is called Main.Calendar and in it the only code is: {{include document="XWiki.CalendarSheet"/}} Then in Main.Home I have the Main.Calendar appearing below the dashboard: {{include document="Main.Dashboard"/}} {{include document="Main.Calendar"/}} But rather than displaying the events made in Main.Calendar it only displays events made on the actual Main.Home page. All my pages are in 2.0 syntax and I'm using the colibri skin. I hope nothing went wrong when I converted the calendar from 1.0 to 2.0 syntax. The reason I need this is because I don't want the user to have to scroll down on the home page, so if I can get the calendar form on another page, then I can hide it on the home page with an external stylesheet, making everything much more organised and neat. I managed to mirror the blog, recent changes, and other pages on the home page but this one has me baffled. Thanks again, Lockie. -- View this message in context: http://xwiki.475771.n2.nabble.com/Calendar-Application-on-XE-2-4-not-working-properly-tp5420827p5455028.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
Re: [xwiki-users] RES: RES: Calendar Application on XE 2.4 not working properly
Yes, you can do that. You have to change the parameters for the getHTMLCalendar method. See http://svn.xwiki.org/svnroot/xwiki/platform/xwiki-plugins/trunk/calendar/src/main/java/com/xpn/xwiki/plugin/calendar/CalendarPluginApi.java . So this is what you should do in your homepage: ... ## Set the calendar parameters ... ## Display calendar $cview.getHTMLCalendar($cparams, $xwiki.getDocument('MySpace.MyEventCalendarPage'), "") Where 'MySpace.MyEventsPage' is 'Main.EventCalendar' by default. Raluca. On Mon, Aug 23, 2010 at 5:10 AM, Lockie wrote: > > Ah, thanks. > > I have a question though - I would like to mirror the calendar on my > homepage without having the entry form on it, and instead have a link to a > page where you can put events into the calendar. When I use {{include > document="XWiki.CalendarSheet"/}} it creates a new instance of the calendar, > so if I add events directly to CalendarSheet they don't display on the > calendar on the homepage. > > So, how can I make the entry form display its user input on a calendar on > another page? > > Lockie. > -- > View this message in context: > http://xwiki.475771.n2.nabble.com/Calendar-Application-on-XE-2-4-not-working-properly-tp5420827p5451203.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 users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] RES: RES: Calendar Application on XE 2.4 not working properly
Ah, thanks. I have a question though - I would like to mirror the calendar on my homepage without having the entry form on it, and instead have a link to a page where you can put events into the calendar. When I use {{include document="XWiki.CalendarSheet"/}} it creates a new instance of the calendar, so if I add events directly to CalendarSheet they don't display on the calendar on the homepage. So, how can I make the entry form display its user input on a calendar on another page? Lockie. -- View this message in context: http://xwiki.475771.n2.nabble.com/Calendar-Application-on-XE-2-4-not-working-properly-tp5420827p5451203.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
Re: [xwiki-users] RES: RES: Calendar Application on XE 2.4 not working properly
Ah, sorry, I forgot to tell you that in order to use the stylesheet extension, you have to add this line in the XWiki.CalendarSheet page: $xwiki.ssx.use('XWiki.CalendarSheet') You'll see that there is this line somewhere at the end of the patch . Using the extension 'Always on this wiki' will load the CSS code on opening any page of your wiki instance, even where you don't need that CSS. Raluca. On Thu, Aug 19, 2010 at 3:06 AM, Lockie wrote: > > I got it to work, however I had to to put the 'Use This Extension' part to > 'Always on this wiki'. I guess the 'Always on this page' part would work as > well if thats what you're after. I left the name part blank. > > Thanks Raluca it looks much better. > > Lockie > -- > View this message in context: > http://xwiki.475771.n2.nabble.com/Calendar-Application-on-XE-2-4-not-working-properly-tp5420827p5438405.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 users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] RES: RES: Calendar Application on XE 2.4 not working properly
I got it to work, however I had to to put the 'Use This Extension' part to 'Always on this wiki'. I guess the 'Always on this page' part would work as well if thats what you're after. I left the name part blank. Thanks Raluca it looks much better. Lockie -- View this message in context: http://xwiki.475771.n2.nabble.com/Calendar-Application-on-XE-2-4-not-working-properly-tp5420827p5438405.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