Skip to content
Snippets Groups Projects
Unverified Commit f47a4151 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Remove obsolete code (#37)

parent 7be39226
No related branches found
No related tags found
No related merge requests found
Pipeline #18862 passed
......@@ -734,14 +734,6 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
${i18n.t('label-manual-positioning-missing')}
` : '' }
</div>
<div class="annotation-line ${classMap({hidden: !this.allowAnnotating})}"
?disabled="${this.signingProcessEnabled}">
<button class="button"
title="${i18n.t('official-pdf-upload.add-annotation-title')}"
@click="${() => { this.addAnnotation(id); }}">
<dbp-icon name="plus"></dbp-icon></button>
${this.getAnnotationsHtml(id)}
</div>
</div>
`);
});
......@@ -813,44 +805,6 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
return results;
}
/**
* Returns the list of files of annotations of a queued file
*
* @param key
* @returns {*[]} Array of html templates
*/
getAnnotationsHtml(key) {
// console.log("getAnnotationsHtml(key)", key);
const annotations = this.queuedFilesAnnotations[key] || [];
const ids = Object.keys(annotations);
let results = [];
ids.forEach((id) => {
const data = this.queuedFilesAnnotations[key][id] || [];
results.push(html`
<div class="annotation-block" class="annotation-block-${key}-${id}">
<select class="select" @change=${e => { this.updateAnnotation(key, id, 'annotationType', e.target.value); }}>
<option value="">${i18n.t('official-pdf-upload.annotation-type-please-select')}</option>
${utils.getAnnotationTypeSelectOptionsHtml(data.annotationType, this.lang)}
</select>
<dbp-organization-select subscribe="lang:lang,entry-point-url:entry-point-url,auth:auth"
value="${data.organizationNumber}"
@change=${e => { this.updateAnnotation(key, id, 'organizationNumber', JSON.parse(e.target.getAttribute("data-object")).alternateName); }}></dbp-organization-select>
<input type="text" .value="${data.value}" @change=${e => { this.updateAnnotation(key, id, 'value', e.target.value); }} placeholder="value" />
<button class="button"
title="Remove annotation"
@click="${() => { this.removeAnnotation(key, id); }}">
<dbp-icon name="trash"></dbp-icon></button>
</div>
</div>
`);
});
return results;
}
hasSignaturePermissions() {
return this._hasSignaturePermissions('ROLE_SCOPE_OFFICIAL-SIGNATURE');
}
......
......@@ -255,39 +255,6 @@ export default class DBPSignatureLitElement extends DBPSignatureBaseLitElement {
}
}
/**
* Add an annotation to a file on the queue
*
* @param key
*/
async addAnnotationToPDF(key) {
const annotationKey = prompt("Please enter a key");
if (annotationKey === null || annotationKey === "") {
return;
}
const annotationValue = prompt("Please enter a value");
if (annotationValue === null || annotationValue === "") {
return;
}
let file = this.queuedFiles[key];
// console.log("file before annotation", file);
// annotate the pdf with the key and value
file = await utils.addKeyValuePdfAnnotation(file, 'AppNameDE', 'AppNameEN', this.auth['user-full-name'], annotationKey, annotationValue);
// console.log("file after annotation", file);
// overwrite the current pdf
this.queuedFiles[key] = file;
return file;
}
getQueuedFile(key) {
return this.queuedFiles[key];
}
......
......@@ -144,33 +144,6 @@ export const getPDFSignatureCount = async (file) => {
return matches;
};
/**
* Adds an annotation to a PDF file
*
* @param file
* @param activityNameDE
* @param activityNameEN
* @param personName
* @param key
* @param value
* @returns {File} file given as parameter, but with annotations
*/
export const addKeyValuePdfAnnotation = async (file, activityNameDE, activityNameEN, personName, key, value) => {
key = key.trim();
value = value.trim();
// don't annotate if key or value are empty
if (key === '' || value === '') {
return file;
}
let annotationFactory = await getAnnotationFactoryFromFile(file);
annotationFactory = addKeyValuePdfAnnotationsToAnnotationFactory(annotationFactory, activityNameDE, activityNameEN,
personName, key, 'Name DE', 'Name EN', 'organizationNumber', value);
return writeAnnotationFactoryToFile(annotationFactory, file);
};
/**
* Returns a File from an AnnotationFactory
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment