Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {{velocity}}
- #set($glossaryHome = $doc.getObject("Glossary.GlossaryClass"))
- #if($glossaryHome)
- ## Don't display doc extra tabs for Glossary home pages
- #set($docextras=[])
- $doc.use("Glossary.GlossaryClass")
- ## The space where to add and search for Glossary Entries
- #set ($glossarySpace = $doc.space)
- ## If this page is called with createGlossary=true then create a new page using the GlossaryTemplate template
- #if ($request.createGlossary == 'true')
- ## Remove the "?" if it's the last character since the Glossary sheet adds one automatically
- #set ($glossaryItem = $stringtool.stripEnd($stringtool.trim($!{request.glossaryItem}), '?'))
- ## If there's no glossaryItem then issue a warning below
- #if (!$stringtool.isBlank($glossaryItem))
- #set ($newGlossaryReference = $services.model.createDocumentReference('', '', "$glossaryItem"))
- $response.sendRedirect($xwiki.getURL($newGlossaryReference, 'inline', "$!{request.queryString}&title=${escapetool.url($glossaryItem)}"))
- #end
- #end
- ##Adding 'Add Glossary' button on the main page
- (((
- {{html wiki = "true"}}
- #if ($isGuest)
- #set($login = ${escapetool.xml($doc.getURL("login", "xredirect=$doc.externalURL"))})
- #set($register = ${escapetool.xml($xwiki.getURL($services.model.resolveDocument('', 'default'), "register", "xredirect=$doc.externalURL"))})
- $services.localization.render('platform.glossary.need', ["<a href=$login>","</a>","<a href=$register>","</a>"])
- #else
- <form action="$doc.getURL()" id="newglossary" class="xformInline">
- <div>
- <input type="hidden" name="parent" value="${glossarySpace}.WebHome" />
- <input type="hidden" name="template" value="Glossary.GlossaryTemplate" />
- <input type="hidden" name="createGlossary" value="true" />
- #if ($request.createGlossary == 'true' && $stringtool.isBlank($glossaryItem))
- {{error}}$services.localization.render('platform.glossary.create.empty'){{/error}}
- #end
- <input class="withTip" type="text" name="glossaryItem" value="$services.localization.render('glossary.add.searchHint')" size="16"/>
- <span class="buttonwrapper">
- <input class="btn btn-success button" type="submit" value="$services.localization.render('glossary.add.submit')" />
- </span>
- </div>
- </form>
- #end
- {{/html}}
- )))
- #end
- {{/velocity}}
Add Comment
Please, Sign In to add comment