Hi,

I extended two panels in a way that makes life more easy for the common user 
(XWiki/XE 2.2.4): create panel, documenent info (editor).

1. The create page panel (Panels.NewPage)
-shows current spacename
-'create space' option is only shown when the user has the appropriate rights, 
and is at the top-level of the wiki 
-automatically generates a link to the parent page (but not to the 
WebPreferences page)

#if($hasEdit || $showEmptyPanels)
#panelheader($msg.get("create"))
<form method="post" action="$doc.getURL("view", "xpage=create")">
<div class="padded centered">
<label for="tocreate" class="hidden">$msg.get("xe.panels.new.itemType")</label>
<select id="tocreate" name="tocreate" class="panelselect">
  <option value="page">$msg.get("xe.panels.new.page")</option>
  #if ($hasCreateSpace && $doc.fullName == "Main.WebHome") 
    <option value="space">$msg.get("xe.panels.new.space")</option>
  #end
</select>
</div>
<div class="padded centered">
<input type="hidden" name="template" value="" />
#if($doc.Name!="WebPreferences")
<input type="hidden" name="parent" value="$msg.get("$doc.Space.$doc.Name")" />
#end
<label for="title" class="hidden">$msg.get("xe.panels.new.name")</label>
<input type="text" id="title" name="title" 
value="$msg.get("xe.panels.new.name")" class="panelinput" 
onfocus="if(this.value=='$msg.get("xe.panels.new.name")') this.value=''" 
onblur="if(this.value=='') this.value='$msg.get("xe.panels.new.name")'"/>
In space: $doc.Space<br>
</div>
<div class="padded centered">
<input type="submit" class="button" value="$msg.get("create")"/>
</div>
</form>
#panelfooter()
#end

2. Setting the parent page in the editor
-now shows a dropdown list with all the pages in the current space, which is 
much easier than remembering the exact documentname

In: Panels.DocumentInformation

Replaced:
<dd><input type="text" id="xwikidocparentinput2" name="parent" 
value="$!tdoc.parent" size="30"/></dd>

By:
<dd><select name="parent" class="panelselect">
<option value="$!tdoc.parent" selected="selected">$!tdoc.parent</option>
<option value="">-Empty \*-</option>
#foreach($subdoc in $xwiki.getSpaceDocsName("$doc.web"))
  #if($subdoc!="WebPreferences")
    <option value="$subdoc">$subdoc</option>
  #end
#end
</select></dd>

3. Default language chooser
-in a mulitlingual XWiki: in the editor a dropdown box is shown with the  
languages set in the XWiki preferences to choose from, but only those that are 
not avaiable as a translation, otherwise you'll end up with two translations of 
the same name.

In: Panels.DocumentInformation

Original:
#if(($tdoc.language=="")&&($xwiki.isMultiLingual()))
<dt><label 
for="xwikidoclanguageinput2">$msg.get("panels.documentInformation.defaultLanguage")</label></dt>
<dd><input type="text" id="xwikidoclanguageinput2" name="defaultLanguage" 
value="$!tdoc.defaultLanguage" size="30"/></dd>
#end

Becomes:
#if(($tdoc.language=="")&&($xwiki.isMultiLingual()))
<dt><label 
for="xwikidoclanguageinput2">$msg.get("panels.documentInformation.defaultLanguage")</label></dt>
<dd><select name="defaultLanguage" class="panelselect">
<option value="$!tdoc.defaultLanguage" id="xwikidoclanguageinput2" 
selected="selected">$!tdoc.defaultLanguage</option>
#foreach($olang in $xwiki.getXWikiPreference("languages").split("[|, ]"))
  #set($showlang=true)
  #foreach($tlang in $doc.translationList)
    #if($olang==$tlang)
      #set($showlang=false)
    #end
  #end
  #if($tdoc.defaultLanguage!=$olang&&$showlang!=false)
    <option value="$!olang">$olang</option>
  #end
#end
</select></dd>
#end

Hope this is helpful for others too!

And, if this is not the appropriate place to send this info to, just let me 
know.

Wouter
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to