Consortium
Activities
Projects
Forge
Events
Log-in
Register
Sandbox for Wiki editors
Space Menu
Consortium
|
Solutions
|
Middleware
|
Forge
|
MyObjectWeb
|
PDF
|
History
|
More Actions
View
Code
|
XML
|
Help
Documentation
|
XWiki Syntax
|
1 Sandbox for Wiki editors This page is a sandbox to test XWiki (Version 1.0) features http://platform.xwiki.org/xwiki/bin/view/Main/XWikiSyntax ---- #toc("" "" "") ---- 1.1 Image {image:aspirelogo.png|document=Main} 1.1 Table Tic tac toe {table} Col1 | Col2 | Col3 X | O | X X | O | O O | X | O {table} {table} X | O | X X | O | O O | X | O {table} 1.1 Boxes #info("This is an information panel") #warning("This is a warning panel") #error("This is an error panel") #startfloatingbox() Some content in a floating box #endfloatingbox() This is a floating box displayed on the right. #floatingbox("Some content in a floating box") This is also a floating box displayed on the right. {style:type=div|border=1px solid red|background-color=grey|width=300px|height=300px|color=red} This is some content... {style} 1.1 Code snippet {pre} <pre> /** * Copyright (c) 2005-2008, Aspire * * Contact: Aspire aspirerfid@ow2.org */ interface Foo { int bar(final int i); } </pre> {/pre} 1.1 Formatted Code snippet *Product* {code:java} interface Product { ProductPK getReference(); //retourne la référence (identificateur unique) du produit String getName(): retourne le nom du produit double getPrice(); //retourne le prix du produit int getProductStore(); //retourne la référence du magasin qui vend ce produit ... } {code} 1.1 Other Formatted Code snippet {code:xml} <?xml version="1.0" standalone="yes"?> <?xml-stylesheet type="text/xsl" href="catalog2html.xsl" ?> <catalog> <product> <productStoreId>1001</productStoreId> <reference>101</reference> <name>Machine à laver</name> <price currency="EUR">2000.00</price> </product> <product> <productStoreId>1002</productStoreId> <reference>103</reference> <name>Machine à coudre</name> <price currency="EUR">3000.00</price> </product> </catalog> {code} 1.1 Stats {pre} <pre> > Pour avoir des stats de visite XWiki il faut activer le module de stats, > cf ces pages: > > Activation du module de stats: > http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Configuration > > Un exemple: > http://www.xwiki.org/xwiki/bin/view/FAQ/HowDoYouAddAStatisticsMenu > > Plus d'exemples (le code de la page n'est pas exécuté à l'heure où > j'écris ce mail, mais vous pouvez faire un "View code" pour recopier le > script dans votre wiki): http://dev.xwiki.org/xwiki/bin/view/XWiki/Stats > > Il y a une application de stats aussi dans la dernière version: > http://code.xwiki.org/xwiki/bin/view/Applications/StatisticsApplication > > cf également le StatsService dans les versions récentes: > http://tinyurl.com/368r4r > > Moi j'utilise souvent en plus Google Analytics sur mes sites XWiki pour > croiser les stats... > > Amicalement > </pre> {/pre} 1.1 Test11 1.1.1 Test11 1.1.1 Test12 1.1.1 Test13 1.1 Test12 1.1 Test21 1.1 Test22 1.2 Test 28 1.1 Simile-Timeline http://www.jeremi.info/index.php/post/2006/11/28/Simile-Timeline <br/> {pre} <data> #set($feed = $xwiki.feed.getFeed("http://www.jeremi.info/index.php/feed/rss2")) #foreach($entry in $feed.entries) <event start="$entry.getPublishedDate().toLocaleString()" title="$entry.title">$xwiki.getXMLEncoded($entry.description.value) ... $xwiki.getXMLEncoded("<a href=$entry.link>Suite</a>") </event> #end </data> {/pre} 1.1 nkef Tests ---- 1.1.1 Alternate Whats New Snippet 1.1.1.1 News Find below all the recent news from the site blog and from the list of pages that have been changed recently. <div> <div id="webhomeblogdisplay" style="float:left; width: 49.9%;"> <div style="padding-right:20px;"> <h2 class="heading-1-1-1">Blog <a href="$xwiki.getURL("Main.BlogRss", "view", "xpage=rdf")" style=""><img src="$xwiki.getSkinFile("icons/black-rss.png")" alt="rss icon"/></a></h2> #set($nbstart = $request.nbstart) #set($category = "") #set($nbitems = "3") #includeMacros("Blog.Macros") </div> </div> <div id="webhomeNewsdisplay" style="float:left; width: 50.1%;"> <div style="padding-left: 20px;"> <h2 class="heading-1-1-1">Recent changes <a href="$xwiki.getURL("Main.WebRss", "view", "xpage=rdf")" style=""><img src="$xwiki.getSkinFile("icons/black-rss.png")" alt="rss icon"/></a></h2> #if(!$xwiki.hasMinorEdit() || $request.getParameter("showminor")) #set ($sql = "where 1=1 order by doc.date desc") #else #set ($sql = ", XWikiRCSNodeInfo as ni where doc.id=ni.id.docId and ni.id.version2=1 group by doc.web, doc.name order by max(ni.date) desc") #end #set($showdata = 1) #if(!$nb) #set($nb = 30) #end #set($formatDate = "yyyy MMMM dd, HH:mm") #set ($list = $xwiki.searchDocuments($sql , $nb , 0)) <ul> #foreach ($item in $list) #set($troubi ="non") #if ($xwiki.hasAccessLevel("view", $context.user, "${context.database}:${item}")) #set($bentrydoc = $xwiki.getDocument($item)) #if (!$bentrydoc.name.contains("WatchListJob")) #set($cclass = $xwiki.getDocument("XWiki.XWikiComments").getxWikiClass()) #set($comment = $cclass.newObject()) #if($xwiki.getWebPreferenceAsInt("commentsorder",1)==0) #set($comments = $bentrydoc.getComments()) #else #set($comments = $bentrydoc.getComments(false)) #end #set($createur = $xwiki.getUserName($bentrydoc.author)) <li> #if($comments.size()>0) #set($i = 0) #set($cobj = $comments.get($i)) #set($comment = $bentrydoc.display("comment", "view", $cobj)) #set($date = $cobj.getXWikiObject().get("date").value) #if($date) #set($date2 = $!xwiki.formatDate($date,"yyyy MM dd HH:mm:ss")) #end #if($bentrydoc) #set($date1 = $!xwiki.formatDate($!bentrydoc.date,"yyyy MM dd HH:mm:ss") ) #end #if($date1.equals($date2) ) [$bentrydoc.name>${bentrydoc.web}.$bentrydoc.name] <em>- 1 new comment</em> #set($troubi ="oui") #set($desc = $cobj.getXWikiObject().get("comment").value) #else [$bentrydoc.name in $bentrydoc.web>${bentrydoc.web}.$bentrydoc.name] #end #else #set($comment = "") [$bentrydoc.name in $bentrydoc.web>${bentrydoc.web}.$bentrydoc.name.replaceAll("@","%40")] #end $xwiki.formatDate($bentrydoc.date,"yyyy MMM dd") at $xwiki.formatDate($bentrydoc.date,"HH:mm") #if($troubi =="oui") #set($createur = $xwiki.getUserName($cobj.author)) #end #if ($createur == "XWikiGuest") Guest #else $createur #end </li> #end #end #end </ul> #if($xwiki.hasMinorEdit()) #if($request.getParameter("showminor")) <a href="$xwiki.getURL($tdoc.getFullName(), "view", "")">Hide minor edits</a> #else <a href="$xwiki.getURL($tdoc.getFullName(), "view", "showminor")">Show minor edits</a> #end #end </div> </div> <div style="clear:both; margin-bottom: 40px;"><!-- --></div> </div> ---- 1.1.1 Backlinks Snippet #set ($links = $doc.getBacklinks()) #if ($links.size > 0) #foreach($docname in $links) #set($rdoc = $xwiki.getDocument($docname).getTranslatedDocument()) * <a href="$rdoc.getURL("view")">$rdoc.displayTitle</a> #end #else No back links for this page! #end ---- 1.1.1 Child Page Snippet #if($doc.name=="WebHome") #set($tree = $xwiki.doctree.getSpaceDocumentTree($doc.web)) #else #set($tree = $xwiki.doctree.getDocumentTree($doc)) #end #set($depths=["", "*", "**", "***", "****", "*****", "******", "*******", "********"]) #foreach($leaf in $tree) #if($leaf.depth <= 8 && ($leaf.depth != 0 || $doc.name=="WebHome")) $depths.get($leaf.depth) [$xwiki.getDocument($leaf.fullName).getDisplayTitle()>$leaf.fullName] #end #end ---- 1.1.1 Force Skin Snippet #if("$!request.skin" != "myskin") $response.sendRedirect($doc.getURL("view", "skin=myskin")) #end ---- 1.1.1 List Wiki Pages #set($web = $doc.web) #set($authorslist = $util.getArrayList()) #set($currentuser = $context.user) #foreach($page in $xwiki.getSpaceDocsName($web)) #set($author = $xwiki.getDocument("${web}.${page}").getCreator()) #if (!$authorslist.contains($author) && $author == $currentuser) #panelheader('Newly Created Page') #set($user=$context.user) #foreach($subdoc in $xwiki.getSpaceDocsName("$doc.web")) #set($author = $xwiki.getDocument("${doc.web}.${subdoc}").getCreator()) #if($author==$user) - [${doc.web}.${subdoc}] #end #end #panelfooter() #set ($discard = $authorslist.add($author)) #end #end ---- 1.1.1 Page Index Snippet #set($plaincontent = $doc.getContent()) <% vcontext=context.get("vcontext"); plaincontent=vcontext.get("plaincontent"); backSubString = plaincontent; i=0; sternchen=["*", "**", "***", "****", "*****", "******"] while (backSubString.matches("(?s).*\\n1(\\.1)* .*")){ level=1; backSubString = backSubString.split("\\n1", 2)[1]; while (backSubString.matches("(?s)\\.1.*")){ level++; backSubString=backSubString.split("\\.1", 2)[1]; } if (! backSubString.matches("(?s)\\..*")) { // is not a List heading=backSubString.split("[\\n\\r]", 2)[0]; encHeading=URLEncoder.encode(heading, "UTF-8"); encHeading=encHeading.replaceAll("[+%-\\.]", ""); println(sternchen[level-1] + " ["+heading+">#H"+encHeading+"]"); i++; } else { backSubString=backSubString.split("\\.(1\\.)*", 2)[1]; } } %> ---- 1.1.1 Recently Visited Snippet #set($rv_maxItems = $!xwiki.getUserPreference("recent_actions_items")) #if($rv_maxItems == "") #set($rv_maxItems = 5) #end #set($recentlyViewed = $xwiki.getRecentActions("view", $rv_maxItems)) #foreach($docname in $recentlyViewed) #set($rdoc = $xwiki.getDocument($docname).getTranslatedDocument()) * <a href="$rdoc.getURL("view")">$rdoc.displayTitle</a> #end ---- 1.1.1 Rss Macro {rss:feed=http://beust.com/weblog/index.rdf|full=true|count=3} ---- 1.1.1 Code Check ---- #if($xwiki.exists("Main.Sandbox")) ==== if xwiki.exists("Main.Sandbox") ==== #end ---- #if($doc.getDisplayTitle() == "Sandbox for Wiki editors") ==== if doc.getDisplayTitle() == "Sandbox for Wiki editors" ==== #end ---- #if($doc.getExternalURL() == "http://wiki.aspire.objectweb.org/xwiki/bin/view/Main/Sandbox?skin=myskin#aspire") ==== if doc.getExternalURL() == "http://wiki.aspire.objectweb.org/xwiki/bin/view/Main/Sandbox?skin=myskin#aspire" ==== #end ---- #if($doc.getFullName() == ("Main.Sandbox")) ==== if doc.getFullName() == ("Main.Sandbox") ==== #end ---- #if($doc.getName() == ("Sandbox")) ==== if doc.getName() == ("Sandbox") ==== #end ---- #if($doc.getURL() == "http://wiki.aspire.objectweb.org/xwiki/bin/view/Main/Sandbox?skin=myskin#aspire") ==== if doc.getURL() == "http://wiki.aspire.objectweb.org/xwiki/bin/view/Main/Sandbox?skin=myskin#aspire" ==== #end ---- #set($query = "where doc.parent is null or doc.parent='' order by doc.name asc") #foreach($item in $xwiki.searchDocuments($query)) #set($lostdoc = $xwiki.getDocument($item)) * [${lostdoc.web}.${lostdoc.name}>${lostdoc.web}.${lostdoc.name}] #end 1.1.1 text collors <dl style="color:blue">Blue</dl> <dl style="color:red"> Red </dl> <dl style="color:green"> Green </dl> * Test <dl style="color:blue"> * Blue dl </dl> * Test <span style="color:blue"> * Blue span </span> * Test <p style="color:blue"> * Blue p </p> * Test <b style="color:blue"> * Blue b </b> * Test <font style="color:blue"> * Blue font </font> * Test * Test * Test * Test * Test * Test * Test <dl style="color:red"> * Red </dl> <dl style="color:green"> * Green</dl> ----- <center> 1.1.1 Recently Visited </center> <div id="xwikirecentmenulinks" class="xwikimenulinks"> #set($recentlyviewed = $xwiki.getRecentActions("view", 5)) #foreach($docname in $recentlyviewed) #set($rdoc = $xwiki.getDocument($docname)) <a href="$rdoc.getURL("view")">$rdoc.name</a> <span class="xwikisep"> | </span> #end </div> #end ---------- 1.1.1 Photo Album {table} Photo|Title|Description|Comments #set ($sql = ", BaseObject as obj where obj.name=doc.fullName and obj.className='XWiki.PhotoAlbumClass' and obj.name <> 'XWiki.PhotoAlbumClassTemplate' order by doc.creationDate desc") #foreach ($item in $xwiki.searchDocuments($sql)) 1 #set($bentrydoc = $xwiki.getDocument($item)) #set($comments = $bentrydoc.getComments()) #if($comments.size()>0) #set($i = 0) #set($cobj = $comments.get($i)) #set($comment = $bentrydoc.display("comment", "view", $cobj)) #else #set($comment = "") #end #set($comment = $comment.replaceAll("\n","<br />")) #set($obj = $bentrydoc.getObject("XWiki.PhotoAlbumClass",0)) #if($bentrydoc.attachmentList.size()>0) #set($attach = $bentrydoc.attachmentList.get(0)) <img src="$bentrydoc.getAttachmentURL($attach.filename,"download")" height="50"/>|[$!{bentrydoc.display("title","view",$obj)}>$item] | $!bentrydoc.display("description", "view", $obj) | $!comment #else [No photo>$item]|[$!{bentrydoc.display("title","view",$obj)}>$item] | $!bentrydoc.display("description","view",$obj) | $!comment #end #end {table}