Skip to content

Commit

Permalink
update template
Browse files Browse the repository at this point in the history
  • Loading branch information
ianibo committed Jan 25, 2024
1 parent 4b7098d commit 0b66311
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 25 deletions.
51 changes: 39 additions & 12 deletions kbplus/grails-app/views/licenseDetails/_lic_csv.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,47 @@
[col:'LicenceURL', value:{l, ctx -> raw(l.licenseUrl) }],
[col:'LicensorRef', value:{l, ctx -> raw(l.licensorRef) }],
[col:'LicenseeRef', value:{l, ctx -> raw(l.licenseeRef) }],
[col:'JiscLicenseId', value:{l, ctx -> raw(l.jiscLicenseId) }],
[col:'StartDate', value:{l, ctx -> l.startDate?formatter.format(l.startDate):'' } ],
[col:'EndDate', value: {l, ctx -> l.endDate?formatter.format(l.endDate):'' }],
[col:'Licence Category', value:{l, ctx -> l.licenseCategory?.value }],
[col:'Licence Status', value:{l, ctx -> l.status?.value } ]
]}"
/><g:set var="cgg" value="${[[col:'Custom Property Value',value:{l, p -> if(l.customProperties.find{it.type.name == p}) l.customProperties.find{it.type.name == p}.value}],
[col:'Custom Property Note', value:{l, p -> if(l.customProperties.find{it.type.name == p}) raw(l.customProperties.find{it.type.name == p}.note?.replaceAll('"','\''))}]
[col:'Licence Status', value:{l, ctx -> l.status?.value } ],
[col:'APC/Offsetting Offer', value:{l, ctx -> l.getCustomPropByName('APC/Offsetting Offer')?.value }],
[col:'APC/Offsetting Offer Notes', value:{l, ctx -> raw(l.getCustomPropByName('APC/Offsetting Offer')?.note?.replaceAll('"','\''))}],
[col:'Alumni Access', value:{l, ctx -> l.getCustomPropByName('Alumni Access')?.value }],
[col:'Alumni Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Alumni Access')?.note?.replaceAll('"','\''))}],
[col:'Annual Opt-Out', value:{l, ctx -> l.getCustomPropByName('Annual Opt-Out')?.value }],
[col:'Annual Opt-Out Notes', value:{l, ctx -> raw(l.getCustomPropByName('Annual Opt-Out')?.note?.replaceAll('"','\''))}],
[col:'Concurrent Access', value:{l, ctx -> l.getCustomPropByName('Concurrent Access')?.value }],
[col:'Concurrent Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Concurrent Access')?.note?.replaceAll('"','\''))}],
[col:'Concurrent Users', value:{l, ctx -> l.getCustomPropByName('Concurrent Users')?.value }],
[col:'Concurrent Users Notes', value:{l, ctx -> raw(l.getCustomPropByName('Concurrent Users')?.note?.replaceAll('"','\''))}],
[col:'Enterprise Access', value:{l, ctx -> l.getCustomPropByName('Enterprise Access')?.value }],
[col:'Enterprise Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Enterprise Access')?.note?.replaceAll('"','\''))}],
[col:'ILL - InterLibraryLoans', value:{l, ctx -> l.getCustomPropByName('ILL - InterLibraryLoans')?.value }],
[col:'ILL - InterLibraryLoans Notes', value:{l, ctx -> raw(l.getCustomPropByName('ILL - InterLibraryLoans')?.note?.replaceAll('"','\''))}],
[col:'Include In Coursepacks', value:{l, ctx -> l.getCustomPropByName('Include In Coursepacks')?.value }],
[col:'Include In Coursepacks Notes', value:{l, ctx -> raw(l.getCustomPropByName('Include In Coursepacks')?.note?.replaceAll('"','\''))}],
[col:'Include in VLE', value:{l, ctx -> l.getCustomPropByName('Include in VLE')?.value }],
[col:'Include in VLE Notes', value:{l, ctx -> raw(l.getCustomPropByName('Include in VLE')?.note?.replaceAll('"','\''))}],
[col:'Multi Site Access', value:{l, ctx -> l.getCustomPropByName('Multi Site Access')?.value }],
[col:'Multi Site Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Multi Site Access')?.note?.replaceAll('"','\''))}],
[col:'Notice Period', value:{l, ctx -> l.getCustomPropByName('Notice Period')?.value }],
[col:'Notice Period Notes', value:{l, ctx -> raw(l.getCustomPropByName('Notice Period')?.note?.replaceAll('"','\''))}],
[col:'Partners Access', value:{l, ctx -> l.getCustomPropByName('Partners Access')?.value }],
[col:'Partners Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Partners Access')?.note?.replaceAll('"','\''))}],
[col:'Post Cancellation Access Entitlement', value:{l, ctx -> l.getCustomPropByName('Post Cancellation Access Entitlement')?.value }],
[col:'Post Cancellation Access Entitlement Notes', value:{l, ctx -> raw(l.getCustomPropByName('Post Cancellation Access Entitlement')?.note?.replaceAll('"','\'')) }],
[col:'Remote Access', value:{l, ctx -> l.getCustomPropByName('Remote Access')?.value }],
[col:'Remote Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Remote Access')?.note?.replaceAll('"','\'')) }],
[col:'Text and Data Mining', value:{l, ctx -> l.getCustomPropByName('Text and Data Mining')?.value }],
[col:'Text and Data Mining Notes', value:{l, ctx -> raw(l.getCustomPropByName('Text and Data Mining')?.note?.replaceAll('"','\'')) }],
[col:'Walk In Access', value:{l, ctx -> l.getCustomPropByName('Walk In Access')?.value }],
[col:'Walk In Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Walk In Access')?.note?.replaceAll('"','\'')) }],
]}"/><g:set var="tabchar" value=","
/><g:set var="formatter" value="${new java.text.SimpleDateFormat('yyyy-MM-dd')}"
/><g:encodeAs codec="Raw"><g:each in="${cfg}" var="r">"${r.col}"${tabchar}</g:each><g:each in="${propSet}" var="s">"${s}"${tabchar}"${s + ' Notes' }"${tabchar}</g:each>
<g:set value="${license}" var="license"
/><g:each in="${cfg}" var="r"><g:if test="${r.value instanceof groovy.lang.Closure}">"${r.value.call(license, ctx)}"${tabchar}</g:if
><g:else>"${r.value}"${tabchar}</g:else></g:each
><g:each in="${propSet}" var="custProp"
><g:each in="${cgg}" var="s"><g:if test="${s.value instanceof groovy.lang.Closure}">"${s.value?.call(license, custProp)}"${tabchar}</g:if
><g:else>"${s.value}"${tabchar}</g:else></g:each></g:each>
</g:encodeAs>
/><g:encodeAs codec="Raw"><g:each in="${cfg}" var="r">"${r.col}"${tabchar}</g:each>
<g:each in="${licenses}" var="license"
><g:each in="${cfg}" var="r"><g:if test="${r.value instanceof groovy.lang.Closure}">"${r.value.call(license, ctx)}"${tabchar}</g:if
><g:else>"${r.value}"${tabchar}</g:else></g:each>
</g:each></g:encodeAs>
23 changes: 23 additions & 0 deletions kbplus/grails-app/views/licenseDetails/_lic_csv_old.gsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<g:set var="cfg" value="${[[col:'KB+ Licence ID', value:{l, ctx -> l.id } ],
[col:'LicenceReference', value:{l, ctx -> raw(l.reference) } ],
[col:'NoticePeriod', value:{ l, ctx -> l.noticePeriod } ],
[col:'LicenceURL', value:{l, ctx -> raw(l.licenseUrl) }],
[col:'LicensorRef', value:{l, ctx -> raw(l.licensorRef) }],
[col:'LicenseeRef', value:{l, ctx -> raw(l.licenseeRef) }],
[col:'StartDate', value:{l, ctx -> l.startDate?formatter.format(l.startDate):'' } ],
[col:'EndDate', value: {l, ctx -> l.endDate?formatter.format(l.endDate):'' }],
[col:'Licence Category', value:{l, ctx -> l.licenseCategory?.value }],
[col:'Licence Status', value:{l, ctx -> l.status?.value } ]
]}"
/><g:set var="cgg" value="${[[col:'Custom Property Value',value:{l, p -> if(l.customProperties.find{it.type.name == p}) l.customProperties.find{it.type.name == p}.value}],
[col:'Custom Property Note', value:{l, p -> if(l.customProperties.find{it.type.name == p}) raw(l.customProperties.find{it.type.name == p}.note?.replaceAll('"','\''))}]
]}"/><g:set var="tabchar" value=","
/><g:set var="formatter" value="${new java.text.SimpleDateFormat('yyyy-MM-dd')}"
/><g:encodeAs codec="Raw"><g:each in="${cfg}" var="r">"${r.col}"${tabchar}</g:each><g:each in="${propSet}" var="s">"${s}"${tabchar}"${s + ' Notes' }"${tabchar}</g:each>
<g:set value="${license}" var="license"
/><g:each in="${cfg}" var="r"><g:if test="${r.value instanceof groovy.lang.Closure}">"${r.value.call(license, ctx)}"${tabchar}</g:if
><g:else>"${r.value}"${tabchar}</g:else></g:each
><g:each in="${propSet}" var="custProp"
><g:each in="${cgg}" var="s"><g:if test="${s.value instanceof groovy.lang.Closure}">"${s.value?.call(license, custProp)}"${tabchar}</g:if
><g:else>"${s.value}"${tabchar}</g:else></g:each></g:each>
</g:encodeAs>
49 changes: 36 additions & 13 deletions kbplus/grails-app/views/myInstitutions/_lic_csv.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,47 @@
[col:'LicenceURL', value:{l, ctx -> raw(l.licenseUrl) }],
[col:'LicensorRef', value:{l, ctx -> raw(l.licensorRef) }],
[col:'LicenseeRef', value:{l, ctx -> raw(l.licenseeRef) }],
[col:'JiscLicenseId', value:{l, ctx -> raw(l.jiscLicenseId) }],
[col:'StartDate', value:{l, ctx -> l.startDate?formatter.format(l.startDate):'' } ],
[col:'EndDate', value: {l, ctx -> l.endDate?formatter.format(l.endDate):'' }],
[col:'Licence Category', value:{l, ctx -> l.licenseCategory?.value }],
[col:'Licence Status', value:{l, ctx -> l.status?.value } ]
]}"
/><g:set var="cgg" value="${[[col:'Custom Property Value',value:{l, p -> if(l.customProperties.find{it.type.name == p}) l.customProperties.find{it.type.name == p}.value}],
[col:'Custom Property Note', value:{l, p -> if(l.customProperties.find{it.type.name == p}) raw(l.customProperties.find{it.type.name == p}.note?.replaceAll('"','\''))}]
[col:'Licence Status', value:{l, ctx -> l.status?.value } ],
[col:'APC/Offsetting Offer', value:{l, ctx -> l.getCustomPropByName('APC/Offsetting Offer')?.value }],
[col:'APC/Offsetting Offer Notes', value:{l, ctx -> raw(l.getCustomPropByName('APC/Offsetting Offer')?.note?.replaceAll('"','\''))}],
[col:'Alumni Access', value:{l, ctx -> l.getCustomPropByName('Alumni Access')?.value }],
[col:'Alumni Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Alumni Access')?.note?.replaceAll('"','\''))}],
[col:'Annual Opt-Out', value:{l, ctx -> l.getCustomPropByName('Annual Opt-Out')?.value }],
[col:'Annual Opt-Out Notes', value:{l, ctx -> raw(l.getCustomPropByName('Annual Opt-Out')?.note?.replaceAll('"','\''))}],
[col:'Concurrent Access', value:{l, ctx -> l.getCustomPropByName('Concurrent Access')?.value }],
[col:'Concurrent Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Concurrent Access')?.note?.replaceAll('"','\''))}],
[col:'Concurrent Users', value:{l, ctx -> l.getCustomPropByName('Concurrent Users')?.value }],
[col:'Concurrent Users Notes', value:{l, ctx -> raw(l.getCustomPropByName('Concurrent Users')?.note?.replaceAll('"','\''))}],
[col:'Enterprise Access', value:{l, ctx -> l.getCustomPropByName('Enterprise Access')?.value }],
[col:'Enterprise Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Enterprise Access')?.note?.replaceAll('"','\''))}],
[col:'ILL - InterLibraryLoans', value:{l, ctx -> l.getCustomPropByName('ILL - InterLibraryLoans')?.value }],
[col:'ILL - InterLibraryLoans Notes', value:{l, ctx -> raw(l.getCustomPropByName('ILL - InterLibraryLoans')?.note?.replaceAll('"','\''))}],
[col:'Include In Coursepacks', value:{l, ctx -> l.getCustomPropByName('Include In Coursepacks')?.value }],
[col:'Include In Coursepacks Notes', value:{l, ctx -> raw(l.getCustomPropByName('Include In Coursepacks')?.note?.replaceAll('"','\''))}],
[col:'Include in VLE', value:{l, ctx -> l.getCustomPropByName('Include in VLE')?.value }],
[col:'Include in VLE Notes', value:{l, ctx -> raw(l.getCustomPropByName('Include in VLE')?.note?.replaceAll('"','\''))}],
[col:'Multi Site Access', value:{l, ctx -> l.getCustomPropByName('Multi Site Access')?.value }],
[col:'Multi Site Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Multi Site Access')?.note?.replaceAll('"','\''))}],
[col:'Notice Period', value:{l, ctx -> l.getCustomPropByName('Notice Period')?.value }],
[col:'Notice Period Notes', value:{l, ctx -> raw(l.getCustomPropByName('Notice Period')?.note?.replaceAll('"','\''))}],
[col:'Partners Access', value:{l, ctx -> l.getCustomPropByName('Partners Access')?.value }],
[col:'Partners Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Partners Access')?.note?.replaceAll('"','\''))}],
[col:'Post Cancellation Access Entitlement', value:{l, ctx -> l.getCustomPropByName('Post Cancellation Access Entitlement')?.value }],
[col:'Post Cancellation Access Entitlement Notes', value:{l, ctx -> raw(l.getCustomPropByName('Post Cancellation Access Entitlement')?.note?.replaceAll('"','\'')) }],
[col:'Remote Access', value:{l, ctx -> l.getCustomPropByName('Remote Access')?.value }],
[col:'Remote Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Remote Access')?.note?.replaceAll('"','\'')) }],
[col:'Text and Data Mining', value:{l, ctx -> l.getCustomPropByName('Text and Data Mining')?.value }],
[col:'Text and Data Mining Notes', value:{l, ctx -> raw(l.getCustomPropByName('Text and Data Mining')?.note?.replaceAll('"','\'')) }],
[col:'Walk In Access', value:{l, ctx -> l.getCustomPropByName('Walk In Access')?.value }],
[col:'Walk In Access Notes', value:{l, ctx -> raw(l.getCustomPropByName('Walk In Access')?.note?.replaceAll('"','\'')) }],
]}"/><g:set var="tabchar" value=","
/><g:set var="formatter" value="${new java.text.SimpleDateFormat('yyyy-MM-dd')}"
/><g:encodeAs codec="Raw">SEARCH TERMS
Institution${tabchar}ValidOn${tabchar}ReferenceSearch${tabchar}LicenceProperty${tabchar}LicencePropertyValue
${institution?.name}${tabchar}${validOn}${tabchar}${keyWord}${tabchar}${propertyFilterType}${tabchar}${propertyFilter}

