General Actions:
Log-in
Register
Wiki:
xwiki
▼
:
Document Index
»
Space:
Species
▼
:
Document Index
»
Page:
SpeciesSheet
Search
en
Page Actions:
Export
▼
:
Export as PDF
Export as HTML
More actions
▼
:
Print preview
View Source
Main.WebHome
»
XWiki Space
»
Data types
»
Species Class
»
Wiki source code of
Species Sheet
Hide line numbers
1: {{groovy}} 2: //-- definitions --------------------------- 3: def clazzName = 'Species.SpeciesClass' 4: def docObject = doc.getObject(clazzName) 5: def clazz = docObject?.xWikiClass 6: 7: if (!clazz){ 8: println services.localization.render("speciesApp.noClassFound",[clazzName]) 9: return 10: } 11: 12: xwiki.ssx.use("Species.Tech StylesheetExtensionIkonoteka") 13: xwiki.jsx.use("Tech QuerySpecificationsServiceWidget") 14: 15: def hierarchyRoof = 'Species.Gatunki' 16: def enableValidation = true 17: def aiautil = xwiki.parseGroovyFromPage("Species.Tech IkonotekaScripts") 18: def splitClassName = aiautil.splitClassName(clazzName) 19: def showTwoPictures = "true" == services.localization.render("speciesApp.${clazzName}.configuration.showTwoMainPictures")?true:false; 20: 21: aiautil.includeGalleryJsxHeader(xwiki) 22: 23: //-- methods ------------------------------- 24: def defaultPrintClosure = { 25: println "**${services.localization.render("speciesApp.${clazzName}."+it.name)}**" 26: println doc.display(it.name) 27: println "" 28: } 29: //------------------------------------------ 30: 31: //-- hierarchy ----------------------------- 32: def aiaHierarchyTreeCode = aiautil.getXwikicode4Tree(xwiki,doc,["Species.SpecificationClass","Species.SpeciesClass"]) 33: request.setAttribute("aiaHierarchyTreeCode", aiaHierarchyTreeCode) 34: 35: //-- validation/post edition modifing ------ 36: if(enableValidation){ 37: println """{{html}}<input type="hidden" name="xvalidate" value="1" /> 38: <input type="hidden" name="xvalidation" value="${splitClassName[0]}.Tech Validation${splitClassName[1]}" />{{/html}}""" 39: } 40: 41: //-- properties ---------------------------- 42: def specialPropsNames = ["pSystGatunek", 43: "pRysunek", 44: "pRysunek2", 45: "pRysunekInne", 46: "pPodpis", 47: "pAutorWpisuIkonoteki", 48: "pRokWpisuIkonoteki", 49: "pAutorOpisu", 50: "pRokOpisu2", 51: "pAlternatywnaCytacja", 52: "pNumer"] 53: 54: def plainProps = clazz?.properties.grep{!it.isDisabled()} 55: def specificationProps = plainProps.grep{it?.name.startsWith("pSyst") } 56: specificationProps = specificationProps.grep{!specialPropsNames.contains(it.name)} 57: def populTypProps = plainProps.grep{it?.name.startsWith("pPopulTyp") } 58: def specialProps = [:] 59: specialPropsNames.each{specialPropName -> 60: def tmpProp = plainProps.find{it?.name == specialPropName} 61: specialProps[specialPropName] = tmpProp 62: } 63: plainProps = plainProps.minus(populTypProps).minus(specificationProps).minus(specialProps.values()) 64: 65: //-- sekcja wydruku ------------------------ 66: // <wybor_parenta> 67: if (xcontext.action=='edit' || xcontext.action=='inline') { 68: def parentName = aiautil.computeParentFullNameWithCache(doc.getDocument(), clazzName, request)?.parentFullName 69: def parentTitle = "" 70: if (xwiki.exists(parentName)){ 71: def parentObj = xwiki.getDocument(parentName) 72: parentTitle = parentObj.getTitle() 73: } 74: //<form method="post" action="#"> 75: println """ 76: {{html}} 77: <label for="myinput">${services.localization.render("speciesApp.${clazzName}.template.parentInputFieldName")}</label> 78: <input id="myinput_suggest" name="myinput_suggest" type="text" value="$parentTitle"/> 79: <input id="myinput" name="myinput" type="hidden" value="$parentName" /> 80: {{/html}} 81: """ 82: //</form> 83: 84: } 85: def interceptParentName = request.getParameter("myinput") 86: if (interceptParentName && doc.getParent() != interceptParentName){ 87: doc.setParent(interceptParentName) 88: } 89: // </wybor_parenta> 90: // <sugerowana_cytacja> 91: if (xcontext.action!='edit' && xcontext.action!='inline') { 92: def pAlternatywnaCytacja=docObject.getProperty("pAlternatywnaCytacja")?.getValue() 93: print "**${services.localization.render("speciesApp.${clazzName}.template.sugerowanCytacja")}** " 94: print "${docObject.get("pAutorWpisuIkonoteki")} " 95: print "${docObject.get("pRokWpisuIkonoteki")}. " 96: print "//${docObject.get("pSystGatunek")}// " 97: if (pAlternatywnaCytacja){ 98: print "${pAlternatywnaCytacja}" 99: } else { 100: print "${docObject.get("pAutorOpisu")} " 101: print "${docObject.get("pRokOpisu2")}." 102: } 103: print " //Ikonoteka// " 104: println "(${request.requestURL.toString().replaceAll("//","~/~/")})" 105: } 106: // </sugerowana_cytacja> 107: aiautil.mergeImageInfoObjects(doc) 108: println """(% class="aiaMainTable" %)""" 109: print """|(% class="aiaMainTableLeftCol" %)(((""" 110: if (["edit","inline"].contains(xcontext.action)){ 111: println "${services.localization.render("speciesApp.tips.howToAddImage")}" 112: } 113: print aiautil.getGalleryHtml(doc, xcontext, services) 114: 115: plainProps.each{ 116: defaultPrintClosure(it) 117: println "" 118: } 119: print ")))" 120: 121: print """|(% class="aiaMainTableRightCol" %)(((""" 122: //-- specyfikacja ---------------------- 123: if (xcontext.action=='edit' || xcontext.action=='inline') { 124: ["pAutorWpisuIkonoteki", 125: "pRokWpisuIkonoteki", 126: "pAutorOpisu", 127: "pRokOpisu2", 128: "pAlternatywnaCytacja"].each { 129: defaultPrintClosure(specialProps[it]) 130: } 131: } 132: 133: def showHierarchy = true //hierarchy && hierarchy.size() > 0 134: if (showHierarchy) { 135: println "|=${services.localization.render("speciesApp.${clazzName}.template.specyfikacja")}" 136: print "|(((" 137: if (xcontext.action!='edit' && xcontext.action!='inline') { 138: def hierarchyResult = aiautil.queryUpperHierarchy(xwiki,doc,hierarchyRoof) 139: def hierarchy = hierarchyResult.hierarchy 140: hierarchy.each { 141: println "**${it.pSpecType}**" 142: def pSpecValueToPrint = it.pSpecValue 143: if (aiautil.taksonyPisaneKursywa.contains(it.pSpecType)){ 144: pSpecValueToPrint = "//${it.pSpecValue}//" 145: } 146: println pSpecValueToPrint 147: println "" 148: } 149: } 150: 151: def properTitle = docObject.get("pSystGatunek") 152: if (doc.getTitle() != properTitle) { 153: doc.setTitle(properTitle) 154: } 155: def pSystGatunek = specialProps["pSystGatunek"] 156: def pSystGatunekVal = docObject.get("pSystGatunek") 157: println "**${services.localization.render("speciesApp.${clazzName}."+pSystGatunek.name)}**" 158: println "//${doc.display(pSystGatunek.name)}//" 159: println "" 160: specificationProps.each { 161: defaultPrintClosure(it) 162: } 163: print ")))" 164: println "" 165: } 166: 167: 168: //-- populacja typowa gatunku----------- 169: println "|=${services.localization.render("speciesApp.${clazzName}.template.populacjaTypowaGatunku")}" 170: println "|(((" 171: populTypProps.each{ 172: defaultPrintClosure(it) 173: println "" 174: } 175: println ")))" 176: println ")))" 177: 178: println "" 179: //-- EO sekcja wydruku --------------------- 180: 181: /* 182: {{velocity}} 183: #set ($attachments = $doc.attachmentList) 184: #if ($attachments.size() > 0 && "export" != $context.action) 185: {{photoalbum ImageSizeList="-" ThumbSizeList="-" Sort="date"/}} 186: #end 187: {{/velocity}} 188: */ 189: 190: {{/groovy}} 191: 192: 193: 194: \\
Kategorie
Koncepcja
Gatunki
Stanowiska
Sponsorzy
Instytut Paleobiologii PAN
Klasyfikacja