Two small modifications for XWIKI
Halo, I am only beginner in xwiki but I have two small modifications which can improve usability of xwiki. 1) modification of panel "Create" to allow automaticaly set parent page to actual page There is only: - hidden input 'docFullName' where is stored actual page full name - text input 'parent' where can write parent full name but if you focus this input there is filled value of hidden input Modification is adding this lines after input 'title' in Create panel source <input type="hidden" id="docFullName" value="$doc.getFullName()"/> Parent page: <input id="xwikidocparentinput2" type="text" name="parent" value="" class="panelinput" style="margin:auto;" onfocus="if(this.value=='') this.value=document.getElementById('docFullName').value;"/> 2) modification of panel Navigation it will be nice to have pages in navigation in hierarchy - first level pages without parent and next levels pages with their parents My modification is not ideal (one hour learning velocity, programing and testing) but it works. There are only 3 levels because more levels are not allowed by wiki syntax for lists (therefore I created new panel where is all docs in actual space for our instalation of XWiki beta3 - I look forward to next releases). There is full source code: (code between ## START Second level and ## END Second level is new and in first level is modified only $hql definition) #panelhiddenheader("Navigation") #set ($hiddenSpaces = ["XWiki", "Admin", "Panels"]) #set ($hiddenPages = ["Main.WebRss", "Main.WebSearch", "Main.BlogRss","Main.Test", "Blog.Macros", "Main.TagsRss", "Main.Ouverture", "Main.WikiLaunch", "Main.RegisterNewUserAction", "Main.SpaceIndex", "Blog.Category"]) #set ($blackListedPages = ["WebPreferences"]) <div id="xwikinavcontainer"> #set($spaces = $xwiki.spaces) #set($i = 0) #set($spacecount = 0) <div id="xwikinav"> #foreach($space in $spaces) #if (!$hiddenSpaces.contains($space)) #if ($doc.web == $space) #set ($spacecount = $i) #end #set($i = $i + 1) <div id="xwikinav${space}"> <div id="xwikinav${space}Header" class="accordionTabTitleBar"><h6>$space</h6></div> <div id="xwikinav${space}Content" class="accordionTabContentBox"> ## START First level (pages without parents) #set($hql = $xwiki.searchDocuments("doc.web='$space' and doc.parent='' order by doc.name")) #foreach($page in $hql) #if (!$hiddenPages.contains($page)) #set($dotIndex = $page.indexOf(".")+1) #set($pageName = $page.substring($dotIndex, $page.length())) #if (!$blackListedPages.contains($pageName)) #if ($doc.fullName == $page) - *$xwiki.getDocument($page).name* #else - [$page] #end #end ## START Second level #set($hql2 = []) #set($hql2 = $xwiki.searchDocuments("doc.web='$space' and doc.parent='$page' order by doc.name")) #foreach($page2 in $hql2) #if (!$hiddenPages.contains($page2)) #set($dotIndex = $page2.indexOf(".")+1) #set($pageName = $page2.substring($dotIndex, $page2.length())) #if (!$blackListedPages.contains($pageName)) #if ($doc.fullName == $page2) -- *$xwiki.getDocument($page2).name* #else -- *[$page2]* #end #end ## START Third level #set($hql3 = []) #set($hql3 = $xwiki.searchDocuments("doc.web='$space' and doc.parent='$page2' order by doc.name")) #foreach($page3 in $hql3) #if (!$hiddenPages.contains($page3)) #set($dotIndex = $page3.indexOf(".")+1) #set($pageName = $page3.substring($dotIndex, $page3.length())) #if (!$blackListedPages.contains($pageName)) #if ($doc.fullName == $page3) --- *$xwiki.getDocument($page3).name* #else --- [$page3] #end #end #end #end ## END Third level #end #end ## END Second level #end #end ## END First level </div> </div> #end #end </div> </div> <script type="text/javascript">new Rico.Accordion( 'xwikinav', {panelHeight:'250',onLoadShowTab:'$spacecount'} );</script> #panelfooter() 3) next I have one question: Can I deny creating new space to all user except admin? 4) another one small question: Is there some plugin to syntax highlight source codes? Macro {code} is very poor. I was working on syntax highlighting source codes in html on our university (I am staff of this university) for our documentation "server" (static pages). I have implemented that in Java for JAVA, XML, SQL source codes. If there isn't such plugin I would like to implement it and give it to XWiky community. Zdenek Machac Masaryk University Czech Republic
I too am a newbie to XWiki. I am now using this code which works well. I am however not conversant with Velocity but would suggest the following option, essentially folding subdirectories. In this mechanism you only see structure down to the current document. If you go up a level documents below are folded away. I dont know if this is possible with Velocity? I agree with your comments about "Create" new page and new Space. Ditto syntax highlighting I use Eclipse which has a nice contextual Velocity editor Zdenek Machac wrote:
Halo,
I am only beginner in xwiki but I have two small modifications which can improve usability of xwiki.
1) modification of panel "Create" to allow automaticaly set parent page to actual page
There is only: - hidden input 'docFullName' where is stored actual page full name - text input 'parent' where can write parent full name but if you focus this input there is filled value of hidden input
Modification is adding this lines after input 'title' in Create panel source
<input type="hidden" id="docFullName" value="$doc.getFullName()"/> Parent page: <input id="xwikidocparentinput2" type="text" name="parent" value="" class="panelinput" style="margin:auto;" onfocus="if(this.value=='') this.value=document.getElementById('docFullName').value;"/>
2) modification of panel Navigation
it will be nice to have pages in navigation in hierarchy - first level pages without parent and next levels pages with their parents
My modification is not ideal (one hour learning velocity, programing and testing) but it works.
There are only 3 levels because more levels are not allowed by wiki syntax for lists (therefore I created new panel where is all docs in actual space for our instalation of XWiki beta3 - I look forward to next releases).
There is full source code: (code between ## START Second level and ## END Second level is new and in first level is modified only $hql definition)
#panelhiddenheader("Navigation") #set ($hiddenSpaces = ["XWiki", "Admin", "Panels"]) #set ($hiddenPages = ["Main.WebRss", "Main.WebSearch", "Main.BlogRss","Main.Test", "Blog.Macros", "Main.TagsRss", "Main.Ouverture", "Main.WikiLaunch", "Main.RegisterNewUserAction", "Main.SpaceIndex", "Blog.Category"]) #set ($blackListedPages = ["WebPreferences"]) <div id="xwikinavcontainer"> #set($spaces = $xwiki.spaces) #set($i = 0) #set($spacecount = 0) <div id="xwikinav"> #foreach($space in $spaces) #if (!$hiddenSpaces.contains($space)) #if ($doc.web == $space) #set ($spacecount = $i) #end #set($i = $i + 1) <div id="xwikinav${space}"> <div id="xwikinav${space}Header" class="accordionTabTitleBar"><h6>$space</h6></div> <div id="xwikinav${space}Content" class="accordionTabContentBox">
## START First level (pages without parents)
#set($hql = $xwiki.searchDocuments("doc.web='$space' and doc.parent='' order by doc.name")) #foreach($page in $hql) #if (!$hiddenPages.contains($page)) #set($dotIndex = $page.indexOf(".")+1) #set($pageName = $page.substring($dotIndex, $page.length())) #if (!$blackListedPages.contains($pageName)) #if ($doc.fullName == $page) - *$xwiki.getDocument($page).name* #else - [$page] #end #end
## START Second level
#set($hql2 = []) #set($hql2 = $xwiki.searchDocuments("doc.web='$space' and doc.parent='$page' order by doc.name")) #foreach($page2 in $hql2) #if (!$hiddenPages.contains($page2)) #set($dotIndex = $page2.indexOf(".")+1) #set($pageName = $page2.substring($dotIndex, $page2.length())) #if (!$blackListedPages.contains($pageName)) #if ($doc.fullName == $page2) -- *$xwiki.getDocument($page2).name* #else -- *[$page2]* #end #end
## START Third level
#set($hql3 = []) #set($hql3 = $xwiki.searchDocuments("doc.web='$space' and doc.parent='$page2' order by doc.name")) #foreach($page3 in $hql3) #if (!$hiddenPages.contains($page3)) #set($dotIndex = $page3.indexOf(".")+1) #set($pageName = $page3.substring($dotIndex, $page3.length())) #if (!$blackListedPages.contains($pageName)) #if ($doc.fullName == $page3) --- *$xwiki.getDocument($page3).name* #else --- [$page3] #end #end #end #end
## END Third level
#end #end
## END Second level
#end #end
## END First level
</div> </div> #end #end </div> </div> <script type="text/javascript">new Rico.Accordion( 'xwikinav', {panelHeight:'250',onLoadShowTab:'$spacecount'} );</script> #panelfooter()
3) next I have one question: Can I deny creating new space to all user except admin?
4) another one small question: Is there some plugin to syntax highlight source codes? Macro {code} is very poor. I was working on syntax highlighting source codes in html on our university (I am staff of this university) for our documentation "server" (static pages). I have implemented that in Java for JAVA, XML, SQL source codes.
If there isn't such plugin I would like to implement it and give it to XWiky community.
Zdenek Machac Masaryk University Czech Republic
------------------------------------------------------------------------
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
participants (2)
-
Steve Turner -
Zdenek Machac