Hello - is it possible to enable searching of additional filetypes within XWiki 6.2.4? Specifically I would like to be able to search attachments that are 7-Zip .7z archives. It looks to me as though the underlying library (Commons Compress) supports this filetype, but I am a new XWiki user and non-java programmer so I may be assuming too much.
Thanks in advance for your thoughts on this -
Garth Arnold
________________________________
GHC Confidentiality Statement
This message and any attached files might contain confidential information protected by federal and state law. The information is intended only for the use of the individual(s) or entities originally named as addressees. The improper disclosure of such information may be subject to civil or criminal penalties. If this message reached you in error, please contact the sender and destroy this message. Disclosing, copying, forwarding, or distributing the information by unauthorized individuals or entities is strictly prohibited by law.
I think the problem has more to do with the FileUploadPlugin returning an array containing entries for all form field items, not just the file inputs. Also, the FileItem getFile(FormFieldName) method in the plugin is not exposed in the FileUploadPlugin API, so I had to resort to getting the whole List<FileItem> and iterating through to finding one with a matching field instead of assuming I knew the correct index.
I'm keeping my fingers crossed that the XWiki folks don't start using one-based arrays </shudder>
> -----Original Message-----
> From: Hamster [mailto:teunham@hotmail.com]
> Sent: Tuesday, 9 December 2014 9:04 PM
> To: users(a)xwiki.org
> Subject: Re: [xwiki-users] Reading a file submitted from a form
>
> The joy of zero-based vs one-based arrays :-)
>
Hello all,
I have an issue with some Velocity code I got from here ---> http://extensions.xwiki.org/xwiki/bin/view/Extension/Create+Page+With+Object
When the code runs the resulting page is created and the template is used, but none of my users can edit the page after (not even the admin). It looks like the template page was actually included in the page, not that the page was created "from" the template.
Here is the code I'm using:
{{velocity}}
#set($newDoc = $xwiki.getDocument("Sandbox.TestPage"))
$newDoc.setTitle("TestPage")
$newDoc.setParent("Sandbox.WebHome")
$newDoc.setContent('{{include document="Templates.TemplateToUse"/}}')
$newDoc.save()
{{/velocity}}
When I go to my space and create a new page manually and select to use a template for the new page the resulting page CAN be edited appropriately using the EXACT SAME TEMPLATE, so I'm very confused.
Any help is greatly appreciated
Hi,
I have a form as follows:
{{html}}
<form action="" enctype="multipart/form-data" method="post">
<input type="hidden" name="addFile" value="true" />
<input type="file" id="myupload" name="newfile" />
<input type=submit>
</form>
{{/html}}
And I'd like to perform a simple check that I can access the file (by returning the file size and a line-by-line echo) using a velocity script:
{{velocity}}
## If this page is called with addStudy=true then do something with the information
#if ($request.addFile == "true")
{{info}}Request received to add file{{/info}}
#set ($fileUpload = $xwiki.fileupload)
#set ($newFileName = $fileUpload.getFileName("newfile"))
#if (!$newFileName)
{{warn}}Failed to find submitted file{{/warn}}
#else
Found file $newFileName to load
#set ($discard = $fileUpload.loadFileList())
#set ($fileitem = $fileUpload.getFileItems().get(0))
Found file item for $fileitem.getFieldName() to load, of $fileitem.getSize() bytes
#set ($filestream = $fileitem.getInputStream())
{{info}}filestream.getText(){{/info}}
$filestream.getText()
{{info}}filestream.readLines(){{/info}}
#foreach($line in $filestream.readLines())
| $line
#end
#end
#end
{{/velocity}}
And also with a Groovy script:
{{groovy}}
if(request.addFile == "true") {
println "{{info}}addFile requested {{/info}}"
fileUpload = xwiki.fileupload
newFileName = fileUpload.getFileName("newfile")
if(newFileName != null) {
println "Found file $newFileName to load"
fileUpload.loadFileList()
fileitem = fileUpload.getFileItems().get(0)
println "Found file item for ${fileitem.getFieldName()} to load, of ${fileitem.getSize()} bytes"
filestream = fileitem.getInputStream()
println "{{info}}filestream.getText(){{/info}}"
println filestream.getText()
println "{{info}}filestream.eachLine{{/info}}"
filestream.eachLine {
println "${it}"
}
} else {
println "Failed to find submitted file"
}
}
{{/groovy}}
I've tested this page out with a 3kb text file, and both scripts tell me I have a 4 byte file and I get no lines returned. I'm sure I'm being a total noob, but can somebody please put me out of my misery and explain why this isn't working?
The consortium that I am currently working for is interested in using XWiki for managing its projects and performing some reporting. Supporting this is beyond my current skillset and availability, so I'm interested in sponsoring this work. I know the sponsor system is quite new, but I'd appreciate any guidance on how one should determine a reasonable fee for such work. What sort of amount is likely to generate sufficient interest from active XWiki developers?
Thanks,
Bryn
Hello,
Can anyone point me in the right direction? I'm trying to query and external Microsoft SQL database from a wiki page. My current wiki runs on MSSQL just fine using sqljdbc4.jar configured with hibernate. The DB I want to query is actually on the same server, I can actually make it appear in the same DB if that makes things easier.
I've looked at SQL Tools extension --> http://extensions.xwiki.org/xwiki/bin/view/Extension/SQL+Tools and I can get that to work just fine even querying the other database, but I don't know how to make the results of a query from that tool appear in a separate page I've created for use in Velocity for example.
I've tried to get the example on the "Execute SQL" page here --> http://extensions.xwiki.org/xwiki/bin/view/Extension/Execute+SQL to work but I get a Groovy error on the second snippet and nothing at all appears on the page using the first snippet (but no error).
I've also looked at this plugin --> http://xwikisql.gradsoft.ua/docs/XWikiSqlPluginGuide.html but it hasn't been updated since 2008, so I'm not really sure that's a good idea from a sustainability perspective in a production environment.
Ultimately, I will have a flat table in some database, really any database (e.g..it can be the XWIKI DB)..and I need to be able to get the rows and columns from the table and expose them as an HTML table in my wiki page. Once I figure out how to get the data making it into a table is easy enough, but I can't even figure out how to get an object or array with the data in it to iterate.
All help is greatly appreciated.
Thanks in advance,
Jason
Hello !
on one wiki page I have a skript to delete a comment on another page. But when a user that has no edit right tries to do it, it fails. Is there a way to go around this and let the user delete the comment as if he had edit rights?
for reference here is my simplified code
{{groovy}}
yourDocReference = new org.xwiki.model.reference.DocumentReference('xwiki','Main','WebHome');
yourDoc = xwiki.getDocument(yourDocReference);
comment = yourDoc.getComments();
if(comment.isEmpty()){
println("No Comment to remove!");}
else{
yourDoc.removeObject(comment[comment.size()-1]);
yourDoc.save();
println("First comment removed !")}
{{/groovy}}
thanks for the help
Adrien
Hello:
I would like to use xwiki to write text articles. A page would be
created for each article.
Then I would like to read this article from a java web application that
would publish it on that site.
Seems like this should be doable. I'm just learning xwiki so I need
someone with more understanding of xwiki to help
me plan.
Using a url, how to do lookup of the page (my article) in xwiki?
Thanks
lee