<g:each in="${cfg}" var="r">"${r.col}"${tabchar}</g:each><g:each in="${propSet}" var="s">"${s}"${tabchar}"${s + ' Notes' }"${tabchar}</g:each>
/><g:encodeAs codec="Raw"><g:each in="${cfg}" var="r">"${r.col}"${tabchar}</g:each>
<g:each in="${licenses}" var="license"
><g:each in="${cfg}" var="r"><g:if test="${r.value instanceof groovy.lang.Closure}">"${r.value.call(license, ctx)}"${tabchar}</g:if
><g:else>"${r.value}"${tabchar}</g:else></g:each
><g:each in="${propSet}" var="custProp"
><g:each in="${cgg}" var="s"><g:if test="${s.value instanceof groovy.lang.Closure}">"${s.value?.call(license, custProp)}"${tabchar}</g:if
><g:else>"${s.value}"${tabchar}</g:else></g:each></g:each>
><g:else>"${r.value}"${tabchar}</g:else></g:each>
</g:each></g:encodeAs>
27 changes: 27 additions & 0 deletions kbplus/grails-app/views/myInstitutions/_lic_csv_old.gsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<g:set var="cfg" value="${[[col:'KB+ Licence ID', value:{l, ctx -> l.id } ],
[col:'LicenceReference', value:{l, ctx -> raw(l.reference) } ],
[col:'NoticePeriod', value:{ l, ctx -> l.noticePeriod } ],
[col:'LicenceURL', value:{l, ctx -> raw(l.licenseUrl) }],
[col:'LicensorRef', value:{l, ctx -> raw(l.licensorRef) }],
[col:'LicenseeRef', value:{l, ctx -> raw(l.licenseeRef) }],
[col:'StartDate', value:{l, ctx -> l.startDate?formatter.format(l.startDate):'' } ],
[col:'EndDate', value: {l, ctx -> l.endDate?formatter.format(l.endDate):'' }],
[col:'Licence Category', value:{l, ctx -> l.licenseCategory?.value }],
[col:'Licence Status', value:{l, ctx -> l.status?.value } ]
]}"
/><g:set var="cgg" value="${[[col:'Custom Property Value',value:{l, p -> if(l.customProperties.find{it.type.name == p}) l.customProperties.find{it.type.name == p}.value}],
[col:'Custom Property Note', value:{l, p -> if(l.customProperties.find{it.type.name == p}) raw(l.customProperties.find{it.type.name == p}.note?.replaceAll('"','\''))}]
]}"/><g:set var="tabchar" value=","
/><g:set var="formatter" value="${new java.text.SimpleDateFormat('yyyy-MM-dd')}"
/><g:encodeAs codec="Raw">SEARCH TERMS
Institution${tabchar}ValidOn${tabchar}ReferenceSearch${tabchar}LicenceProperty${tabchar}LicencePropertyValue
${institution?.name}${tabchar}${validOn}${tabchar}${keyWord}${tabchar}${propertyFilterType}${tabchar}${propertyFilter}

<g:each in="${cfg}" var="r">"${r.col}"${tabchar}</g:each><g:each in="${propSet}" var="s">"${s}"${tabchar}"${s + ' Notes' }"${tabchar}</g:each>
<g:each in="${licenses}" var="license"
><g:each in="${cfg}" var="r"><g:if test="${r.value instanceof groovy.lang.Closure}">"${r.value.call(license, ctx)}"${tabchar}</g:if
><g:else>"${r.value}"${tabchar}</g:else></g:each
><g:each in="${propSet}" var="custProp"
><g:each in="${cgg}" var="s"><g:if test="${s.value instanceof groovy.lang.Closure}">"${s.value?.call(license, custProp)}"${tabchar}</g:if
><g:else>"${s.value}"${tabchar}</g:else></g:each></g:each>
</g:each></g:encodeAs>

0 comments on commit 0b66311

Please sign in to comment.