Re: [xwiki-users] Adding survey question and details to page template...
Ajdin, You are absolutely right, especially since there seem to be so few people posting information from a users perspective. So here's what I did. The key to getting it working was an example I found in the snippets section that talked about how to create new documents with Tags. It showed an example of how to check if there was an instance of a certain class already attached to a document and create one if not (I already knew how to do this more or less). The important piece was how to set a property on that object once you have a handle to it. I don't have the code done completely yet but the basic shell is something like: #set($surveyObj = $doc.getObject(CPA_FAQs.SurveyClass)) #set($surveyChoice = $request.getParameter(surveyChoice)) #if(!$surveyObj) ##Create a new survey object and attach it to this document. #set($sObj = $doc.newObject(CPA_FAQs.SurveyClass)) $sObj.set(votetotal, $voteCnt) ## these are just here as an example $sObj.set(voters, $voters) ## as I haven't even created the Survey class yet $doc.save() #end #if($surveyChoice) ## Need to update the objects values here #end ## If the current user has voted don't allow them to vote again Was this information useful to you? form action=${doc.getURL()} method=POST style=display: inline input name=surveyChoice type=radio name=Yes value=Yes/Yes input name=surveyChoice type=radio name=No value=No/No nbsp;input type=submit value=Submit/ /form I still need to implement a few things but I know should work for what I need. The main thing I'm trying to determine at this point is if I can't require someone to have an account in order to vote, how do I keep them from voting multiple times? I can't use cookies, and I'm not sure using their IP address will prove of any use. Even if users do have to register in order to vote, I'm not sure there's an API method available that allows me to access their unique user ID as opposed to their user name. If I have to track usernames on each of these objects for all of the people who have ever voted on a particular question it could get out of hand really fast! Any ideas? Thanks! .:. Kevin -- View this message in context: http://n2.nabble.com/Adding-survey-question-and-details-to-page-template...-tp2192675p2197567.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] some questions concerning editing pages - more specific section behaviour - XWiki 1.8M1 [partly solved]
What I still don't get is How to create sections - or get an edit icon at the top right at all If you are getting it on some pages then you have it turned on in the config so that's step one. Now the magic bit... Use a header for your section, any of these will create you a new section in the page that can be edited separately. 1 1.1 1.1.1 1.1.1.1 I believe all of these create new sections. To be honest, I think that this behavior is annoying. I'd much rather have a Tag or some other indicator that I want a given heading to be individually editable. There are times when I may want to use one of those headings and NOT have it create a nee editable section in the page. But that is neither here nor there... Hope this helps! .:. Kevin -- View this message in context: http://n2.nabble.com/Re%3A-some-questions-concerning-editing-pages---more-specific-section-behaviour---XWiki-1.8M1--partly-solved--tp2197512p2197585.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
[xwiki-users] Adding survey question and details to page template...
One of the things I've been asked to accomplish using XWiki is a single question *survey* type section at the bottom of my FAQ pages. Something like: 68% of 158 people found this information useful. Was this information helpful? O Yes O No [Submit] You get the idea. Now, the problem is I'm not sure exactly how I'd accomplish something like this. I know I can create a survey class and sheet that will allow me to store the data and display it the way I want, but how do I update the values when the person clicks submit? Would it just be an update SQL statement, or would I update properties of an attached instance of the survey class and then save the page? Any hints or examples would be appreciated. I found the Polls application, but it only supports creating a new poll and not updating values in an existing Poll, which is more like what I am looking to do. Thanks! .:. Kevin -- View this message in context: http://n2.nabble.com/Adding-survey-question-and-details-to-page-template...-tp2192675p2192675.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] Purge Document Versions via Script
I'm guessing you could use something like: http://code.xwiki.org/xwiki/bin/view/Snippets/DeleteSpaceSnippet to build a listing of the files versions and then create links or checkboxes or something like that to delete the ones you are interested in. You can get the full list of versions using $doc.getRevisions() which returns a org.suigeneris.jrcs.rcs.Version[]. You could then iterate through that list and delete all versions but the last. HTH, .:. Kevin -- View this message in context: http://n2.nabble.com/Purge-Document-Versions-via-Script-tp2192579p2192728.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