Nota:
El acceso a esta página requiere autorización. Puede intentar iniciar sesión o cambiar directorios.
El acceso a esta página requiere autorización. Puede intentar cambiar los directorios.
Puede ver y buscar archivos adjuntos de artículos de conocimiento en el portal, según una búsqueda de Dataverse. Para ello, debe configurar la plantilla web de resultados de búsqueda por facetas desde su portal.
- En el mapa del sitio de Administración del portal, vaya al área Contenido y seleccione Plantillas web. Puede iniciar sesión en Administración del portal desde varias ubicaciones. Obtenga más información en Información general de la aplicación Administración del portal.
- En la lista desplegable Plantillas web activas , seleccione la plantilla web de artículo de conocimientos.
- En la página Plantilla web , seleccione la pestaña General y agregue el siguiente fragmento de código al campo Origen .
{{#if relatedAttachments}}
{{#each relatedAttachments}}
<li class="note-item">
{{#if isImage}}
<a id="kbattachment-{{entityID}}" href="javascript:downloadKbAttachmentFile('kbattachment-{{entityID}}', '{{title}}', {{fileSize}}, '{{fileType}}', '{{downloadBlockUrl}}', '{{initializeDownloadUrl}}')"><span class="glyphicon glyphicon-file" aria-hidden="true"></span> {{title}}</a>
{{else}}
<a id="kbattachment-{{entityID}}" title="{{title}}" href="javascript:downloadKbAttachmentFile('kbattachment-{{entityID}}', '{{title}}', {{fileSize}}, '{{fileType}}', '{{downloadBlockUrl}}', '{{initializeDownloadUrl}}')"><span class="glyphicon glyphicon-file" aria-hidden="true"></span> {{title}}</a>
{{/if}}
<p class="fragment text-muted">{{{fragment}}}</p>
</li>
{{/each}}
{{/if}}
<script type="text/javascript">
function downloadKbAttachmentFile(attachmentElementId, fileName, fileSize, mimeType, downloadBlockUrl, initializeUrl) {
// Download block API supports max 4MB block size
const blockSizeInBytes = 4096 * 1024;
const totalNumberOfBlocks = parseInt(fileSize / blockSizeInBytes + 1);
var fileContinuationToken = "";
var contentString = "";
var numberOfBlocksDownloaded = 0;
var blockNumberToContentMap = {};
function downloadBlockCallback(i, result) {
numberOfBlocksDownloaded++;
blockNumberToContentMap[i] = result;
if (numberOfBlocksDownloaded == totalNumberOfBlocks) {
for (var j = 0; j < totalNumberOfBlocks; j++) {
contentString += blockNumberToContentMap[j];
}
var isImage = mimeType.startsWith('image/');
const attachmentElement = document.getElementById(attachmentElementId);
if (isImage) {
const bodyByteString = atob(contentString);
const bodyBuffer = new ArrayBuffer(bodyByteString.length);
const bodyView = new Uint8Array(bodyBuffer);
for (var k = 0; k < bodyByteString.length; k++) {
bodyView[k] = bodyByteString.charCodeAt(k);
}
var imageUrl = URL.createObjectURL(new Blob([bodyBuffer], { type: mimeType }));
attachmentElement.href = imageUrl;
attachmentElement.target = "_blank";
}
else {
const linkSource = 'data:' + mimeType + ';base64,' + contentString;
attachmentElement.href = linkSource;
attachmentElement.download = fileName;
}
attachmentElement.click();
}
}
shell.ajaxSafePost({
type: 'GET',
url: initializeUrl,
success: function (result) {
fileContinuationToken = encodeURIComponent(result);
for (var i = 0; i < totalNumberOfBlocks; i++) {
url = downloadBlockUrl + "&blockNumber=" + i + "&fileContinuationToken=" + fileContinuationToken + "&blockSize=" + blockSizeInBytes;
var x = downloadBlockCallback.bind(this,i);
shell.ajaxSafePost({
type: 'GET',
url: url,
success: (result) => { x(result) }
});
}
}
});
}
</script>
- Haga clic en Guardar.
Información relacionada
Agregar un archivo adjunto a un artículo de conocimientos
Actualización de archivos adjuntos de artículos de conocimiento para el portal
Mostrar archivos adjuntos con artículos de conocimiento