General Actions:
Log-in
Register
Wiki:
xwiki
▼
:
Document Index
»
Space:
Species
▼
:
Document Index
»
Page:
SpecificationSheet
Search
en
Page Actions:
Export
▼
:
Export as PDF
Export as HTML
More actions
▼
:
Print preview
View Source
Main.WebHome
»
XWiki Space
»
Data types
»
Specification Class
»
Wiki source code of
Specification Sheet
Show line numbers
{{groovy}} //-- definitions --------------------------- def clazzName = 'Species.SpecificationClass' def docObject = doc.getObject(clazzName) def clazz = docObject?.xWikiClass if (!clazz){ println services.localization.render("speciesApp.noClassFound",[clazzName]) return } xwiki.ssx.use("Species.Tech StylesheetExtensionIkonoteka") xwiki.jsx.use("Tech QuerySpecificationsServiceWidget") def hierarchyRoof = 'Species.Gatunki' def enableValidation = true def aiautil = xwiki.parseGroovyFromPage("Species.Tech IkonotekaScripts") def splitClassName = aiautil.splitClassName(clazzName) def showTwoPictures = "true" == services.localization.render("speciesApp.${clazzName}.configuration.showTwoMainPictures")?true:false; //-- methods ------------------------------- def defaultPrintClosure = { println "**${services.localization.render("speciesApp.${clazzName}."+it.name)}**" println doc.display(it.name) println "" } //------------------------------------------ //-- hierarchy ----------------------------- def aiaHierarchyTreeCode = aiautil.getXwikicode4Tree(xwiki,doc,["Species.SpecificationClass","Species.SpeciesClass"]) request.setAttribute("aiaHierarchyTreeCode", aiaHierarchyTreeCode) //-- validation/post edition modifing ------ if(enableValidation){ println """{{html}}<input type="hidden" name="xvalidate" value="1" /> <input type="hidden" name="xvalidation" value="${splitClassName[0]}.Tech Validation${splitClassName[1]}" />{{/html}}""" } //-- isGenus ------------------------------- def isGenus = {obj -> def tmpPSpecType = obj.getProperty("pSpecType").getValue() return tmpPSpecType == "Rodzaj" } //-- properties ---------------------------- def specialPropsNames = ["pRysunek", "pRysunek2", "pRysunekInne", "pPodpis", "pAutor", "pSpecType", "pSpecValue", "pSort", "pAutorOpisu", "pRokOpisu"] //brak property pGatunekTypowy poza rodzajem if (!isGenus(docObject)) { specialPropsNames << "pGatunekTypowy" } def plainProps = clazz?.properties.grep{!it.isDisabled()} def specialProps = [:] specialPropsNames.each{specialPropName -> def tmpProp = plainProps.find{it?.name == specialPropName} specialProps[specialPropName] = tmpProp } plainProps = plainProps.minus(specialProps.values()) //-- sekcja wydruku ------------------------ //print " **${services.localization.render("speciesApp.${clazzName}.pAutor")}** " //println doc.display("pAutor") // <wybor_parenta> if (xcontext.action=='edit' || xcontext.action=='inline') { def parentName = aiautil.computeParentFullNameWithCache(doc.getDocument(), clazzName, request)?.parentFullName def parentTitle = "" if (xwiki.exists(parentName)){ def parentObj = xwiki.getDocument(parentName) parentTitle = parentObj.getTitle() } //<form method="post" action="#"> println """ {{html}} <label for="myinput">${services.localization.render("speciesApp.${clazzName}.template.parentInputFieldName")}</label> <input id="myinput_suggest" name="myinput_suggest" type="text" value="$parentTitle"/> <input id="myinput" name="myinput" type="hidden" value="$parentName" /> {{/html}} """ //</form> } def interceptParentName = request.getParameter("myinput") if (interceptParentName && doc.getParent() != interceptParentName){ doc.setParent(interceptParentName) } // </wybor_parenta> if (showTwoPictures){ println """(% class="aiaTwoPictureTable" %)""" print """|(% class="aiaTwoPictureTableLeftCol" %)(((""" print doc.display(specialProps.pRysunek.name) print """)))|(% class="aiaTwoPictureTableRightCol" %)(((""" print doc.display(specialProps.pRysunek2.name) println ")))" } println """(% class="aiaMainTable" %)""" print """|(% class="aiaMainTableLeftCol" %)(((""" if (!showTwoPictures && specialProps.pRysunek){ println doc.display(specialProps.pRysunek.name) } //println """((((% class="aiaMainTableLeftCol_pPodpis" %)""" //println """${doc.display("pPodpis")} )))""" plainProps.each{ defaultPrintClosure(it) println "" } print ")))" print """|(% class="aiaMainTableRightCol" %)(((""" //-- specyfikacja ---------------------- if (xcontext.action=='edit' || xcontext.action=='inline') { ["pAutorOpisu", "pRokOpisu"].each { defaultPrintClosure(specialProps[it]) } } def showHierarchy = true //hierarchy && hierarchy.size() > 0 if (showHierarchy) { println "|=${services.localization.render("speciesApp.${clazzName}.template.specyfikacja")}" print "|(((" if (xcontext.action!='edit' && xcontext.action!='inline') { def hierarchyResult = aiautil.queryUpperHierarchy(xwiki,doc,hierarchyRoof) def hierarchy = hierarchyResult.hierarchy hierarchy.each { println "**${it.pSpecType}**" def pSpecValueToPrint = it.pSpecValue if (aiautil.taksonyPisaneKursywa.contains(it.pSpecType)){ pSpecValueToPrint = "//${it.pSpecValue}//" } println pSpecValueToPrint println "" } println "**${docObject.pSpecType}**" def pSpecValueToPrint = docObject.pSpecValue if (aiautil.taksonyPisaneKursywa.contains(docObject.pSpecType)){ pSpecValueToPrint = "//${docObject.pSpecValue}//" } println pSpecValueToPrint } else { //cacheowanie pSpecType w przypadku nowych obiektów (powinno być takie jak ostatnio zapisane) if (doc.isNew()) { def pSpecTypeCached = aiautil.getLastFromCache(request, clazzName, specialProps.pSpecType.name) if (pSpecTypeCached) { docObject.set(specialProps.pSpecType.name, pSpecTypeCached) } } defaultPrintClosure(specialProps.pSpecType) defaultPrintClosure(specialProps.pSpecValue) defaultPrintClosure(specialProps.pSort) } print ")))" println "" } println ")))" println "" //-- EO sekcja wydruku --------------------- {{/groovy}} \\
Kategorie
Koncepcja
Gatunki
Stanowiska
Sponsorzy
Instytut Paleobiologii PAN
Klasyfikacja