|
2094 | 2094 | </div> |
2095 | 2095 | </p:fragment> |
2096 | 2096 | </p:dialog> |
2097 | | - <script src="https://cdn.jsdelivr.net/npm/citation-js" |
2098 | | - type="text/javascript"></script> |
2099 | | - <script> |
2100 | | - const Cite = require('citation-js'); |
2101 | | - let cite = new Cite(#{version.getCitation("CSL", true, false)}); |
2102 | | - </script> |
2103 | | - <p:dialog id="cslCitation" header="#{bundle['dataset.cite.cslDialog.title']}" |
2104 | | - widgetVar="cslCitationDialog" dynamic="true" modal="true"> |
2105 | | - <o:importFunctions type="edu.harvard.iq.dataverse.util.CSLUtil" /> |
2106 | | - <o:importFunctions type="de.undercouch.citeproc.CSL" /> |
2107 | | - <o:importFunctions |
2108 | | - type="edu.harvard.iq.dataverse.pidproviders.PidUtil" /> |
2109 | | - <p:outputLabel for="@next" value="#{bundle['dataset.cite.cslDialog.select']}"/> |
2110 | | - <p:selectOneMenu value="#{DatasetPage.requestedCSL}" |
2111 | | - onchange="updateCSLCitation()" id="select_CSL_Style" |
2112 | | - styleClass="form-control" |
2113 | | - style="width:auto !important; max-width:100%; min-width:200px;" |
2114 | | - filter="true" filterMatchMode="contains"> |
2115 | | - <f:selectItems value="#{CSLUtil:getSupportedStyles(dataverseSession.localeCode)}" |
2116 | | - var="cslStyle" itemLabel="#{cslStyle}" itemValue="#{cslStyle}" /> |
2117 | | - </p:selectOneMenu> |
2118 | | - <p:outputLabel id="cslLabel" for="@next" value="#{bundle['dataset.cite.cslDialog.citation'].replace('{0}',DatasetPage.requestedCSL)}"/> |
2119 | | - <p:outputPanel id="cslOutput"> |
2120 | | - <script> |
2121 | | - Cite.CSL.register.addTemplate("#{DatasetPage.requestedCSL}", |
2122 | | - "#{CSLUtil:getCitationFormat((DatasetPage.requestedCSL == '') ? 'apa' : DatasetPage.requestedCSL)}"); |
2123 | | - |
2124 | | - document.getElementById('datasetForm:cslOutput').innerHTML = cite.format("bibliography", { |
2125 | | - format: "html", |
2126 | | - template: "#{DatasetPage.requestedCSL}", |
2127 | | - lang: "#{dataverseSession.localeCode}" |
2128 | | - }) |
2129 | | - </script> |
2130 | | - <h:outputText value="#{bundle['dataset.cite.cslDialog.generating']}"/> |
2131 | | - </p:outputPanel> |
2132 | | - <span class="glyphicon glyphicon-copy btn-copy" |
2133 | | - data-toggle="tooltip" data-placement="top" data-html="true" |
2134 | | - data-clipboard-action="copy" |
2135 | | - data-clipboard-target=".csl-entry" |
2136 | | - title="#{bundle['dataset.cite.cslDialog.copy']}"></span> |
2137 | | - <p:commandButton |
2138 | | - value="#{bundle['file.dataFilesTab.button.direct']}" |
2139 | | - id="updateCSL" style="display:none" update=":datasetForm:cslOutput, :datasetForm:cslLabel"> |
2140 | | - </p:commandButton> |
2141 | | - <div class="button-block"> |
2142 | | - <button class="btn btn-link" onclick="PF('cslCitationDialog').hide();" |
2143 | | - type="button">#{bundle['dataset.cite.cslDialog.close']}</button> |
2144 | | - </div> |
2145 | | - </p:dialog> |
| 2097 | + <ui:fragment rendered="#{DatasetPage.editMode != 'CREATE'}"> |
| 2098 | + <script src="https://cdn.jsdelivr.net/npm/citation-js" |
| 2099 | + type="text/javascript"></script> |
| 2100 | + <script> |
| 2101 | + const Cite = require('citation-js'); |
| 2102 | + let cite = new Cite(#{version.getCitation("CSL", true, false)}); |
| 2103 | + </script> |
| 2104 | + <p:dialog id="cslCitation" header="#{bundle['dataset.cite.cslDialog.title']}" |
| 2105 | + widgetVar="cslCitationDialog" dynamic="true" modal="true"> |
| 2106 | + <o:importFunctions type="edu.harvard.iq.dataverse.util.CSLUtil" /> |
| 2107 | + <o:importFunctions type="de.undercouch.citeproc.CSL" /> |
| 2108 | + <o:importFunctions |
| 2109 | + type="edu.harvard.iq.dataverse.pidproviders.PidUtil" /> |
| 2110 | + <p:outputLabel for="@next" value="#{bundle['dataset.cite.cslDialog.select']}"/> |
| 2111 | + <p:selectOneMenu value="#{DatasetPage.requestedCSL}" |
| 2112 | + onchange="updateCSLCitation()" id="select_CSL_Style" |
| 2113 | + styleClass="form-control" |
| 2114 | + style="width:auto !important; max-width:100%; min-width:200px;" |
| 2115 | + filter="true" filterMatchMode="contains"> |
| 2116 | + <f:selectItems value="#{CSLUtil:getSupportedStyles(dataverseSession.localeCode)}" |
| 2117 | + var="cslStyle" itemLabel="#{cslStyle}" itemValue="#{cslStyle}" /> |
| 2118 | + </p:selectOneMenu> |
| 2119 | + <p:outputLabel id="cslLabel" for="@next" value="#{bundle['dataset.cite.cslDialog.citation'].replace('{0}',DatasetPage.requestedCSL)}"/> |
| 2120 | + <p:outputPanel id="cslOutput"> |
| 2121 | + <script> |
| 2122 | + Cite.CSL.register.addTemplate("#{DatasetPage.requestedCSL}", |
| 2123 | + "#{CSLUtil:getCitationFormat((DatasetPage.requestedCSL == '') ? 'apa' : DatasetPage.requestedCSL)}"); |
| 2124 | + |
| 2125 | + document.getElementById('datasetForm:cslOutput').innerHTML = cite.format("bibliography", { |
| 2126 | + format: "html", |
| 2127 | + template: "#{DatasetPage.requestedCSL}", |
| 2128 | + lang: "#{dataverseSession.localeCode}" |
| 2129 | + }) |
| 2130 | + </script> |
| 2131 | + <h:outputText value="#{bundle['dataset.cite.cslDialog.generating']}"/> |
| 2132 | + </p:outputPanel> |
| 2133 | + <span class="glyphicon glyphicon-copy btn-copy" |
| 2134 | + data-toggle="tooltip" data-placement="top" data-html="true" |
| 2135 | + data-clipboard-action="copy" |
| 2136 | + data-clipboard-target=".csl-entry" |
| 2137 | + title="#{bundle['dataset.cite.cslDialog.copy']}"></span> |
| 2138 | + <p:commandButton |
| 2139 | + value="#{bundle['file.dataFilesTab.button.direct']}" |
| 2140 | + id="updateCSL" style="display:none" update=":datasetForm:cslOutput, :datasetForm:cslLabel"> |
| 2141 | + </p:commandButton> |
| 2142 | + <div class="button-block"> |
| 2143 | + <button class="btn btn-link" onclick="PF('cslCitationDialog').hide();" |
| 2144 | + type="button">#{bundle['dataset.cite.cslDialog.close']}</button> |
| 2145 | + </div> |
| 2146 | + </p:dialog> |
| 2147 | + </ui:fragment> |
2146 | 2148 | <p:remoteCommand name="returnToAuthorCommand" oncomplete="PF('sendBackToContributor').hide();" update=":messagePanel" actionListener="#{DatasetPage.sendBackToContributor}"/> |
2147 | 2149 | <p:remoteCommand name="linkEditTerms" actionListener="#{DatasetPage.edit('LICENSE')}" update="@form,:datasetForm,:messagePanel"> |
2148 | 2150 | <f:setPropertyActionListener target="#{DatasetPage.selectedTabIndex}" value="0" /> |
|
0 commit comments