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
Hide line numbers
1: {{groovy}} 2: //-- definitions --------------------------- 3: def clazzName = 'Species.SpecificationClass' 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: //-- methods ------------------------------- 22: def defaultPrintClosure = { 23: println "**${services.localization.render("speciesApp.${clazzName}."+it.name)}**" 24: println doc.display(it.name) 25: println "" 26: } 27: //------------------------------------------ 28: 29: //-- hierarchy ----------------------------- 30: def aiaHierarchyTreeCode = aiautil.getXwikicode4Tree(xwiki,doc,["Species.SpecificationClass","Species.SpeciesClass"]) 31: request.setAttribute("aiaHierarchyTreeCode", aiaHierarchyTreeCode) 32: 33: //-- validation/post edition modifing ------ 34: if(enableValidation){ 35: println """{{html}}<input type="hidden" name="xvalidate" value="1" /> 36: <input type="hidden" name="xvalidation" value="${splitClassName[0]}.Tech Validation${splitClassName[1]}" />{{/html}}""" 37: } 38: 39: //-- isGenus ------------------------------- 40: def isGenus = {obj -> 41: def tmpPSpecType = obj.getProperty("pSpecType").getValue() 42: return tmpPSpecType == "Rodzaj" 43: } 44: 45: //-- properties ---------------------------- 46: def specialPropsNames = ["pRysunek", 47: "pRysunek2", 48: "pRysunekInne", 49: "pPodpis", 50: "pAutor", 51: "pSpecType", 52: "pSpecValue", 53: "pSort", 54: "pAutorOpisu", 55: "pRokOpisu"] 56: 57: //brak property pGatunekTypowy poza rodzajem 58: if (!isGenus(docObject)) { 59: specialPropsNames << "pGatunekTypowy" 60: } 61: 62: def plainProps = clazz?.properties.grep{!it.isDisabled()} 63: def specialProps = [:] 64: specialPropsNames.each{specialPropName -> 65: def tmpProp = plainProps.find{it?.name == specialPropName} 66: specialProps[specialPropName] = tmpProp 67: } 68: plainProps = plainProps.minus(specialProps.values()) 69: 70: //-- sekcja wydruku ------------------------ 71: //print " **${services.localization.render("speciesApp.${clazzName}.pAutor")}** " 72: //println doc.display("pAutor") 73: // <wybor_parenta> 74: if (xcontext.action=='edit' || xcontext.action=='inline') { 75: def parentName = aiautil.computeParentFullNameWithCache(doc.getDocument(), clazzName, request)?.parentFullName 76: def parentTitle = "" 77: if (xwiki.exists(parentName)){ 78: def parentObj = xwiki.getDocument(parentName) 79: parentTitle = parentObj.getTitle() 80: } 81: //<form method="post" action="#"> 82: println """ 83: {{html}} 84: <label for="myinput">${services.localization.render("speciesApp.${clazzName}.template.parentInputFieldName")}</label> 85: <input id="myinput_suggest" name="myinput_suggest" type="text" value="$parentTitle"/> 86: <input id="myinput" name="myinput" type="hidden" value="$parentName" /> 87: {{/html}} 88: """ 89: //</form> 90: 91: } 92: def interceptParentName = request.getParameter("myinput") 93: if (interceptParentName && doc.getParent() != interceptParentName){ 94: doc.setParent(interceptParentName) 95: } 96: // </wybor_parenta> 97: if (showTwoPictures){ 98: println """(% class="aiaTwoPictureTable" %)""" 99: print """|(% class="aiaTwoPictureTableLeftCol" %)(((""" 100: print doc.display(specialProps.pRysunek.name) 101: print """)))|(% class="aiaTwoPictureTableRightCol" %)(((""" 102: print doc.display(specialProps.pRysunek2.name) 103: println ")))" 104: } 105: println """(% class="aiaMainTable" %)""" 106: print """|(% class="aiaMainTableLeftCol" %)(((""" 107: if (!showTwoPictures && specialProps.pRysunek){ 108: println doc.display(specialProps.pRysunek.name) 109: } 110: 111: //println """((((% class="aiaMainTableLeftCol_pPodpis" %)""" 112: //println """${doc.display("pPodpis")} )))""" 113: plainProps.each{ 114: defaultPrintClosure(it) 115: println "" 116: } 117: print ")))" 118: 119: print """|(% class="aiaMainTableRightCol" %)(((""" 120: //-- specyfikacja ---------------------- 121: if (xcontext.action=='edit' || xcontext.action=='inline') { 122: ["pAutorOpisu", 123: "pRokOpisu"].each { 124: defaultPrintClosure(specialProps[it]) 125: } 126: } 127: 128: def showHierarchy = true //hierarchy && hierarchy.size() > 0 129: if (showHierarchy) { 130: println "|=${services.localization.render("speciesApp.${clazzName}.template.specyfikacja")}" 131: print "|(((" 132: if (xcontext.action!='edit' && xcontext.action!='inline') { 133: def hierarchyResult = aiautil.queryUpperHierarchy(xwiki,doc,hierarchyRoof) 134: def hierarchy = hierarchyResult.hierarchy 135: hierarchy.each { 136: println "**${it.pSpecType}**" 137: def pSpecValueToPrint = it.pSpecValue 138: if (aiautil.taksonyPisaneKursywa.contains(it.pSpecType)){ 139: pSpecValueToPrint = "//${it.pSpecValue}//" 140: } 141: println pSpecValueToPrint 142: println "" 143: } 144: println "**${docObject.pSpecType}**" 145: def pSpecValueToPrint = docObject.pSpecValue 146: if (aiautil.taksonyPisaneKursywa.contains(docObject.pSpecType)){ 147: pSpecValueToPrint = "//${docObject.pSpecValue}//" 148: } 149: println pSpecValueToPrint 150: } else { 151: //cacheowanie pSpecType w przypadku nowych obiektów (powinno być takie jak ostatnio zapisane) 152: if (doc.isNew()) { 153: def pSpecTypeCached = aiautil.getLastFromCache(request, clazzName, specialProps.pSpecType.name) 154: if (pSpecTypeCached) { 155: docObject.set(specialProps.pSpecType.name, pSpecTypeCached) 156: } 157: } 158: defaultPrintClosure(specialProps.pSpecType) 159: defaultPrintClosure(specialProps.pSpecValue) 160: defaultPrintClosure(specialProps.pSort) 161: } 162: print ")))" 163: println "" 164: } 165: println ")))" 166: 167: println "" 168: //-- EO sekcja wydruku --------------------- 169: 170: {{/groovy}} 171: 172: 173: 174: \\
Kategorie
Koncepcja
Gatunki
Stanowiska
Sponsorzy
Instytut Paleobiologii PAN
Klasyfikacja