├── .dahbox ├── mvn └── prettier ├── .gitignore ├── .gitlab-ci.yml ├── LICENSE ├── README.md ├── alfresco-collabora-online-docker ├── pom.xml └── src │ └── main │ └── docker │ ├── Dockerfile │ ├── cors_support.conf │ ├── nginx.conf │ └── proxy_pass.conf ├── ci_settings.xml ├── collabora-aca-extension-docker ├── pom.xml └── src │ └── main │ └── docker │ ├── Dockerfile │ ├── app.config.json │ ├── cors_support.conf │ ├── nginx.conf │ └── proxy_pass.conf ├── collabora-aca-extension ├── .editorconfig ├── .gitignore ├── .prettierignore ├── .prettierrc ├── LICENSE ├── README.md ├── angular.json ├── extension.schema.json ├── package-lock.json ├── package.json ├── pom.xml ├── projects │ └── collabora-online-extension │ │ ├── assets │ │ ├── collabora-online.plugin.json │ │ ├── i18n │ │ │ ├── ca.json │ │ │ ├── cs.json │ │ │ ├── de.json │ │ │ ├── en.json │ │ │ ├── en_AU.json │ │ │ ├── en_GB.json │ │ │ ├── en_NZ.json │ │ │ ├── en_ZA.json │ │ │ ├── es.json │ │ │ ├── fr.json │ │ │ ├── fy.json │ │ │ ├── he.json │ │ │ ├── hr.json │ │ │ ├── hu.json │ │ │ ├── is.json │ │ │ ├── ja.json │ │ │ ├── nb_NO.json │ │ │ ├── nl.json │ │ │ ├── nn.json │ │ │ ├── pl.json │ │ │ ├── pt_BR.json │ │ │ ├── ru.json │ │ │ ├── sk.json │ │ │ ├── sl.json │ │ │ ├── tr.json │ │ │ └── uk.json │ │ └── images │ │ │ └── collabora-online-logo.svg │ │ ├── karma.conf.js │ │ ├── ng-package.json │ │ ├── package.json │ │ ├── schematics │ │ ├── collection.json │ │ └── ng-add │ │ │ └── index.ts │ │ ├── src │ │ ├── lib │ │ │ ├── actions │ │ │ │ └── collabora-online.actions.ts │ │ │ ├── components │ │ │ │ ├── collabora-online.component.html │ │ │ │ ├── collabora-online.component.scss │ │ │ │ ├── collabora-online.component.spec.ts │ │ │ │ ├── collabora-online.component.ts │ │ │ │ ├── collabora-online.module.ts │ │ │ │ └── viewer │ │ │ │ │ ├── viewer-collabora-online.component.html │ │ │ │ │ ├── viewer-collabora-online.component.scss │ │ │ │ │ ├── viewer-collabora-online.component.spec.ts │ │ │ │ │ ├── viewer-collabora-online.component.ts │ │ │ │ │ └── viewer-collabora.module.ts │ │ │ ├── effects │ │ │ │ └── collabora-online.effects.ts │ │ │ ├── rules │ │ │ │ └── evaluators.ts │ │ │ └── services │ │ │ │ ├── collabora-online.service.spec.ts │ │ │ │ └── collabora-online.service.ts │ │ ├── public_api.ts │ │ └── test.ts │ │ ├── tsconfig.lib.json │ │ ├── tsconfig.schematics.json │ │ ├── tsconfig.spec.json │ │ └── tslint.json ├── src │ └── main │ │ └── assembly │ │ └── assembly.xml ├── tsconfig.json └── tslint.json ├── collabora-online-integration-tests └── pom.xml ├── collabora-online.component.spec.ts ├── collabora-platform-extension-docker ├── pom.xml └── src │ └── main │ └── docker │ ├── Dockerfile │ ├── alfresco-global.properties │ ├── alfresco-keystore.jar │ ├── dev-log4j.properties │ ├── disable-webscript-caching-context.xml │ ├── hotswap-agent.properties │ ├── keystore-context.xml │ └── keystore │ ├── keystore │ ├── ssl.keystore │ └── ssl.truststore ├── collabora-platform-extension ├── pom.xml └── src │ ├── main │ ├── assembly │ │ ├── amp.xml │ │ ├── file-mapping.properties │ │ └── web │ │ │ └── README.md │ ├── java │ │ └── fr │ │ │ └── jeci │ │ │ └── collabora │ │ │ ├── alfresco │ │ │ ├── CleanVersionWebScript.java │ │ │ ├── CollaboraOnlineModel.java │ │ │ ├── CollaboraOnlineService.java │ │ │ ├── CollaboraOnlineServiceImpl.java │ │ │ ├── ConflictException.java │ │ │ ├── GetTokenWebScript.java │ │ │ ├── ServiceUrlInfoWebScript.java │ │ │ ├── WOPIAccessTokenInfo.java │ │ │ ├── WebscriptHelper.java │ │ │ ├── WopiDiscovery.java │ │ │ └── job │ │ │ │ ├── CleanLockJob.java │ │ │ │ └── CleanLockJobExecuter.java │ │ │ └── wopi │ │ │ ├── AbstractWopiWebScript.java │ │ │ ├── WopiCheckFileInfoWebScript.java │ │ │ ├── WopiGetFileWebScript.java │ │ │ ├── WopiHeader.java │ │ │ ├── WopiOverride.java │ │ │ ├── WopiPutFileWebScript.java │ │ │ └── WopiPutRelativeFileWebScript.java │ └── resources │ │ └── alfresco │ │ ├── extension │ │ └── templates │ │ │ └── webscripts │ │ │ ├── fr │ │ │ └── jeci │ │ │ │ └── collabora │ │ │ │ ├── aspect-collabora-online │ │ │ │ ├── aspect-collabora-online-add.post.desc.xml │ │ │ │ ├── aspect-collabora-online-add.post.js │ │ │ │ ├── aspect-collabora-online-add.post.json.ftl │ │ │ │ ├── aspect-collabora-online-rem.post.desc.xml │ │ │ │ ├── aspect-collabora-online-rem.post.js │ │ │ │ ├── aspect-collabora-online-rem.post.json.ftl │ │ │ │ ├── aspect-collabora-online.lib.ftl │ │ │ │ ├── aspect-collabora-online.lib.js │ │ │ │ ├── clean-auto-version.post.desc.xml │ │ │ │ └── clean-auto-version.post.json.ftl │ │ │ │ ├── service-url.get.desc.xml │ │ │ │ ├── service-url.get.json.ftl │ │ │ │ ├── token.get.desc.xml │ │ │ │ ├── token.get.json.ftl │ │ │ │ └── wopi │ │ │ │ ├── CheckFileInfo.get.desc.xml │ │ │ │ ├── GetFile.get.desc.xml │ │ │ │ ├── PutFile.post.desc.xml │ │ │ │ └── PutRelativeFile.post.desc.xml │ │ │ └── org │ │ │ └── alfresco │ │ │ └── slingshot │ │ │ └── documentlibrary │ │ │ └── node-templates.post.json.js │ │ └── module │ │ └── collabora-platform-extension │ │ ├── alfresco-global.properties │ │ ├── context │ │ ├── bootstrap-context.xml │ │ ├── job-context.xml │ │ ├── service-context.xml │ │ └── webscript-context.xml │ │ ├── log4j.properties │ │ ├── model │ │ └── collabora-online-model.xml │ │ ├── module-context.xml │ │ └── module.properties │ └── test │ ├── java │ └── fr │ │ └── jeci │ │ └── collabora │ │ └── alfresco │ │ ├── CollaboraOnlineServiceImplTest.java │ │ └── WopiDiscoveryTest.java │ └── resources │ └── discovery_collabora_online.xml ├── collabora-share-extension-docker ├── pom.xml └── src │ └── main │ └── docker │ ├── Dockerfile │ ├── context.xml │ ├── hotswap-agent.properties │ ├── log4j.properties │ └── share-config-custom.xml ├── collabora-share-extension ├── pom.xml └── src │ └── main │ ├── assembly │ ├── amp.xml │ ├── file-mapping.properties │ └── web │ │ └── README.md │ ├── java │ ├── dk │ │ └── magenta │ │ │ └── libreOffice │ │ │ └── online │ │ │ └── PageModuleEvaluator.java │ └── fr │ │ └── jeci │ │ └── collabora │ │ └── evaluator │ │ └── doclib │ │ └── indicator │ │ └── EditingEvaluator.java │ └── resources │ ├── META-INF │ ├── resources │ │ ├── components │ │ │ └── documentlibrary │ │ │ │ ├── actions │ │ │ │ └── document-edit-collabora-online-16.png │ │ │ │ ├── collabora-online-metadata-template-renderer.js │ │ │ │ ├── document-edit-collabora-online-action-default.js │ │ │ │ └── indicators │ │ │ │ └── collabora-editing-16.png │ │ ├── dk │ │ │ └── magenta │ │ │ │ └── lool │ │ │ │ ├── libreoffice-online-edit.css │ │ │ │ └── libreoffice-online-edit.js │ │ ├── fr │ │ │ └── jeci │ │ │ │ └── collabora-online │ │ │ │ └── node-header │ │ │ │ └── node-header.css │ │ └── js │ │ │ └── magenta │ │ │ └── libreofficepage │ │ │ ├── AlfMenuBarItem.js │ │ │ └── i18n │ │ │ ├── AlfMenuBarItemExt.properties │ │ │ ├── AlfMenuBarItemExt_ca.properties │ │ │ ├── AlfMenuBarItemExt_cs.properties │ │ │ ├── AlfMenuBarItemExt_da.properties │ │ │ ├── AlfMenuBarItemExt_de.properties │ │ │ ├── AlfMenuBarItemExt_en-AU.properties │ │ │ ├── AlfMenuBarItemExt_en-GB.properties │ │ │ ├── AlfMenuBarItemExt_en-NZ.properties │ │ │ ├── AlfMenuBarItemExt_en-ZA.properties │ │ │ ├── AlfMenuBarItemExt_es.properties │ │ │ ├── AlfMenuBarItemExt_fr.properties │ │ │ ├── AlfMenuBarItemExt_fy.properties │ │ │ ├── AlfMenuBarItemExt_he.properties │ │ │ ├── AlfMenuBarItemExt_hr.properties │ │ │ ├── AlfMenuBarItemExt_hu.properties │ │ │ ├── AlfMenuBarItemExt_is.properties │ │ │ ├── AlfMenuBarItemExt_ja.properties │ │ │ ├── AlfMenuBarItemExt_nb-NO.properties │ │ │ ├── AlfMenuBarItemExt_nl.properties │ │ │ ├── AlfMenuBarItemExt_nn.properties │ │ │ ├── AlfMenuBarItemExt_pl.properties │ │ │ ├── AlfMenuBarItemExt_pt-BR.properties │ │ │ ├── AlfMenuBarItemExt_ru.properties │ │ │ ├── AlfMenuBarItemExt_sk.properties │ │ │ ├── AlfMenuBarItemExt_sl.properties │ │ │ ├── AlfMenuBarItemExt_tr.properties │ │ │ └── AlfMenuBarItemExt_uk.properties │ └── share-config-custom.xml │ └── alfresco │ ├── module │ └── collabora-share-extension │ │ ├── log4j.properties │ │ └── module.properties │ ├── site-data │ ├── pages │ │ └── collabora-online-edit.xml │ └── template-instances │ │ └── collabora-online-edit.xml │ ├── templates │ └── org │ │ └── alfresco │ │ └── collabora-online-edit.ftl │ └── web-extension │ ├── collabora-online-share-slingshot-application-context.xml │ ├── messages │ ├── collabora-online-share.properties │ ├── collabora-online-share_ca.properties │ ├── collabora-online-share_cs.properties │ ├── collabora-online-share_da.properties │ ├── collabora-online-share_de.properties │ ├── collabora-online-share_en-AU.properties │ ├── collabora-online-share_en-GB.properties │ ├── collabora-online-share_en-NZ.properties │ ├── collabora-online-share_en-ZA.properties │ ├── collabora-online-share_es.properties │ ├── collabora-online-share_fr.properties │ ├── collabora-online-share_fy.properties │ ├── collabora-online-share_he.properties │ ├── collabora-online-share_hr.properties │ ├── collabora-online-share_hu.properties │ ├── collabora-online-share_is.properties │ ├── collabora-online-share_ja.properties │ ├── collabora-online-share_nb-NO.properties │ ├── collabora-online-share_nl.properties │ ├── collabora-online-share_nn.properties │ ├── collabora-online-share_pl.properties │ ├── collabora-online-share_pt-BR.properties │ ├── collabora-online-share_ru.properties │ ├── collabora-online-share_sk.properties │ ├── collabora-online-share_sl.properties │ ├── collabora-online-share_tr.properties │ └── collabora-online-share_uk.properties │ ├── site-data │ └── extensions │ │ └── collabora-online-extension.xml │ └── site-webscripts │ ├── dk │ └── magenta │ │ ├── collabora-online │ │ └── components │ │ │ └── document-edit │ │ │ ├── collabora-online-edit.get.desc.xml │ │ │ ├── collabora-online-edit.get.html.ftl │ │ │ └── collabora-online-edit.get.js │ │ └── header │ │ └── share-header.get.js │ └── fr │ └── jeci │ └── collabora-online │ └── node-header │ ├── node-header.get.desc.xml │ ├── node-header.get.html.ftl │ ├── node-header.get.js │ ├── node-header.get.properties │ ├── node-header.get_ca.properties │ ├── node-header.get_cs.properties │ ├── node-header.get_de.properties │ ├── node-header.get_en-AU.properties │ ├── node-header.get_en-GB.properties │ ├── node-header.get_en-NZ.properties │ ├── node-header.get_en-ZA.properties │ ├── node-header.get_es.properties │ ├── node-header.get_fr.properties │ ├── node-header.get_fy.properties │ ├── node-header.get_he.properties │ ├── node-header.get_hr.properties │ ├── node-header.get_hu.properties │ ├── node-header.get_is.properties │ ├── node-header.get_ja.properties │ ├── node-header.get_nb-NO.properties │ ├── node-header.get_nl.properties │ ├── node-header.get_nn.properties │ ├── node-header.get_pl.properties │ ├── node-header.get_pt-BR.properties │ ├── node-header.get_ru.properties │ ├── node-header.get_sk.properties │ ├── node-header.get_sl.properties │ ├── node-header.get_tr.properties │ └── node-header.get_uk.properties ├── collabora-vue-component ├── .eslintrc.cjs ├── .gitignore ├── .nvmrc ├── README.md ├── analyze.config.js ├── example.html ├── index.html ├── npm-shrinkwrap.json ├── package.json ├── public │ └── vite.svg ├── src │ ├── App.vue │ ├── AppExample.vue │ ├── components │ │ └── CollaboraIframe.vue │ ├── example.js │ ├── index.js │ ├── main.js │ └── style.css └── vite.config.js ├── mise.toml ├── pom.xml ├── run.sh └── src └── main └── resources ├── docker-compose.yml └── run.sh /.dahbox/mvn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # =-= =-= # 3 | # =-= DahBox mvn =-= # 4 | # =-= =-= # 5 | 6 | # DAHBOX_VERSION=beta 7 | # DAHBOX_HOME=/home/jlesage/Projets/Pristy/alfresco-collabora-online/.dahbox 8 | # DAHBOX_DATE=lun. 03 juin 2024 21:28:31 CEST 9 | # DAHBOX_COMMAND=dahbox create mvn --from maven --tag 3.9-eclipse-temurin-17 USER_HOME_DIR=\$HOME --command "mvn -Duser.home=\$HOME" --no-entrypoint 10 | # DAHBOX_SHA=0218779abda782b9291ba8ce3bf8e67083c4a315 11 | 12 | 13 | # 1. Check Image 14 | image_id=$(podman image ls --filter 'label=fr.jeci.dahbox.name=mvn' --filter 'label=fr.jeci.dahbox.sha=0218779abda782b9291ba8ce3bf8e67083c4a315' --noheading --quiet) 15 | 16 | # 2. Build Image 17 | if [[ -z "$image_id" ]]; then 18 | echo "=-= DahBox Build mvn =-=" 19 | container=$(buildah from docker.io/maven:3.9-eclipse-temurin-17) 20 | 21 | 22 | 23 | ## Include some buildtime annotations 24 | buildah config --label "fr.jeci.dahbox.name=mvn" "$container" 25 | buildah config --label "fr.jeci.dahbox.from=docker.io/maven:3.9-eclipse-temurin-17" "$container" 26 | buildah config --label "fr.jeci.dahbox.sha=0218779abda782b9291ba8ce3bf8e67083c4a315" "$container" 27 | buildah commit "$container" "dahbox/mvn:0218779abda782b9291ba8ce3bf8e67083c4a315" 28 | echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" 29 | fi 30 | 31 | export PODMAN_USERNS= 32 | 33 | # 3. Run container 34 | podman run --rm \ 35 | -e USER_HOME_DIR=$HOME \ 36 | -v "$HOME:$HOME" -w "$PWD" \ 37 | --init -it --net host --security-opt label=type:container_runtime_t --entrypoint "" \ 38 | "dahbox/mvn:0218779abda782b9291ba8ce3bf8e67083c4a315" mvn -Duser.home=$HOME "$@" 39 | -------------------------------------------------------------------------------- /.dahbox/prettier: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # =-= =-= # 3 | # =-= DahBox prettier =-= # 4 | # =-= =-= # 5 | 6 | # DAHBOX_VERSION=beta 7 | # DAHBOX_HOME=/home/jlesage/Projets/CD30/ged-mdph-master/.dahbox 8 | # DAHBOX_DATE=mer. 03 nov. 2021 15:08:34 CET 9 | # DAHBOX_COMMAND=dahbox create prettier --from node --tag 14.16-alpine --command "npx prettier" prettier 10 | # DAHBOX_SHA=382c38ccadee8983d7a7b0b07dd37827d9ac6bc8 11 | 12 | 13 | # 1. Check Image 14 | image_id=$(podman image ls --filter 'label=fr.jeci.dahbox.name=prettier' --filter 'label=fr.jeci.dahbox.sha=382c38ccadee8983d7a7b0b07dd37827d9ac6bc8' --noheading --quiet) 15 | 16 | # 2. Build Image 17 | if [[ -z "$image_id" ]]; then 18 | echo "=-= DahBox Build prettier =-=" 19 | container=$(buildah from docker.io/node:14.16-alpine) 20 | 21 | buildah run "$container" -- npm install -g prettier 22 | 23 | ## Include some buildtime annotations 24 | buildah config --label "fr.jeci.dahbox.name=prettier" "$container" 25 | buildah config --label "fr.jeci.dahbox.from=docker.io/node:14.16-alpine" "$container" 26 | buildah config --label "fr.jeci.dahbox.sha=382c38ccadee8983d7a7b0b07dd37827d9ac6bc8" "$container" 27 | buildah commit "$container" "dahbox/prettier:382c38ccadee8983d7a7b0b07dd37827d9ac6bc8" 28 | echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" 29 | fi 30 | 31 | export PODMAN_USERNS=keep-id 32 | 33 | # 3. Run container 34 | podman run --rm \ 35 | \ 36 | -v "$HOME:$HOME" -w "$PWD" \ 37 | --init -it --net host --security-opt label=type:container_runtime_t \ 38 | "dahbox/prettier:382c38ccadee8983d7a7b0b07dd37827d9ac6bc8" npx prettier "$@" 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **.log* 2 | 3 | # Maven 4 | target/ 5 | pom.xml.tag 6 | pom.xml.releaseBackup 7 | pom.xml.versionsBackup 8 | pom.xml.next 9 | release.properties 10 | dependency-reduced-pom.xml 11 | buildNumber.properties 12 | .mvn/timing.properties 13 | .mvn/wrapper/maven-wrapper.jar 14 | 15 | # compiled output 16 | /dist 17 | /tmp 18 | /out-tsc 19 | /docker-compose/ 20 | 21 | # Nodejs 22 | node/ 23 | 24 | # dependencies 25 | /node_modules 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | yarn-error.log 34 | testem.log 35 | /typings 36 | 37 | # IDE 38 | .c9/ 39 | *.launch 40 | *.sublime-workspace 41 | 42 | # Eclipse 43 | .metadata 44 | .project 45 | .classpath 46 | bin/ 47 | tmp/ 48 | *.tmp 49 | .settings/ 50 | .loadpath 51 | .recommenders 52 | 53 | # IntelliJ IDEA 54 | **.idea 55 | **.iml 56 | 57 | # Visual Studio Code 58 | .vscode/* 59 | !.vscode/settings.json 60 | !.vscode/tasks.json 61 | !.vscode/launch.json 62 | !.vscode/extensions.json 63 | 64 | # System Files 65 | *.DS_Store 66 | Thumbs.db 67 | .envrc 68 | .direnv 69 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | stages: 3 | - deploy 4 | 5 | default: 6 | image: docker.io/maven:3.9-eclipse-temurin-17 7 | tags: 8 | - docker 9 | - jeci 10 | 11 | variables: 12 | # This will supress any download for dependencies and plugins or upload messages which would clutter the console log. 13 | # `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work. 14 | MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" 15 | # As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used 16 | # when running from the command line. 17 | # `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins. 18 | MAVEN_CLI_OPTS: "-s ci_settings.xml --batch-mode --errors --show-version -DinstallAtEnd=true -DdeployAtEnd=true" 19 | 20 | # Cache downloaded dependencies and plugins between builds. 21 | # To keep cache across branches add 'key: "$CI_JOB_NAME"' 22 | cache: 23 | paths: 24 | - .m2/repository 25 | 26 | maven-deploy: 27 | stage: deploy 28 | script: 29 | - source ${NEXUS_SECRET_FILE} 30 | - mvn $MAVEN_CLI_OPTS deploy 31 | artifacts: 32 | paths: 33 | - "**/target/*.jar" 34 | - "**/target/*.amp" 35 | - "**/target/*.tgz" 36 | except: 37 | - tags 38 | -------------------------------------------------------------------------------- /alfresco-collabora-online-docker/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | alfresco-collabora-online-docker 7 | Collabora Online Alfresco Docker Proxy 8 | Collabora Online Alfresco - Image Docker Proxy 9 | pom 10 | 11 | 12 | fr.jeci.alfresco 13 | alfresco-collabora-online 14 | 1.2.0 15 | 16 | 17 | 18 | 19 | 20 | 21 | org.apache.maven.plugins 22 | maven-resources-plugin 23 | 24 | 25 | copy-and-filter-docker-resources 26 | validate 27 | 28 | copy-resources 29 | 30 | 31 | ${project.build.directory} 32 | 33 | 34 | src/main/docker 35 | true 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | org.apache.maven.plugins 44 | maven-deploy-plugin 45 | 46 | true 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /alfresco-collabora-online-docker/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ${docker.nginx.image}:${docker.nginx.version} 2 | 3 | ARG GROUPNAME=Alfresco 4 | ARG GROUPID=1000 5 | ARG USERNAME=aca 6 | ARG USERID=33009 7 | 8 | WORKDIR /usr/share/nginx/html 9 | 10 | COPY nginx.conf cors_support.conf proxy_pass.conf /etc/nginx/ 11 | 12 | RUN addgroup -g ${GROUPID} ${GROUPNAME} && \ 13 | adduser -S -u ${USERID} -G ${GROUPNAME} -s "/bin/bash" ${USERNAME} && \ 14 | chown -R ${USERNAME}:${GROUPNAME} /usr/share/nginx/html && \ 15 | chown -R ${USERNAME}:${GROUPNAME} /var/cache/nginx && \ 16 | touch /var/run/nginx.pid && \ 17 | chown -R ${USERNAME}:${GROUPNAME} /var/run/nginx.pid 18 | 19 | EXPOSE 8080 20 | USER ${USERNAME} 21 | CMD nginx -g 'daemon off;' -------------------------------------------------------------------------------- /alfresco-collabora-online-docker/src/main/docker/cors_support.conf: -------------------------------------------------------------------------------- 1 | # CORS - http://enable-cors.org/ 2 | if ($request_method = 'OPTIONS') { 3 | add_header 'Access-Control-Allow-Origin' '*'; 4 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; 5 | add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; 6 | 7 | # Tell client that this pre-flight info is valid for 20 days 8 | add_header 'Access-Control-Max-Age' 1728000; 9 | add_header 'Content-Type' 'text/plain charset=UTF-8'; 10 | add_header 'Content-Length' 0; 11 | return 204; 12 | } 13 | if ($request_method = 'POST') { 14 | add_header 'Access-Control-Allow-Origin' '*'; 15 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; 16 | add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; 17 | add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; 18 | } 19 | if ($request_method = 'GET') { 20 | add_header 'Access-Control-Allow-Origin' '*'; 21 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; 22 | add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; 23 | add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; 24 | } 25 | -------------------------------------------------------------------------------- /alfresco-collabora-online-docker/src/main/docker/proxy_pass.conf: -------------------------------------------------------------------------------- 1 | proxy_http_version 1.1; 2 | proxy_set_header Host $host; 3 | proxy_set_header X-Real-IP $remote_addr; 4 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 5 | proxy_set_header X-Forwarded-Host $host:$server_port; 6 | proxy_set_header X-Forwarded-Server $host; 7 | proxy_set_header X-Forwarded-Proto $scheme; 8 | 9 | # Mitigate httpoxy attack http://httpoxy.org/ 10 | proxy_set_header Proxy ""; 11 | -------------------------------------------------------------------------------- /ci_settings.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | gitlab-maven 6 | 7 | 8 | 9 | Job-Token 10 | ${env.CI_JOB_TOKEN} 11 | 12 | 13 | 14 | 15 | 16 | pristy-releases 17 | ${env.NEXUS_USERNAME} 18 | ${env.NEXUS_PASSWORD} 19 | 20 | 21 | pristy-snapshots 22 | ${env.NEXUS_USERNAME} 23 | ${env.NEXUS_PASSWORD} 24 | 25 | 26 | jeci-maven-public 27 | ${env.NEXUS_USERNAME} 28 | ${env.NEXUS_PASSWORD} 29 | 30 | 31 | 32 | 33 | jeci-maven-public 34 | Maven mirror 35 | https://nexus.jeci.tech/repository/maven-public/ 36 | central,alfresco-public,alfresco-public-snapshots,alfresco-private-repository,alfresco-plugin-public,alfresco-plugin-public-snapshots 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /collabora-aca-extension-docker/src/main/docker/cors_support.conf: -------------------------------------------------------------------------------- 1 | # CORS - http://enable-cors.org/ 2 | if ($request_method = 'OPTIONS') { 3 | add_header 'Access-Control-Allow-Origin' '*'; 4 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; 5 | add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; 6 | 7 | # Tell client that this pre-flight info is valid for 20 days 8 | add_header 'Access-Control-Max-Age' 1728000; 9 | add_header 'Content-Type' 'text/plain charset=UTF-8'; 10 | add_header 'Content-Length' 0; 11 | return 204; 12 | } 13 | if ($request_method = 'POST') { 14 | add_header 'Access-Control-Allow-Origin' '*'; 15 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; 16 | add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; 17 | add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; 18 | } 19 | if ($request_method = 'GET') { 20 | add_header 'Access-Control-Allow-Origin' '*'; 21 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; 22 | add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; 23 | add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; 24 | } 25 | -------------------------------------------------------------------------------- /collabora-aca-extension-docker/src/main/docker/proxy_pass.conf: -------------------------------------------------------------------------------- 1 | proxy_http_version 1.1; 2 | proxy_set_header Host $host; 3 | proxy_set_header X-Real-IP $remote_addr; 4 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 5 | proxy_set_header X-Forwarded-Host $host:$server_port; 6 | proxy_set_header X-Forwarded-Server $host; 7 | proxy_set_header X-Forwarded-Proto $scheme; 8 | 9 | # Mitigate httpoxy attack http://httpoxy.org/ 10 | proxy_set_header Proxy ""; 11 | -------------------------------------------------------------------------------- /collabora-aca-extension/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /collabora-aca-extension/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | /node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | yarn-error.log 34 | testem.log 35 | /typings 36 | 37 | # System Files 38 | .DS_Store 39 | Thumbs.db 40 | 41 | # Maven 42 | target/ 43 | pom.xml.tag 44 | pom.xml.releaseBackup 45 | pom.xml.versionsBackup 46 | pom.xml.next 47 | release.properties 48 | dependency-reduced-pom.xml 49 | buildNumber.properties 50 | .mvn/timing.properties 51 | .mvn/wrapper/maven-wrapper.jar 52 | 53 | # Nodejs 54 | 55 | node/ 56 | -------------------------------------------------------------------------------- /collabora-aca-extension/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | e2e 3 | -------------------------------------------------------------------------------- /collabora-aca-extension/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /collabora-aca-extension/README.md: -------------------------------------------------------------------------------- 1 | # ACA Extension Collabora 2 | 3 | Extension for [Alfresco-Content-Application](https://github.com/Alfresco/alfresco-content-app) to edit documents with Collabora Online. 4 | This extension add a button and open a iFrame to edit the document. 5 | 6 | ## Building 7 | 8 | Run the following script to build the library 9 | 10 | ```sh 11 | npm run build:collabora-online-extension 12 | ``` 13 | 14 | ## Publishing 15 | 16 | ```sh 17 | cd dist/@jeci/collabora-online-extension 18 | npm publish --access=public 19 | ``` 20 | 21 | ## Testing with local ACA instance 22 | 23 | Build and package the extension library locally without publishing to NPM: 24 | 25 | ```sh 26 | npm run package:collabora-online-extension 27 | ``` 28 | 29 | The script produces the `dist/collabora-online-extension/collabora-online-extension-.tgz` file that can be used to install dependency. 30 | 31 | Switch to the ACA project and run: 32 | 33 | ```sh 34 | npm i /aca-extension-collabora/dist/@jeci/collabora-online-extension/jeci-collabora-online-extension-.tgz 35 | ``` 36 | 37 | Update the `extensions.module.ts` file in the folder `src/app/` and append the module: 38 | 39 | ```ts 40 | import { CollaboraOnlineModule } from '@jeci/collabora-online-extension'; 41 | 42 | @NgModule({ 43 | imports: [ 44 | ..., 45 | CollaboraOnlineModule 46 | ] 47 | }) 48 | export class AppExtensionsModule {} 49 | ``` 50 | 51 | Update the `app.extensions.json` file in the foler `src/assets/` and register new plugin: 52 | 53 | ```json 54 | { 55 | "$schema": "../../extension.schema.json", 56 | "$name": "app", 57 | "$version": "1.0.0", 58 | "$references": [ 59 | "collabora-online.plugin.json" 60 | ], 61 | } 62 | ``` 63 | 64 | In `angular.json` file add these lines : 65 | 66 | ``` 67 | { 68 | ... 69 | "projects": { 70 | "app": { 71 | ... 72 | "architect": { 73 | "build": { 74 | ... 75 | "options": { 76 | ... 77 | "assets": [ 78 | ... 79 | { 80 | "glob": "collabora-online.plugin.json", 81 | "input": "node_modules/@jeci/collabora-online-extension/assets", 82 | "output": "/assets/plugins" 83 | }, 84 | { 85 | "glob": "**/*", 86 | "input": "node_modules/@jeci/collabora-online-extension/assets", 87 | "output": "/assets/collabora-online-extension" 88 | } 89 | ] 90 | } 91 | } 92 | } 93 | } 94 | } 95 | } 96 | ``` 97 | 98 | Run the ACA application 99 | 100 | ```sh 101 | npm start 102 | ``` 103 | 104 | Depending on the setup, you might need to log in as an administrator and enable external plugins feature for your local run. 105 | -------------------------------------------------------------------------------- /collabora-aca-extension/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "collabora-online-extension": { 7 | "root": "projects/collabora-online-extension", 8 | "sourceRoot": "projects/collabora-online-extension/src", 9 | "projectType": "library", 10 | "prefix": "lib", 11 | "architect": { 12 | "build": { 13 | "builder": "@angular-devkit/build-ng-packagr:build", 14 | "options": { 15 | "tsConfig": "projects/collabora-online-extension/tsconfig.lib.json", 16 | "project": "projects/collabora-online-extension/ng-package.json" 17 | } 18 | }, 19 | "test": { 20 | "builder": "@angular-devkit/build-angular:karma", 21 | "options": { 22 | "main": "projects/collabora-online-extension/src/test.ts", 23 | "tsConfig": "projects/collabora-online-extension/tsconfig.spec.json", 24 | "karmaConfig": "projects/collabora-online-extension/karma.conf.js" 25 | } 26 | }, 27 | "lint": { 28 | "builder": "@angular-devkit/build-angular:tslint", 29 | "options": { 30 | "tsConfig": [ 31 | "projects/collabora-online-extension/tsconfig.lib.json", 32 | "projects/collabora-online-extension/tsconfig.spec.json" 33 | ], 34 | "exclude": [ 35 | "**/node_modules/**" 36 | ] 37 | } 38 | } 39 | } 40 | } 41 | }, 42 | "defaultProject": "aca-extension-collabora" 43 | } 44 | -------------------------------------------------------------------------------- /collabora-aca-extension/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jeci/alfresco-collabora-online", 3 | "version": "1.0.1", 4 | "license": "Apache-2.0", 5 | "scripts": { 6 | "ng": "ng", 7 | "build": "ng build collabora-online-extension", 8 | "copy:assets": "cpr projects/collabora-online-extension/assets dist/@jeci/collabora-online-extension/assets --deleteFirst", 9 | "build:schematics": "cd projects/collabora-online-extension && npm run build", 10 | "postbuild": "npm run copy:assets && npm run build:schematics", 11 | "test": "ng test collabora-online-extension", 12 | "lint": "ng lint collabora-online-extension", 13 | "pack": "cd dist/@jeci/collabora-online-extension && npm pack", 14 | "package": "npm run build && npm run pack" 15 | }, 16 | "private": true, 17 | "dependencies": { 18 | "@alfresco/aca-shared": "^1.12.0", 19 | "@alfresco/adf-content-services": "3.9.0", 20 | "@alfresco/adf-core": "3.9.0", 21 | "@alfresco/adf-extensions": "3.9.0", 22 | "@alfresco/js-api": "3.9.0", 23 | "@angular/animations": "7.0.3", 24 | "@angular/cdk": "7.0.3", 25 | "@angular/common": "7.0.3", 26 | "@angular/compiler": "7.0.3", 27 | "@angular/core": "7.0.3", 28 | "@angular/flex-layout": "^7.0.0-beta.19", 29 | "@angular/forms": "7.0.3", 30 | "@angular/http": "7.0.3", 31 | "@angular/material": "7.0.3", 32 | "@angular/material-moment-adapter": "7.0.3", 33 | "@angular/platform-browser": "7.0.3", 34 | "@angular/platform-browser-dynamic": "7.0.3", 35 | "@angular/router": "7.0.3", 36 | "@mat-datetimepicker/core": "^2.0.1", 37 | "@mat-datetimepicker/moment": "^2.0.1", 38 | "@ngrx/effects": "^7.4.0", 39 | "@ngrx/store": "^7.4.0", 40 | "@ngx-translate/core": "11.0.0", 41 | "core-js": "^2.5.4", 42 | "cpr": "^3.0.1", 43 | "moment": "^2.22.2", 44 | "moment-es6": "^1.0.0", 45 | "pdfjs-dist": "^2.0.489", 46 | "rxjs": "^6.2.2", 47 | "zone.js": "~0.8.26" 48 | }, 49 | "devDependencies": { 50 | "@angular-devkit/build-angular": "~0.10.0", 51 | "@angular-devkit/build-ng-packagr": "~0.10.0", 52 | "@angular/cli": "^7.0.5", 53 | "@angular/compiler-cli": "7.0.3", 54 | "@types/jasmine": "~2.8.3", 55 | "@types/jasminewd2": "~2.0.2", 56 | "@types/node": "6.0.90", 57 | "codelyzer": "^4.5.0", 58 | "jasmine-core": "~2.99.1", 59 | "jasmine-spec-reporter": "~4.2.1", 60 | "karma": "~1.7.1", 61 | "karma-chrome-launcher": "~2.2.0", 62 | "karma-coverage-istanbul-reporter": "~2.0.0", 63 | "karma-jasmine": "~1.1.1", 64 | "karma-jasmine-html-reporter": "^0.2.2", 65 | "ng-packagr": "^4.7.1", 66 | "protractor": "^5.4.0", 67 | "ts-node": "~4.1.0", 68 | "tsickle": "0.34.0", 69 | "tslib": "^1.9.0", 70 | "tslint": "5.9.1", 71 | "typescript": "3.1.6" 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/collabora-online.plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../extension.schema.json", 3 | "$version": "1.0.0", 4 | "$id": "collabora-online", 5 | "$name": "collabora-online.plugin", 6 | "$description": "Collabora Online plugin", 7 | "$vendor": "Jeci", 8 | "$license": "LGPL-3.0", 9 | "$runtime": "1.10.0", 10 | "actions": [ 11 | { 12 | "id": "collabora.plugin.actions.edit", 13 | "type": "COLLABORA_EDIT", 14 | "payload": "$(context.selection.first.entry)" 15 | } 16 | ], 17 | "features": { 18 | "icons": [ 19 | { 20 | "id": "adf:edit_collabora_online", 21 | "value": "./assets/collabora-online-extension/images/collabora-online-logo.svg" 22 | } 23 | ], 24 | "toolbar": [ 25 | { 26 | "id": "collabora.plugin.viewer.edit", 27 | "type": "button", 28 | "order": 350, 29 | "icon": "adf:edit_collabora_online", 30 | "title": "COLLABORA.EDIT", 31 | "actions": { 32 | "click": "collabora.plugin.actions.edit" 33 | }, 34 | "rules": { 35 | "visible": "collabora.canEditWithCollaboraOnline" 36 | } 37 | } 38 | ], 39 | "shared": { 40 | "toolbarActions": [ 41 | { 42 | "id": "collabora.plugin.viewer.edit", 43 | "type": "button", 44 | "order": 350, 45 | "icon": "adf:edit_collabora_online", 46 | "title": "COLLABORA.EDIT", 47 | "actions": { 48 | "click": "collabora.plugin.actions.edit" 49 | }, 50 | "rules": { 51 | "visible": "collabora.canEditWithCollaboraOnline" 52 | } 53 | } 54 | ] 55 | }, 56 | "contextMenu": [ 57 | { 58 | "id": "collabora.plugin.viewer.edit", 59 | "type": "button", 60 | "order": 451, 61 | "icon": "adf:edit_collabora_online", 62 | "title": "COLLABORA.EDIT", 63 | "actions": { 64 | "click": "collabora.plugin.actions.edit" 65 | }, 66 | "rules": { 67 | "visible": "collabora.canEditWithCollaboraOnline" 68 | } 69 | } 70 | ] 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/ca.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Desa i tanca", 4 | "EDIT": "Edita amb el Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/cs.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/de.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "EDIT": "Edit with Collabora™ Online", 4 | "SAVE_CLOSE": "Save and close" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/en_AU.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Save and close", 4 | "EDIT": "Edit with Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/en_GB.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Save and close", 4 | "EDIT": "Edit with Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/en_NZ.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "EDIT": "Edit with Collabora™ Online", 4 | "SAVE_CLOSE": "Save and close" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/en_ZA.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Save and close", 4 | "EDIT": "Edit with Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/es.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Guardar y cerrar", 4 | "EDIT": "Editar con Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "EDIT": "Modifier avec Collabora™ Online", 4 | "SAVE_CLOSE": "Sauvegarder et Fermer" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/fy.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/he.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "שמירה וסגירה", 4 | "EDIT": "עריכה עם Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/hr.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Spremi i zatvori", 4 | "EDIT": "Uredi s Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/hu.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Mentés és bezárás", 4 | "EDIT": "Szerkesztés a Collabora™ Online-nal" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/is.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Vista og loka", 4 | "EDIT": "Breyta með Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/ja.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "EDIT": "Collabora™ Online で編集", 4 | "SAVE_CLOSE": "保存して終了" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/nb_NO.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Lagre og lukk", 4 | "EDIT": "Rediger med Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/nl.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Opslaan en sluiten", 4 | "EDIT": "Bewerk met Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/nn.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/pl.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "EDIT": "Edytuj za pomocą Collabora™ Online", 4 | "SAVE_CLOSE": "Zapisz i zamknij" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/pt_BR.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Salve e feche", 4 | "EDIT": "Editar com Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/ru.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/sk.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Uložiť a zavrieť", 4 | "EDIT": "Upraviť pomocou Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/sl.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Shrani in zapri", 4 | "EDIT": "Uredi s Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/tr.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Kaydet ve kapat", 4 | "EDIT": "Collabora™ Online ile düzenle" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/i18n/uk.json: -------------------------------------------------------------------------------- 1 | { 2 | "COLLABORA": { 3 | "SAVE_CLOSE": "Зберегти й закрити", 4 | "EDIT": "Редагуйте за допомогою Collabora™ Online" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/assets/images/collabora-online-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | image/svg+xml 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../../coverage'), 20 | reports: ['html', 'lcovonly'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; 32 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../dist/@jeci/collabora-online-extension", 4 | "lib": { 5 | "entryFile": "src/public_api.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jeci/collabora-online-extension", 3 | "version": "1.0.1", 4 | "scripts": { 5 | "build": "../../node_modules/.bin/tsc -p tsconfig.schematics.json", 6 | "copy:schemas": "cp --parents schematics/*/schema.json ../../dist/@jeci/collabora-online-extension/", 7 | "copy:files": "cp --parents -p schematics/*/files/** ../../dist/@jeci/collabora-online-extension/", 8 | "copy:collection": "cp schematics/collection.json ../../dist/@jeci/collabora-online-extension/schematics/collection.json", 9 | "postbuild": "npm run copy:collection" 10 | }, 11 | "peerDependencies": { 12 | "@angular/common": "^7.0.3", 13 | "@angular/core": "^7.0.3" 14 | }, 15 | "schematics": "./schematics/collection.json", 16 | "ng-add": { 17 | "save": "devDependencies" 18 | }, 19 | "alfresco": { 20 | "extension": "assets/collabora-online.plugin.json", 21 | "module": "CollaboraOnlineModule", 22 | "namespace": "collabora-online-extension" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/schematics/collection.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json", 3 | "schematics": { 4 | "ng-add": { 5 | "description": "Add my library to the project.", 6 | "factory": "./ng-add/index#ngAdd" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/schematics/ng-add/index.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Rule, SchematicContext, SchematicsException, Tree 3 | } from '@angular-devkit/schematics'; 4 | import { getProjectFromWorkspace, getProjectTargetOptions } from '@angular/cdk/schematics'; 5 | import { getWorkspace } from '@schematics/angular/utility/config'; 6 | import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks'; 7 | 8 | const pathSegment = '@jeci/collabora-online-extension'; 9 | const confObject = { 10 | "glob": "collabora-online.plugin.json", 11 | "input": "node_modules/@jeci/collabora-online-extension/assets", 12 | "output": "/assets/plugins" 13 | }; 14 | const assetObject = 15 | { 16 | "glob": "**/*", 17 | "input": "node_modules/@jeci/collabora-online-extension/assets", 18 | "output": "/assets/collabora-online-extension" 19 | } 20 | 21 | // Just return the tree 22 | export function ngAdd(options: any): Rule { 23 | return (tree: Tree, context: SchematicContext) => { 24 | context.addTask(new NodePackageInstallTask()); 25 | 26 | const workspace = getWorkspace(tree); 27 | const project = getProjectFromWorkspace(workspace, options.project); 28 | const targetOptions = getProjectTargetOptions(project, 'build'); 29 | 30 | const workspaceConfig = tree.read('/angular.json'); 31 | if (!workspaceConfig) { 32 | throw new SchematicsException('Could not find Angular workspace configuration'); 33 | } 34 | 35 | if (!targetOptions.assets) { 36 | targetOptions.assets = [ { ...assetObject } ]; 37 | targetOptions.assets = [ { ...confObject } ]; 38 | } else { 39 | const assets = targetOptions.assets as Array; 40 | const assetsString = JSON.stringify(assets); 41 | if (!assetsString.includes(pathSegment)) { 42 | assets.push({ ...assetObject }); 43 | assets.push({ ...confObject }); 44 | } else { 45 | console.log(); 46 | console.log(`Could not add the icon assets to the CLI project assets ` + 47 | `because there is already a icon assets file referenced.`); 48 | console.log(`Please manually add the following config to your assets:`); 49 | console.log(JSON.stringify({ ...assetObject, ...confObject }, null, 2)); 50 | return tree; 51 | } 52 | } 53 | tree.overwrite('angular.json', JSON.stringify(workspace, null, 2)); 54 | 55 | return tree; 56 | }; 57 | } 58 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/src/lib/actions/collabora-online.actions.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Jeci. 3 | * https://jeci.fr/ 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | */ 18 | import { Action } from '@ngrx/store'; 19 | import { MinimalNodeEntryEntity } from '@alfresco/js-api'; 20 | 21 | export const COLLABORA_EDIT = "COLLABORA_EDIT"; 22 | 23 | export class CollaboraOnlineEdit implements Action { 24 | readonly type = COLLABORA_EDIT; 25 | constructor(public payload: MinimalNodeEntryEntity) {} 26 | } 27 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/src/lib/components/collabora-online.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 |
17 | 18 | {{ fileName }} 20 |
21 | 22 | 23 | 24 | 25 | 36 | 37 |
38 | 39 |
40 |
41 | 45 | 46 |
47 |
48 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/src/lib/components/collabora-online.component.scss: -------------------------------------------------------------------------------- 1 | #loleafletframe { 2 | width: 100%; 3 | height: 100%; 4 | position: absolute; 5 | border: 0 none; 6 | } 7 | 8 | #loolcontainer { 9 | position: fixed; 10 | bottom: 0px; 11 | width: 100%; 12 | top: 48px; 13 | left: 0; 14 | background: white; 15 | } 16 | 17 | .adf-viewer-toolbar .mat-toolbar .adf-toolbar-title { 18 | width: auto; 19 | } 20 | 21 | .adf-viewer-toolbar .adf-toolbar-divider { 22 | display: none; 23 | } 24 | 25 | // todo: remove this when viewer supports extensions 26 | .adf-viewer-toolbar .mat-toolbar > button:last-child { 27 | display: none; 28 | } 29 | 30 | .adf-viewer.right_side--hide .adf-viewer__sidebar__right { 31 | width: 0; 32 | } 33 | 34 | .fileName{ 35 | font-size: 14px; 36 | margin:auto; 37 | } 38 | .filler{ 39 | flex: 1 1; 40 | } 41 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/src/lib/components/collabora-online.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Jeci. 3 | * https://jeci.fr/ 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | */ 18 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 19 | 20 | import { CollaboraOnlineComponent } from './collabora-online.component'; 21 | 22 | describe('CollaboraComponent', () => { 23 | let component: CollaboraOnlineComponent; 24 | let fixture: ComponentFixture; 25 | 26 | beforeEach(async(() => { 27 | TestBed.configureTestingModule({ 28 | declarations: [ CollaboraOnlineComponent ] 29 | }) 30 | .compileComponents(); 31 | })); 32 | 33 | beforeEach(() => { 34 | fixture = TestBed.createComponent(CollaboraOnlineComponent); 35 | component = fixture.componentInstance; 36 | fixture.detectChanges(); 37 | }); 38 | 39 | it('should create', () => { 40 | expect(component).toBeTruthy(); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/src/lib/components/viewer/viewer-collabora-online.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 7 | 8 |
9 |
10 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/src/lib/components/viewer/viewer-collabora-online.component.scss: -------------------------------------------------------------------------------- 1 | #loleafletframe { 2 | width: 100%; 3 | height: 100%; 4 | position: absolute; 5 | border: 0 none; 6 | } 7 | 8 | #loolcontainer { 9 | position: fixed; 10 | bottom: 0px; 11 | width: 100%; 12 | top: 48px; 13 | left: 0; 14 | background: white; 15 | } 16 | 17 | .adf-viewer-toolbar .mat-toolbar .adf-toolbar-title { 18 | width: auto; 19 | } 20 | 21 | .adf-viewer-toolbar .adf-toolbar-divider { 22 | display: none; 23 | } 24 | 25 | // todo: remove this when viewer supports extensions 26 | .adf-viewer-toolbar .mat-toolbar > button:last-child { 27 | display: none; 28 | } 29 | 30 | .adf-viewer.right_side--hide .adf-viewer__sidebar__right { 31 | width: 0; 32 | } 33 | 34 | .fileName{ 35 | font-size: 14px; 36 | margin:auto; 37 | } 38 | .filler{ 39 | flex: 1 1; 40 | } 41 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/src/lib/components/viewer/viewer-collabora-online.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Jeci. 3 | * https://jeci.fr/ 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | */ 18 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 19 | 20 | import { ViewerCollaboraOnlineComponent } from './viewer-collabora-online.component'; 21 | 22 | describe('CollaboraComponent', () => { 23 | let component: ViewerCollaboraOnlineComponent; 24 | let fixture: ComponentFixture; 25 | 26 | beforeEach(async(() => { 27 | TestBed.configureTestingModule({ 28 | declarations: [ ViewerCollaboraOnlineComponent ] 29 | }) 30 | .compileComponents(); 31 | })); 32 | 33 | beforeEach(() => { 34 | fixture = TestBed.createComponent(ViewerCollaboraOnlineComponent); 35 | component = fixture.componentInstance; 36 | fixture.detectChanges(); 37 | }); 38 | 39 | it('should create', () => { 40 | expect(component).toBeTruthy(); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/src/lib/components/viewer/viewer-collabora.module.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Jeci. 3 | * https://jeci.fr/ 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | */ 18 | import { NgModule } from '@angular/core'; 19 | import { CommonModule } from '@angular/common'; 20 | 21 | import { ViewerCollaboraOnlineComponent } from './viewer-collabora-online.component'; 22 | 23 | @NgModule({ 24 | declarations: [ViewerCollaboraOnlineComponent], 25 | entryComponents: [ViewerCollaboraOnlineComponent], 26 | exports: [ViewerCollaboraOnlineComponent], 27 | imports: [ 28 | CommonModule 29 | ], 30 | providers: [] 31 | }) 32 | 33 | export class ViewerCollaboraModule {} 34 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/src/lib/effects/collabora-online.effects.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Jeci. 3 | * https://jeci.fr/ 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | */ 18 | import { Injectable } from '@angular/core'; 19 | import { Actions, Effect, ofType } from '@ngrx/effects'; 20 | import { map } from 'rxjs/operators'; 21 | 22 | import { CollaboraOnlineEdit, COLLABORA_EDIT } from '../actions/collabora-online.actions'; 23 | import { CollaboraOnlineService } from '../services/collabora-online.service'; 24 | 25 | @Injectable() 26 | export class CollaboraEffects { 27 | constructor( private actions$: Actions, private collaboraOnlineService: CollaboraOnlineService) {} 28 | 29 | @Effect({ dispatch: false }) 30 | collaboraOnlineEdit$ = this.actions$.pipe( 31 | ofType(COLLABORA_EDIT), 32 | map(action => { 33 | if (action.payload) { 34 | this.collaboraOnlineService.onEdit(action.payload); 35 | } 36 | }) 37 | ); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/src/lib/rules/evaluators.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Jeci. 3 | * https://jeci.fr/ 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | export function canUseCollaboraExtension(context): boolean { 20 | if ( 21 | context.navigation && 22 | context.navigation.url && 23 | context.navigation.url.startsWith("/trashcan") 24 | ) { 25 | return false; 26 | } 27 | 28 | // check if collabora is enabled 29 | if (!context || !context.appConfig.get('collabora.enable')) { 30 | return false; 31 | } 32 | 33 | // check if element is selected 34 | if (!context || !context.selection) { 35 | return false; 36 | } 37 | 38 | return true; 39 | } 40 | 41 | export function getExtension(filename: string): string { 42 | const position = filename.lastIndexOf('.'); 43 | return filename.substring(position + 1); 44 | } 45 | 46 | export function canEditWithCollaboraOnline(context): boolean { 47 | if (canUseCollaboraExtension(context)) { 48 | const { file } = context.selection; 49 | 50 | // check if is file 51 | if (!file || !file.entry) { 52 | return false; 53 | } 54 | 55 | // check if file is locked 56 | if (file.entry.isLocked) { 57 | return false; 58 | } 59 | if (!file.entry.properties) { 60 | return false; 61 | } 62 | if (file.entry.properties['cm:lockType'] === 'WRITE_LOCK' 63 | || file.entry.properties['cm:lockType'] === 'READ_ONLY_LOCK') { 64 | return false; 65 | } 66 | const lockOwner = file.entry.properties['cm:lockOwner']; 67 | if (lockOwner && lockOwner.id !== context.profile.id) { 68 | return false; 69 | } 70 | 71 | // check the extension of file 72 | const extension: string = getExtension(file.entry.name); 73 | const extCanEdit: string[] = context.appConfig.get('collabora.edit'); 74 | if (!extension) { 75 | return false; 76 | } 77 | if (extCanEdit.indexOf(extension) > -1) { 78 | return context.permissions.check(file, ['update']); 79 | } 80 | } 81 | return false; 82 | } 83 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/src/lib/services/collabora-online.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Jeci. 3 | * https://jeci.fr/ 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | */ 18 | import { TestBed } from '@angular/core/testing'; 19 | 20 | import { CollaboraOnlineService } from './collabora-online.service'; 21 | 22 | describe('CollaboraOnlineService', () => { 23 | beforeEach(() => TestBed.configureTestingModule({})); 24 | 25 | it('should be created', () => { 26 | const service: CollaboraOnlineService = TestBed.get(CollaboraOnlineService); 27 | expect(service).toBeTruthy(); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/src/public_api.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Public API Surface of collabora extension 3 | */ 4 | 5 | export * from './lib/components/collabora-online.component'; 6 | export * from './lib/components/collabora-online.module'; 7 | 8 | export * from './lib/components/viewer/viewer-collabora.module'; 9 | export * from './lib/components/viewer/viewer-collabora-online.component'; 10 | 11 | export * from './lib/services/collabora-online.service'; 12 | export * from './lib/rules/evaluators'; 13 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'core-js/es7/reflect'; 4 | import 'zone.js/dist/zone'; 5 | import 'zone.js/dist/zone-testing'; 6 | import { getTestBed } from '@angular/core/testing'; 7 | import { 8 | BrowserDynamicTestingModule, 9 | platformBrowserDynamicTesting 10 | } from '@angular/platform-browser-dynamic/testing'; 11 | 12 | declare const require: any; 13 | 14 | // First, initialize the Angular testing environment. 15 | getTestBed().initTestEnvironment( 16 | BrowserDynamicTestingModule, 17 | platformBrowserDynamicTesting() 18 | ); 19 | // Then we find all the tests. 20 | const context = require.context('./', true, /\.spec\.ts$/); 21 | // And load the modules. 22 | context.keys().map(context); 23 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/lib", 5 | "target": "es2015", 6 | "module": "es2015", 7 | "moduleResolution": "node", 8 | "declaration": true, 9 | "sourceMap": true, 10 | "inlineSources": true, 11 | "emitDecoratorMetadata": true, 12 | "experimentalDecorators": true, 13 | "importHelpers": true, 14 | "types": [], 15 | "lib": [ 16 | "dom", 17 | "es2015" 18 | ] 19 | }, 20 | "angularCompilerOptions": { 21 | "annotateForClosureCompiler": true, 22 | "skipTemplateCodegen": true, 23 | "strictMetadataEmit": true, 24 | "fullTemplateTypeCheck": true, 25 | "strictInjectionParameters": true, 26 | "enableResourceInlining": true 27 | }, 28 | "exclude": [ 29 | "src/test.ts", 30 | "**/*.spec.ts" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/tsconfig.schematics.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "lib": [ 5 | "es2018", 6 | "dom" 7 | ], 8 | "declaration": true, 9 | "module": "commonjs", 10 | "moduleResolution": "node", 11 | "noEmitOnError": true, 12 | "noFallthroughCasesInSwitch": true, 13 | "noImplicitAny": true, 14 | "noImplicitThis": true, 15 | "noUnusedParameters": true, 16 | "noUnusedLocals": true, 17 | "rootDir": "schematics", 18 | "outDir": "../../dist/@jeci/collabora-online-extension/schematics", 19 | "skipDefaultLibCheck": true, 20 | "skipLibCheck": true, 21 | "sourceMap": true, 22 | "strictNullChecks": true, 23 | "target": "es6", 24 | "types": [ 25 | "jasmine", 26 | "node" 27 | ] 28 | }, 29 | "include": [ 30 | "schematics/**/*" 31 | ], 32 | "exclude": [ 33 | "schematics/*/files/**/*" 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts" 12 | ], 13 | "include": [ 14 | "**/*.spec.ts", 15 | "**/*.d.ts" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /collabora-aca-extension/projects/collabora-online-extension/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "lib", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "lib", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /collabora-aca-extension/src/main/assembly/assembly.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | dist 8 | 9 | 10 | tgz 11 | 12 | 13 | false 14 | 15 | 16 | 17 | 18 | dist/@jeci/collabora-online-extension/ 19 | package 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /collabora-aca-extension/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "es2015", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "target": "es5", 13 | "typeRoots": [ 14 | "node_modules/@types" 15 | ], 16 | "lib": [ 17 | "es2017", 18 | "dom" 19 | ], 20 | "paths": { 21 | "collabora-online-extension": [ 22 | "dist/collabora-online-extension" 23 | ], 24 | "collabora-online-extension/*": [ 25 | "dist/collabora-online-extension/*" 26 | ] 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /collabora-online-integration-tests/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | collabora-online-integration-tests 6 | Integration Tests Module 7 | Integration Tests module for in-container integration testing - part of AIO - SDK 4.0 8 | jar 9 | 10 | 11 | fr.jeci.alfresco 12 | alfresco-collabora-online 13 | 0.3.0 14 | 15 | 16 | 17 | 18 | 19 | fr.jeci.alfresco 20 | collabora-online-platform 21 | 0.3.0 22 | test 23 | 24 | 25 | 26 | 27 | 28 | 29 | src/test/resources 30 | true 31 | 32 | 33 | 34 | 35 | 36 | org.zeroturnaround 37 | jrebel-maven-plugin 38 | 39 | ${project.build.testOutputDirectory} 40 | 41 | 42 | 43 | 44 | org.apache.maven.plugins 45 | maven-jar-plugin 46 | 47 | 48 | 49 | test-jar 50 | 51 | 52 | 53 | 54 | 55 | 56 | org.apache.maven.plugins 57 | maven-failsafe-plugin 58 | 59 | 60 | ${test.acs.endpoint.path} 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /collabora-online.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Jeci. 3 | * https://jeci.fr/ 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | */ 18 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 19 | 20 | import { CollaboraOnlineComponent } from './collabora-online.component'; 21 | 22 | describe('CollaboraComponent', () => { 23 | let component: CollaboraOnlineComponent; 24 | let fixture: ComponentFixture; 25 | 26 | beforeEach(async(() => { 27 | TestBed.configureTestingModule({ 28 | declarations: [ CollaboraOnlineComponent ] 29 | }) 30 | .compileComponents(); 31 | })); 32 | 33 | beforeEach(() => { 34 | fixture = TestBed.createComponent(CollaboraOnlineComponent); 35 | component = fixture.componentInstance; 36 | fixture.detectChanges(); 37 | }); 38 | 39 | it('should create', () => { 40 | expect(component).toBeTruthy(); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /collabora-platform-extension-docker/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ${docker.acs.image}:${docker.acs.version} 2 | 3 | ARG TOMCAT_DIR=/usr/local/tomcat 4 | ARG USERNAME=${docker.acs.user} 5 | 6 | USER root 7 | 8 | WORKDIR ${TOMCAT_DIR}/keystore 9 | 10 | COPY keystore/keystore ${TOMCAT_DIR}/keystore/keystore 11 | COPY keystore/ssl.keystore ${TOMCAT_DIR}/keystore/ssl.keystore 12 | COPY keystore/ssl.truststore ${TOMCAT_DIR}/keystore/ssl.truststore 13 | 14 | RUN chown -R ${USERNAME}:${USERNAME} ${TOMCAT_DIR}/keystore 15 | 16 | # Copy Dockerfile to avoid an error if no JARs exist 17 | COPY Dockerfile extensions/*.jar $TOMCAT_DIR/webapps/alfresco/WEB-INF/lib/ 18 | 19 | # Copy Dockerfile to avoid an error if no AMPs exist 20 | COPY Dockerfile extensions/*.amp $TOMCAT_DIR/amps/ 21 | RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install \ 22 | $TOMCAT_DIR/amps $TOMCAT_DIR/webapps/alfresco -directory -nobackup -force 23 | 24 | COPY alfresco-global.properties $TOMCAT_DIR/shared/classes/alfresco-global.properties 25 | COPY dev-log4j.properties $TOMCAT_DIR/shared/classes/alfresco/extension 26 | COPY disable-webscript-caching-context.xml $TOMCAT_DIR/shared/classes/alfresco/extension 27 | 28 | RUN mkdir -p /var/log/alfresco && chown -R ${USERNAME}:${USERNAME} /var/log/alfresco 29 | 30 | USER ${USERNAME} 31 | 32 | COPY alfresco-keystore.jar ${TOMCAT_DIR}/webapps/alfresco/WEB-INF/lib/ 33 | COPY keystore-context.xml ${TOMCAT_DIR}/shared/classes/alfresco/extension/ 34 | 35 | WORKDIR ${TOMCAT_DIR} 36 | -------------------------------------------------------------------------------- /collabora-platform-extension-docker/src/main/docker/alfresco-keystore.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CollaboraOnline/alfresco-collabora-online/96d8b4f07069241b8966d85a47fa9e4a5d29c45f/collabora-platform-extension-docker/src/main/docker/alfresco-keystore.jar -------------------------------------------------------------------------------- /collabora-platform-extension-docker/src/main/docker/hotswap-agent.properties: -------------------------------------------------------------------------------- 1 | # Enable hotswap so that changes in this module will be automatically reloaded 2 | # Watch for changed class files on watchResources path and reload class definition in the running application. 3 | autoHotswap=true 4 | #autoHotswap.port=8000 5 | 6 | # Add a directory prior to application classpath (load classes and resources). 7 | # 8 | # This may be useful for example in multi module maven project to load class changes from upstream project 9 | # classes. Set extraClasspath to upstream project compiler output and .class file will have precedence to 10 | # classes from built JAR file. 11 | # i.e. monitor /target/classes 12 | # should work with extraClasspath=${project.build.outputDirectory} 13 | # If not try 14 | extraClasspath=/usr/local/tomcat/hotswap-agent 15 | 16 | # Comma separated list of disabled plugins 17 | # Use plugin name - e.g. 18 | # Hotswapper, AnonymousClassPatch, WatchResources, Hibernate, Spring, Jersey2, Jetty, Tomcat, 19 | # ZK, Logback, JSF, Seam, ELResolver, OsgiEquinox, Proxy, WebObjects, Weld, JBossModules, Resteasy, Gae 20 | disabledPlugins=Hibernate,Spring 21 | 22 | # Add a directory prior to webapp path (load webapp resources). 23 | # 24 | # Load web application resources (such as HTML, JSP, CSS, ...) from this directory prior to default processing. 25 | # Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp). 26 | extraWebappContext=/usr/local/tomcat/hotswap-agent/alfresco-collabora-online-platform/target/classes/META-INF/resources; 27 | 28 | # Load static web resources from different directory. 29 | # 30 | # This setting is dependent on application server plugin(Jetty, Tomcat, JBoss, ...) 31 | webappDir=/usr/local/tomcat/hotswap-agent/alfresco-collabora-online-platform/target/classes/META-INF/resources; 32 | 33 | # Watch for changes in a directory (resources only). 34 | # 35 | # Similar to extraClasspath this property adds classpath when searching for resources (not classes). 36 | # While extra classpath just modifies the classloader, this setting does nothing until the resource 37 | # is really changed. 38 | # 39 | # Sometimes it is not possible to point extraClasspath to your i.e. src/main/resources, because there are multiple 40 | # replacements of resources in a building step (maven filtering resource option). 41 | # This setting will leave i.e. src/target/classes as default source for resources, but after the resource is modified 42 | # in src/main/resources, the new changed resource is served instead. 43 | # watchResources= 44 | 45 | LOGGER.org.hotswap.agent=DEBUG 46 | #LOGGER.org.hotswap.agent.plugin=TRACE 47 | #LOGGER.org.hotswap.agent.watch=TRACE 48 | #LOGGER.org.hotswap.agent.command=TRACE -------------------------------------------------------------------------------- /collabora-platform-extension-docker/src/main/docker/keystore-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /collabora-platform-extension-docker/src/main/docker/keystore/keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CollaboraOnline/alfresco-collabora-online/96d8b4f07069241b8966d85a47fa9e4a5d29c45f/collabora-platform-extension-docker/src/main/docker/keystore/keystore -------------------------------------------------------------------------------- /collabora-platform-extension-docker/src/main/docker/keystore/ssl.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CollaboraOnline/alfresco-collabora-online/96d8b4f07069241b8966d85a47fa9e4a5d29c45f/collabora-platform-extension-docker/src/main/docker/keystore/ssl.keystore -------------------------------------------------------------------------------- /collabora-platform-extension-docker/src/main/docker/keystore/ssl.truststore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CollaboraOnline/alfresco-collabora-online/96d8b4f07069241b8966d85a47fa9e4a5d29c45f/collabora-platform-extension-docker/src/main/docker/keystore/ssl.truststore -------------------------------------------------------------------------------- /collabora-platform-extension/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | collabora-platform-extension 7 | Collabora Online Alfresco Platform Module 8 | Collabora Online JAR Module for Alfresco Platform/Repo 9 | jar 10 | 11 | 12 | fr.jeci.alfresco 13 | alfresco-collabora-online 14 | 1.2.0 15 | 16 | 17 | 18 | 19 | 20 | org.apache.maven.plugins 21 | maven-assembly-plugin 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/assembly/amp.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 18 | 19 | build-amp-file 20 | 21 | 22 | amp 23 | 24 | 25 | false 26 | 27 | 28 | 29 | 30 | src/main/resources/alfresco/module/${project.artifactId}/module.properties 31 | true 32 | 33 | 34 | 35 | src/main/assembly/file-mapping.properties 36 | false 37 | 38 | 39 | 40 | src/main/resources/alfresco/module/${project.artifactId}/log4j.properties 41 | false 42 | 43 | 44 | 45 | 46 | 47 | 48 | src/main/assembly/web 49 | web 50 | true 51 | 52 | README.md 53 | 54 | 55 | 56 | 57 | 60 | 61 | 62 | lib 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/assembly/file-mapping.properties: -------------------------------------------------------------------------------- 1 | # Custom AMP to WAR location mappings 2 | 3 | # 4 | # The following property can be used to include the standard set of mappings. 5 | # The contents of this file will override any defaults. The default is 6 | # 'true', i.e. the default mappings will be augmented or modified by values in 7 | # this file. 8 | # 9 | # Default mappings are: 10 | # 11 | # /config=/WEB-INF/classes 12 | # /lib=/WEB-INF/lib 13 | # /licenses=/WEB-INF/licenses 14 | # /web/jsp=/jsp 15 | # /web/css=/css 16 | # /web/images=/images 17 | # /web/scripts=/scripts 18 | # /web/php=/php 19 | # 20 | include.default=true 21 | 22 | # 23 | # Custom mappings. If 'include.default' is false, then this is the complete set. 24 | # Map /web to / in AMP so we can override things like favicon.ico 25 | # 26 | /web=/ 27 | 28 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/assembly/web/README.md: -------------------------------------------------------------------------------- 1 | # Web resources that should override out-of-the-box files 2 | 3 | Put here any web resources that should override out-of-the-box 4 | web resources, such as favicon.ico. They will then end up in the 5 | */web* directory in the AMP, and applied to the WAR, and override 6 | any existing web resources in the Alfresco.WAR. 7 | 8 | **Note**. Module dependency needs to be set to amp for the web resources to be applied by MMT: 9 | 10 | ` 11 | 12 | ${project.groupId} 13 | some-platform 14 | ${project.version} 15 | amp 16 | 17 | ` 18 | 19 | **Important**. New web resources should not be located here, but instead 20 | in the usual place in the *src/main/resources/META-INF/resources* directory. 21 | 22 | 23 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/java/fr/jeci/collabora/alfresco/CollaboraOnlineModel.java: -------------------------------------------------------------------------------- 1 | package fr.jeci.collabora.alfresco; 2 | 3 | import org.alfresco.service.namespace.QName; 4 | 5 | /** 6 | * Content Model Constants 7 | * 8 | * @author jlesage 9 | * @Deprecated We use LockService now 10 | */ 11 | public interface CollaboraOnlineModel { 12 | 13 | /** Content Model URI */ 14 | String COLLABORA_MODEL_1_0_URI = "http://www.collaboraoffice.com/model/online/1.0"; 15 | 16 | /** Content Model Prefix */ 17 | String COLLABORA_MODEL_PREFIX = "collabora"; 18 | 19 | /** @Deprecated Adding Aspect change node, that is not what we want */ 20 | QName ASPECT_COLLABORA_ONLINE = QName.createQName(COLLABORA_MODEL_1_0_URI, "collaboraOnline"); 21 | 22 | QName PROP_AUTOSAVE = QName.createQName(COLLABORA_MODEL_1_0_URI, "autosave"); 23 | 24 | /** @Deprecated Use LockService */ 25 | QName PROP_LOCK_ID = QName.createQName(COLLABORA_MODEL_1_0_URI, "lockId"); 26 | /** @Deprecated Use LockService */ 27 | QName PROP_LOCK_EXPIRATION = QName.createQName(COLLABORA_MODEL_1_0_URI, "lockExpiration"); 28 | 29 | } -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/java/fr/jeci/collabora/alfresco/ConflictException.java: -------------------------------------------------------------------------------- 1 | package fr.jeci.collabora.alfresco; 2 | 3 | /** 4 | * Specific exception use to implement wopi "409" error. Mainly for Lock 5 | * problem. 6 | *

7 | * ... 8 | * 9 | * @author jlesage 10 | * 11 | */ 12 | public class ConflictException extends Exception { 13 | private static final long serialVersionUID = -5116720784148049930L; 14 | 15 | private final String currentLockId; 16 | 17 | private final String lockFailureReason; 18 | 19 | /** 20 | * 21 | * @param currentLockId A string value identifying the current lock on the 22 | * file; 23 | * @param lockFailureReason An string value indicating the cause of a lock 24 | * failure. 25 | */ 26 | public ConflictException(String currentLockId, String lockFailureReason) { 27 | this.currentLockId = currentLockId; 28 | this.lockFailureReason = lockFailureReason; 29 | } 30 | 31 | public String getCurrentLockId() { 32 | return currentLockId; 33 | } 34 | 35 | public String getLockFailureReason() { 36 | return lockFailureReason; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/java/fr/jeci/collabora/alfresco/GetTokenWebScript.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | package fr.jeci.collabora.alfresco; 18 | 19 | import org.alfresco.service.cmr.repository.NodeRef; 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | import org.springframework.extensions.webscripts.*; 23 | 24 | import java.io.IOException; 25 | import java.util.HashMap; 26 | import java.util.Map; 27 | 28 | public class GetTokenWebScript extends DeclarativeWebScript { 29 | private static final Logger logger = LoggerFactory.getLogger(GetTokenWebScript.class); 30 | 31 | private static final String WOPI_SRC_URL = "wopi_src_url"; 32 | private static final String ACCESS_TOKEN_TTL = "access_token_ttl"; 33 | private static final String ACCESS_TOKEN = "access_token"; 34 | private static final String PARAM_ACTION = "action"; 35 | private static final String PARAM_NODE_REF = "nodeRef"; 36 | 37 | protected CollaboraOnlineService collaboraOnlineService; 38 | 39 | @Override 40 | protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) { 41 | final Map model = new HashMap<>(); 42 | final String nodeRefStr = req.getParameter(PARAM_NODE_REF); 43 | if (nodeRefStr == null) { 44 | throw new WebScriptException("No 'nodeRef' parameter supplied"); 45 | } 46 | 47 | final NodeRef nodeRef = new NodeRef(nodeRefStr); 48 | final String action = req.getParameter(PARAM_ACTION); 49 | if (action == null) { 50 | throw new WebScriptException("No 'action' parameter supplied"); 51 | } 52 | 53 | final WOPIAccessTokenInfo tokenInfo = this.collaboraOnlineService.createAccessToken(nodeRef); 54 | model.put(ACCESS_TOKEN, tokenInfo.getAccessToken()); 55 | model.put(ACCESS_TOKEN_TTL, tokenInfo.getExpiresAt().toDate().getTime()); 56 | 57 | try { 58 | String wopiSrcUrl = this.collaboraOnlineService.getWopiSrcURL(nodeRef, action); 59 | logger.debug("Get Token {} for wopiSrcUrl {}", action, wopiSrcUrl); 60 | model.put(WOPI_SRC_URL, wopiSrcUrl); 61 | } catch (IOException e) { 62 | status.setCode(Status.STATUS_INTERNAL_SERVER_ERROR, "Failed to get wopiSrcURL"); 63 | } 64 | return model; 65 | } 66 | 67 | public void setCollaboraOnlineService(CollaboraOnlineService collaboraOnlineService) { 68 | this.collaboraOnlineService = collaboraOnlineService; 69 | } 70 | 71 | } -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/java/fr/jeci/collabora/alfresco/ServiceUrlInfoWebScript.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | package fr.jeci.collabora.alfresco; 18 | 19 | import java.net.MalformedURLException; 20 | import java.net.URL; 21 | import java.util.HashMap; 22 | import java.util.Map; 23 | 24 | import org.springframework.extensions.webscripts.Cache; 25 | import org.springframework.extensions.webscripts.DeclarativeWebScript; 26 | import org.springframework.extensions.webscripts.Status; 27 | import org.springframework.extensions.webscripts.WebScriptException; 28 | import org.springframework.extensions.webscripts.WebScriptRequest; 29 | 30 | /** 31 | * Don't think this is usefull 32 | */ 33 | public class ServiceUrlInfoWebScript extends DeclarativeWebScript { 34 | private static final String LOOL_HOST_URL = "lool_host_url"; 35 | private static final String ALFRESCO_SERVICE = "service/"; 36 | 37 | protected CollaboraOnlineService collaboraOnlineService; 38 | 39 | @Override 40 | protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) { 41 | URL alfrescoPrivateURL = this.collaboraOnlineService.getAlfrescoPrivateURL(); 42 | URL colServiceUrl; 43 | try { 44 | colServiceUrl = new URL(alfrescoPrivateURL, ALFRESCO_SERVICE); 45 | } catch (MalformedURLException e) { 46 | throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, 47 | "Invalid Wopi Server URL :" + alfrescoPrivateURL); 48 | } 49 | 50 | Map model = new HashMap<>(1); 51 | model.put(LOOL_HOST_URL, colServiceUrl.toString()); 52 | return model; 53 | } 54 | 55 | public void setCollaboraOnlineService(CollaboraOnlineService collaboraOnlineService) { 56 | this.collaboraOnlineService = collaboraOnlineService; 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/java/fr/jeci/collabora/alfresco/WebscriptHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | package fr.jeci.collabora.alfresco; 18 | 19 | import java.util.Map; 20 | 21 | import org.apache.commons.lang3.StringUtils; 22 | import org.springframework.extensions.webscripts.Status; 23 | import org.springframework.extensions.webscripts.WebScriptException; 24 | import org.springframework.extensions.webscripts.WebScriptRequest; 25 | 26 | public class WebscriptHelper { 27 | private WebscriptHelper() { 28 | // No Constructor 29 | } 30 | 31 | /** 32 | * Get Mandatory parameters from Map 33 | */ 34 | public static String getParam(Map templateArgs, String header) throws WebScriptException { 35 | String value = templateArgs.get(header); 36 | assertParam(header, value); 37 | return value; 38 | } 39 | 40 | /** 41 | * Assert param is not null or empty 42 | * 43 | * @param header Need only for log 44 | * @param param value tested 45 | */ 46 | public static void assertParam(String header, String param) throws WebScriptException { 47 | if (StringUtils.isBlank(param)) { 48 | throw new WebScriptException(Status.STATUS_BAD_REQUEST, "No '" + header + "' parameter supplied"); 49 | } 50 | } 51 | 52 | /** 53 | * Get parameter as Integer (Not Mandatory) 54 | * 55 | * @return integer or null 56 | */ 57 | public static Integer integerValue(Map templateArgs, String header) throws WebScriptException { 58 | return integerValue(templateArgs.get(header), header); 59 | } 60 | 61 | /** 62 | * Get parameter as Integer (Not Mandatory) 63 | */ 64 | public static Integer integerValue(WebScriptRequest req, String header) throws WebScriptException { 65 | return integerValue(req.getParameter(header), header); 66 | } 67 | 68 | /** 69 | * Get parameter as Integer (Not Mandatory) 70 | * 71 | * @param header Need only for log 72 | */ 73 | public static Integer integerValue(String strVal, String header) throws WebScriptException { 74 | if (strVal == null) { 75 | return null; 76 | } 77 | try { 78 | return Integer.parseInt(strVal); 79 | } catch (NumberFormatException e) { 80 | throw new WebScriptException(Status.STATUS_BAD_REQUEST, 81 | "Parameter '" + header + "' is not a number = " + strVal); 82 | } 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/java/fr/jeci/collabora/alfresco/job/CleanLockJob.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | package fr.jeci.collabora.alfresco.job; 18 | 19 | import org.alfresco.error.AlfrescoRuntimeException; 20 | import org.alfresco.repo.security.authentication.AuthenticationUtil; 21 | import org.alfresco.schedule.AbstractScheduledLockedJob; 22 | import org.quartz.JobDataMap; 23 | import org.quartz.JobExecutionContext; 24 | import org.quartz.JobExecutionException; 25 | import org.quartz.StatefulJob; 26 | 27 | /** 28 | * @author Cindy Piassale 29 | * 30 | */ 31 | public class CleanLockJob extends AbstractScheduledLockedJob implements StatefulJob { 32 | 33 | @Override 34 | public void executeJob(JobExecutionContext context) throws JobExecutionException { 35 | JobDataMap jobData = context.getJobDetail().getJobDataMap(); 36 | 37 | // Extract the Job executer to use 38 | Object executerObj = jobData.get("jobExecuter"); 39 | if (!(executerObj instanceof CleanLockJobExecuter)) { 40 | throw new AlfrescoRuntimeException( 41 | "CleanLockJob data must contain valid 'Executer' reference"); 42 | } 43 | 44 | final CleanLockJobExecuter cleanLockjobExecuter = (CleanLockJobExecuter) executerObj; 45 | 46 | AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() { 47 | public Object doWork() throws Exception { 48 | cleanLockjobExecuter.execute(); 49 | return null; 50 | } 51 | }, AuthenticationUtil.getSystemUserName()); 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/java/fr/jeci/collabora/wopi/WopiGetFileWebScript.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | package fr.jeci.collabora.wopi; 18 | 19 | import org.alfresco.model.ContentModel; 20 | import org.alfresco.service.cmr.repository.ContentData; 21 | import org.alfresco.service.cmr.repository.ContentReader; 22 | import org.alfresco.service.cmr.repository.NodeRef; 23 | import org.apache.commons.io.IOUtils; 24 | import org.slf4j.Logger; 25 | import org.slf4j.LoggerFactory; 26 | import org.springframework.extensions.webscripts.Status; 27 | import org.springframework.extensions.webscripts.WebScriptException; 28 | import org.springframework.extensions.webscripts.WebScriptRequest; 29 | import org.springframework.extensions.webscripts.WebScriptResponse; 30 | 31 | import java.io.IOException; 32 | import java.io.InputStream; 33 | 34 | public class WopiGetFileWebScript extends AbstractWopiWebScript { 35 | private static final Logger logger = LoggerFactory.getLogger(WopiGetFileWebScript.class); 36 | 37 | /** 38 | * The default buffer size 4k 39 | */ 40 | private static final int DEFAULT_BUFFER_SIZE = 1024 * 4; 41 | 42 | @Override 43 | public void executeAsUser(final WebScriptRequest req, final WebScriptResponse res, final NodeRef nodeRef) { 44 | final ContentData contentProp = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); 45 | res.setContentType(contentProp.getMimetype()); 46 | res.setContentEncoding(contentProp.getEncoding()); 47 | 48 | final ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); 49 | 50 | if (reader == null) { 51 | logger.error("No content reader for node={}", nodeRef); 52 | throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, "No content reader for node=" + nodeRef); 53 | } 54 | 55 | try (InputStream inputStream = reader.getContentInputStream();) { 56 | // We don't want to close the outputStream, this is done by Tomcat 57 | long copied = IOUtils.copyLarge(inputStream, res.getOutputStream(), new byte[DEFAULT_BUFFER_SIZE]); 58 | 59 | logger.debug("Stream copied {} bytes", copied); 60 | } catch (IOException e) { 61 | throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, "Failed to copy content stream", e); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/java/fr/jeci/collabora/wopi/WopiHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | package fr.jeci.collabora.wopi; 18 | 19 | public interface WopiHeader { 20 | String X_LOOL_WOPI_IS_AUTOSAVE = "X-LOOL-WOPI-IsAutosave"; 21 | String X_LOOL_WOPI_TIMESTAMP = "X-LOOL-WOPI-Timestamp"; 22 | String X_WOPI_OVERRIDE = "X-WOPI-Override"; 23 | String X_WOPI_LOCK = "X-WOPI-Lock"; 24 | String X_WOPI_OLD_LOCK = "X-WOPI-OldLock"; 25 | String X_WOPI_LOCK_FAILURE_REASON = "X-WOPI-LockFailureReason"; 26 | String X_WOPI_ITEM_VERSION = "X-WOPI-ItemVersion"; 27 | 28 | String X_PRISTY_ADD_PROPERTY = "X-PRISTY-ADD-PROPERTY"; 29 | String X_PRISTY_DEL_PROPERTY = "X-PRISTY-DEL-PROPERTY"; 30 | String X_PRISTY_DEL_ASPECT = "X-PRISTY-DEL-ASPECT"; 31 | String X_PRISTY_ADD_ASPECT = "X-PRISTY-ADD-ASPECT"; 32 | } 33 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/java/fr/jeci/collabora/wopi/WopiOverride.java: -------------------------------------------------------------------------------- 1 | package fr.jeci.collabora.wopi; 2 | 3 | public enum WopiOverride { 4 | // Put with no Lock 5 | PUT, 6 | // Save As 7 | PUT_RELATIVE, 8 | // Ask for Lock 9 | LOCK, 10 | // Query Lock Key 11 | GET_LOCK, 12 | // Refresh Lock 13 | REFRESH_LOCK, 14 | // Remove Lock 15 | UNLOCK 16 | 17 | } 18 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/aspect-collabora-online/aspect-collabora-online-add.post.desc.xml: -------------------------------------------------------------------------------- 1 | 2 | Collabora Online Add Aspect 3 | Collabora Online - add collabora:collaboraOnline aspect 4 | /collabora/aspect/add/{store_type}/{store_id}/{id} 5 | Collabora Online 6 | user 7 | required 8 | 9 | 10 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/aspect-collabora-online/aspect-collabora-online-add.post.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | function editNode(result, node) { 4 | result.action = "addAspect"; 5 | 6 | if (!node.hasAspect(ASPECT_COLLABORA)) { 7 | node.addAspect(ASPECT_COLLABORA); 8 | } 9 | } 10 | 11 | main(); 12 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/aspect-collabora-online/aspect-collabora-online-add.post.json.ftl: -------------------------------------------------------------------------------- 1 | <#import "aspect-collabora-online.lib.ftl" as actionLib /> 2 | <@actionLib.resultsJSON result=result /> -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/aspect-collabora-online/aspect-collabora-online-rem.post.desc.xml: -------------------------------------------------------------------------------- 1 | 2 | Collabora Online Add Aspect 3 | Collabora Online - add collabora:collaboraOnline aspect 4 | /collabora/aspect/rem/{store_type}/{store_id}/{id} 5 | Collabora Online 6 | user 7 | required 8 | 9 | 10 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/aspect-collabora-online/aspect-collabora-online-rem.post.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | function editNode(result, node) { 4 | result.action = "remAspect"; 5 | 6 | if (node.hasAspect(ASPECT_COLLABORA)) { 7 | node.removeAspect(ASPECT_COLLABORA); 8 | } 9 | } 10 | 11 | main(); 12 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/aspect-collabora-online/aspect-collabora-online-rem.post.json.ftl: -------------------------------------------------------------------------------- 1 | <#import "aspect-collabora-online.lib.ftl" as actionLib /> 2 | <@actionLib.resultsJSON result=result /> -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/aspect-collabora-online/aspect-collabora-online.lib.ftl: -------------------------------------------------------------------------------- 1 | <#macro resultsJSON result> 2 | <#escape x as jsonUtils.encodeJSONString(x)> 3 | { 4 | <#list result?keys as key> 5 | <#assign value = result[key]> 6 | <#if value?is_number || value?is_boolean> 7 | "${key}": ${value?string}<#if key_has_next>, 8 | <#else> 9 | "${key}": "${value}"<#if key_has_next>, 10 | 11 | 12 | } 13 | 14 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/aspect-collabora-online/aspect-collabora-online.lib.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | var ASPECT_COLLABORA = "collabora:collaboraOnline"; 4 | 5 | /** 6 | * Main script entry point 7 | * 8 | * @method main 9 | */ 10 | function main() { 11 | // Params object contains commonly-used arguments 12 | var params = {}, files, rootNode, result; 13 | 14 | logger.log("StoreType=" + url.templateArgs.store_type); 15 | 16 | if (url.templateArgs.store_type != undefined) { 17 | params = getNodeRefInputParams(); 18 | } else { 19 | status.setCode(status.STATUS_BAD_REQUEST, params); 20 | return; 21 | } 22 | 23 | logger.log("Params="+params); 24 | if (typeof params == "string") { 25 | status.setCode(status.STATUS_BAD_REQUEST, params); 26 | return; 27 | } 28 | 29 | try { 30 | var node = params.rootNode; 31 | 32 | result = { 33 | nodeRef : node.nodeRef.toString(), 34 | action : "_action_", 35 | success : false 36 | } 37 | 38 | result.id = node.name; 39 | 40 | policies.disableForNode(node); 41 | 42 | editNode(result, node); 43 | 44 | node.save(); 45 | node.reset(); 46 | policies.enableForNode(node); 47 | 48 | result.success = true; 49 | 50 | } catch (e) { 51 | e.code = status.STATUS_INTERNAL_SERVER_ERROR; 52 | e.message = e.toString(); 53 | throw e; 54 | } 55 | 56 | model.result = result; 57 | } 58 | 59 | /** 60 | * Get and check existence of mandatory input parameters (nodeRef-based) 61 | * 62 | * @method getNodeRefInputParams 63 | * @return {object|string} object literal containing parameters value or string 64 | * error 65 | */ 66 | function getNodeRefInputParams() { 67 | var params = {}, error = null; 68 | logger.log("getNodeRefInputParams"); 69 | try { 70 | // First try to get the parameters from the URI 71 | var storeType = url.templateArgs.store_type, 72 | storeId = url.templateArgs.store_id, 73 | id = url.templateArgs.id; 74 | 75 | var nodeRef = storeType + "://" + storeId + (id == null ? "" : ("/" + id)), 76 | rootNode = ParseArgs.resolveNode(nodeRef); 77 | 78 | if (rootNode === null) { 79 | return "'" + nodeRef + "' is not a valid nodeRef."; 80 | } 81 | 82 | var rootNodeRef = String(rootNode.nodeRef); 83 | if (rootNodeRef != nodeRef) { 84 | nodeRef = rootNodeRef; 85 | } 86 | 87 | // Populate the return object 88 | params = { 89 | nodeRef : nodeRef, 90 | rootNode : rootNode 91 | }; 92 | } catch (e) { 93 | error = e.toString(); 94 | } 95 | 96 | // Return the params object, or the error string if it was set 97 | return (error !== null ? error : params); 98 | } 99 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/aspect-collabora-online/clean-auto-version.post.desc.xml: -------------------------------------------------------------------------------- 1 | 2 | Collabora Online Clean Auto Version 3 | Collabora Online - clean version create by autosave 4 | /collabora/version/clean/{store_type}/{store_id}/{id} 5 | Collabora Online 6 | admin 7 | required 8 | 9 | 10 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/aspect-collabora-online/clean-auto-version.post.json.ftl: -------------------------------------------------------------------------------- 1 | { 2 | "success" : "${success}", 3 | } -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/service-url.get.desc.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | LibreOffice Online Get Host Url 19 | Get the host url for the WOPI server that the libreOffice online service needs to contact 20 | /lool/host/url 21 | Collabora Online 22 | none 23 | 24 | required 25 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/service-url.get.json.ftl: -------------------------------------------------------------------------------- 1 | { 2 | "lool_host_url": "${lool_host_url?js_string}" 3 | } -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/token.get.desc.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | Collabora Online Get Token 19 | Get a token and the WOPI src URL for the given nodeRef. 20 | https://wopi.readthedocs.io/projects/wopirest/en/latest/concepts.html#term-access-token 21 | https://wopi.readthedocs.io/en/latest/discovery.html#wopi-actions 22 | 23 | /lool/token?nodeRef={nodeRef}&action={action} 24 | Collabora Online 25 | user 26 | 27 | required 28 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/token.get.json.ftl: -------------------------------------------------------------------------------- 1 | { 2 | "access_token": "${access_token?js_string}", 3 | "access_token_ttl": "${access_token_ttl?c}", 4 | "wopi_src_url": "${wopi_src_url?js_string}" 5 | } -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/wopi/CheckFileInfo.get.desc.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | Wopi CheckFileInfo 19 | See https://wopi.readthedocs.io/projects/wopirest/en/latest/files/CheckFileInfo.html 20 | /wopi/files/{file_id} 21 | WOPI 22 | none 23 | 24 | required 25 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/wopi/GetFile.get.desc.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | Wopi GetFile 19 | See https://wopi.readthedocs.io/projects/wopirest/en/latest/files/GetFile.html 20 | /wopi/files/{file_id}/contents 21 | WOPI 22 | none 23 | 24 | required 25 | 26 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/wopi/PutFile.post.desc.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | Wopi PutFile 19 | See https://wopi.readthedocs.io/projects/wopirest/en/latest/files/PutFile.html 20 | /wopi/files/{file_id}/contents 21 | WOPI 22 | none 23 | 24 | required 25 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/fr/jeci/collabora/wopi/PutRelativeFile.post.desc.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | Wopi PutRelativeFile 19 | See https://wopi.readthedocs.io/projects/wopirest/en/latest/files/PutRelativeFile.html 20 | /wopi/files/{file_id} 21 | WOPI 22 | none 23 | 24 | required 25 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/extension/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.post.json.js: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | /** 18 | * Document List Component: Create New Node - create copy of node template in the Data Dictionary 19 | */ 20 | function main() { 21 | // get the arguments - expecting the "sourceNodeRef" and "parentNodeRef" of the source node to copy 22 | // and the parent node to contain the new copy of the source. 23 | var sourceNodeRef = json.get("sourceNodeRef"); 24 | if (sourceNodeRef == null || sourceNodeRef.length === 0) { 25 | status.setCode(status.STATUS_BAD_REQUEST, "Mandatory 'sourceNodeRef' parameter missing."); 26 | return; 27 | } 28 | var parentNodeRef = json.get("parentNodeRef"); 29 | if (parentNodeRef == null || parentNodeRef.length === 0) { 30 | status.setCode(status.STATUS_BAD_REQUEST, "Mandatory 'parentNodeRef' parameter missing."); 31 | return; 32 | } 33 | 34 | // get the nodes and perform the copy - permission failures etc. will produce a status code response 35 | var sourceNode = search.findNode(sourceNodeRef), 36 | parentNode = search.findNode(parentNodeRef); 37 | if (sourceNode == null || parentNode == null) { 38 | status.setCode(status.STATUS_NOT_FOUND, "Source or destination node is missing for copy operation."); 39 | } 40 | 41 | var docCopy = sourceNode.copy(parentNode); 42 | try { 43 | //Change the author of the 44 | docCopy.properties["cm:author"] = person.properties["cm:firstName"] + " " + person.properties["cm:lastName"]; 45 | docCopy.save(); 46 | 47 | model.result = docCopy; 48 | } 49 | catch(err){ 50 | logger.error("\n\n--------- Error ---------\n There was an error copying the document:\n"+ err); 51 | } 52 | } 53 | 54 | main(); -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/module/collabora-platform-extension/alfresco-global.properties: -------------------------------------------------------------------------------- 1 | ## This Alfresco Platform Configuration file should be used for custom properties that are introduced by this module. 2 | ## Define default values for all properties here. 3 | ## System Administrators can override these values in environment specific configurations in 4 | ## alfresco/tomcat/shared/classes/alfresco-global.properties. 5 | ## 6 | 7 | # Collabora Online 8 | # Public fqdn use by the browser 9 | collabora.public.url=http://localhost:9980/ 10 | 11 | # If Collabora Online is on the same host or network, define the internal url of the server. 12 | collabora.private.url=${collabora.public.url} 13 | 14 | # Default: 15 | alfresco.public.url=${alfresco.protocol}://${alfresco.host}:${alfresco.port}/${alfresco.context} 16 | 17 | # If Collabora Online is on the same host or network, define the internal url 18 | # use by collabora online to fetch document on alfresco 19 | alfresco.private.url=${alfresco.public.url} 20 | 21 | fr.jeci.collabora.renditions=imgpreview,medium,doclib,pdf 22 | 23 | # TTL token in ms (24h = 86400000) 24 | lool.wopi.token.ttl=86400000 25 | 26 | lool.cache.fileIdAccessTokenMapSharedCache.tx.maxItems=5000 27 | lool.cache.fileIdAccessTokenMapSharedCache.tx.statsEnabled=${caches.tx.statsEnabled} 28 | lool.cache.fileIdAccessTokenMapSharedCache.maxItems=5000 29 | # can match lool.wopi.token.ttl (24h = 86400) 30 | lool.cache.fileIdAccessTokenMapSharedCache.timeToLiveSeconds=86400 31 | lool.cache.fileIdAccessTokenMapSharedCache.maxIdleSeconds=0 32 | lool.cache.fileIdAccessTokenMapSharedCache.cluster.type=fully-distributed 33 | lool.cache.fileIdAccessTokenMapSharedCache.backup-count=1 34 | lool.cache.fileIdAccessTokenMapSharedCache.eviction-policy=LRU 35 | lool.cache.fileIdAccessTokenMapSharedCache.eviction-percentage=25 36 | lool.cache.fileIdAccessTokenMapSharedCache.merge-policy=hz.ADD_NEW_ENTRY 37 | lool.cache.fileIdAccessTokenMapSharedCache.readBackupData=false 38 | 39 | # Clean Lock 40 | job.fr.jeci.collabora.cleanLock.cron=0 0/5 * * * ? 41 | job.fr.jeci.collabora.cleanLock.cronstartdelay=240000 42 | job.fr.jeci.collabora.cleanLock.enabled=true 43 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/module/collabora-platform-extension/context/bootstrap-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | alfresco/module/${project.artifactId}/model/collabora-online-model.xml 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/module/collabora-platform-extension/context/job-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 35 | 36 | fr.jeci.collabora.alfresco.job.CleanLockJob 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 47 | 48 | 49 | 50 | 51 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/module/collabora-platform-extension/log4j.properties: -------------------------------------------------------------------------------- 1 | # Add here module-specific custom log4j.properties configuration 2 | 3 | log4j.logger.fr.jeci.collabora=WARN 4 | log4j.logger.fr.jeci.collabora.alfresco.job=ERROR -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/module/collabora-platform-extension/module-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /collabora-platform-extension/src/main/resources/alfresco/module/collabora-platform-extension/module.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | 17 | 18 | # SDK Sample module 19 | 20 | # ==== Beginning of Alfresco required/optional properties ====== # 21 | # NB: These properties are filtered at build time by Maven, single 22 | # sourcing from POM properties 23 | module.id=${project.artifactId} 24 | #module.aliases=myModule-123, my-module 25 | module.title=${project.name} 26 | module.description=${project.description} 27 | module.version=${project.version} 28 | 29 | # The following optional properties can be used to prevent the module from being added 30 | # to inappropriate versions of the WAR file. 31 | # module.repo.version.min=2.0 32 | # module.repo.version.max=2.1 33 | 34 | # FIXME: This dependencies should come out of mvn dependencies on amp 35 | 36 | # The following describe dependencies on other modules 37 | # Depends on net.sf.myproject.module.SupportModuleA version ${version} or later 38 | # module.depends.net.sf.myproject.module.SupportModuleA=${version}-* 39 | # Depends on net.sf.myproject.module.SupportModuleA version ${version} to 2.0 40 | # module.depends.net.sf.myproject.module.SupportModuleB=${version}-2.0 41 | # Depends on net.sf.myproject.module.SupportModuleC - any version 42 | # module.depends.net.sf.myproject.module.SupportModuleB=* 43 | 44 | 45 | # ==== End of Alfresco required/optional properties ======= # 46 | 47 | 48 | # ==== Beginning of module required properties/optional ====== # -------------------------------------------------------------------------------- /collabora-platform-extension/src/test/java/fr/jeci/collabora/alfresco/WopiDiscoveryTest.java: -------------------------------------------------------------------------------- 1 | package fr.jeci.collabora.alfresco; 2 | 3 | import fr.jeci.collabora.alfresco.WopiDiscovery.DiscoveryAction; 4 | import org.junit.Before; 5 | import org.junit.Test; 6 | 7 | import javax.xml.stream.XMLStreamException; 8 | import java.io.File; 9 | import java.io.FileInputStream; 10 | import java.io.IOException; 11 | import java.util.List; 12 | 13 | import static org.junit.Assert.assertEquals; 14 | import static org.junit.Assert.assertFalse; 15 | 16 | public class WopiDiscoveryTest { 17 | WopiDiscovery wopiDiscovery = null; 18 | 19 | @Before 20 | public void setUp() throws Exception { 21 | wopiDiscovery = new WopiDiscovery(); 22 | } 23 | 24 | @Test 25 | public void testLoadDiscoveryXML() throws XMLStreamException, IOException { 26 | File discoveryFile = new File("src/test/resources/discovery_collabora_online.xml"); 27 | FileInputStream in = new FileInputStream(discoveryFile); 28 | wopiDiscovery.loadDiscoveryXML(in); 29 | assertFalse(wopiDiscovery.getActions().isEmpty()); 30 | } 31 | 32 | @Test 33 | public void testGetSrcURL() throws XMLStreamException, IOException { 34 | File discoveryFile = new File("src/test/resources/discovery_collabora_online.xml"); 35 | FileInputStream in = new FileInputStream(discoveryFile); 36 | wopiDiscovery.loadDiscoveryXML(in); 37 | 38 | String urlsrc = wopiDiscovery.getSrcURL("application/vnd.ms-excel", "edit"); 39 | 40 | assertEquals("http://localhost:9980/loleaflet/1430151/loleaflet.html?", urlsrc); 41 | 42 | urlsrc = wopiDiscovery.getSrcURL("application/pdf", "view_comment"); 43 | assertEquals("http://localhost:9980/loleaflet/1430151/loleaflet.html?", urlsrc); 44 | } 45 | 46 | @Test 47 | public void testGetAction() throws XMLStreamException, IOException { 48 | File discoveryFile = new File("src/test/resources/discovery_collabora_online.xml"); 49 | FileInputStream in = new FileInputStream(discoveryFile); 50 | wopiDiscovery.loadDiscoveryXML(in); 51 | 52 | List action = wopiDiscovery.getAction("ods"); 53 | assertFalse(action.isEmpty()); 54 | assertEquals("http://localhost:9980/loleaflet/1430151/loleaflet.html?", action.get(0).getUrlsrc()); 55 | assertEquals("edit", action.get(0).getName()); 56 | assertEquals("ods", action.get(0).getExt()); 57 | 58 | action = wopiDiscovery.getAction("PDF"); 59 | assertFalse(action.isEmpty()); 60 | assertEquals("http://localhost:9980/loleaflet/1430151/loleaflet.html?", action.get(0).getUrlsrc()); 61 | assertEquals("view_comment", action.get(0).getName()); 62 | assertEquals("pdf", action.get(0).getExt()); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /collabora-share-extension-docker/src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ${docker.share.image}:${docker.share.version} 2 | 3 | ARG TOMCAT_DIR=/usr/local/tomcat 4 | 5 | COPY context.xml $TOMCAT_DIR/conf 6 | 7 | # Copy Dockerfile to avoid an error if no JARs exist 8 | COPY Dockerfile extensions/*.jar $TOMCAT_DIR/webapps/share/WEB-INF/lib/ 9 | 10 | # Copy Dockerfile to avoid an error if no AMPs exist 11 | COPY Dockerfile extensions/*.amp $TOMCAT_DIR/amps_share/ 12 | RUN java -jar $TOMCAT_DIR/alfresco-mmt/alfresco-mmt*.jar install \ 13 | $TOMCAT_DIR/amps_share $TOMCAT_DIR/webapps/share -directory -nobackup -force 14 | 15 | COPY log4j.properties $TOMCAT_DIR/webapps/share/WEB-INF/classes 16 | COPY hotswap-agent.properties $TOMCAT_DIR/webapps/share/WEB-INF/classes 17 | 18 | # Fix https://github.com/Alfresco/acs-community-packaging/issues/367 19 | RUN sed -i '// s/true/false/' ${TOMCAT_DIR}/shared/classes/alfresco/web-extension/share-config-custom.xml 20 | -------------------------------------------------------------------------------- /collabora-share-extension-docker/src/main/docker/context.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | WEB-INF/web.xml 24 | WEB-INF/tomcat-web.xml 25 | ${catalina.base}/conf/web.xml 26 | 27 | 28 | 31 | -------------------------------------------------------------------------------- /collabora-share-extension-docker/src/main/docker/hotswap-agent.properties: -------------------------------------------------------------------------------- 1 | # Enable hotswap so that changes in this module will be automatically reloaded 2 | # Watch for changed class files on watchResources path and reload class definition in the running application. 3 | autoHotswap=true 4 | #autoHotswap.port=8000 5 | 6 | # Add a directory prior to application classpath (load classes and resources). 7 | # 8 | # This may be useful for example in multi module maven project to load class changes from upstream project 9 | # classes. Set extraClasspath to upstream project compiler output and .class file will have precedence to 10 | # classes from built JAR file. 11 | # i.e. monitor /target/classes 12 | # should work with extraClasspath=${project.build.outputDirectory} 13 | # If not try 14 | extraClasspath=/usr/local/tomcat/hotswap-agent 15 | 16 | 17 | # Comma separated list of disabled plugins 18 | # Use plugin name - e.g. 19 | # Hotswapper, AnonymousClassPatch, WatchResources, Hibernate, Spring, Jersey2, Jetty, Tomcat, 20 | # ZK, Logback, JSF, Seam, ELResolver, OsgiEquinox, Proxy, WebObjects, Weld, JBossModules, Resteasy, Gae 21 | disabledPlugins=Hibernate,Spring 22 | 23 | # Add a directory prior to webapp path (load webapp resources). 24 | # 25 | # Load web application resources (such as HTML, JSP, CSS, ...) from this directory prior to default processing. 26 | # Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp). 27 | extraWebappContext=/usr/local/tomcat/hotswap-agent/alfresco-collabora-online-share/target/classes/META-INF/resources; 28 | 29 | # Load static web resources from different directory. 30 | # 31 | # This setting is dependent on application server plugin(Jetty, Tomcat, JBoss, ...) 32 | webappDir=/usr/local/tomcat/hotswap-agent/alfresco-collabora-online-share/target/classes/META-INF/resources; 33 | 34 | # Watch for changes in a directory (resources only). 35 | # 36 | # Similar to extraClasspath this property adds classpath when searching for resources (not classes). 37 | # While extra classpath just modifies the classloader, this setting does nothing until the resource 38 | # is really changed. 39 | # 40 | # Sometimes it is not possible to point extraClasspath to your i.e. src/main/resources, because there are multiple 41 | # replacements of resources in a building step (maven filtering resource option). 42 | # This setting will leave i.e. src/target/classes as default source for resources, but after the resource is modified 43 | # in src/main/resources, the new changed resource is served instead. 44 | # watchResources= 45 | 46 | LOGGER.org.hotswap.agent=DEBUG 47 | #LOGGER.org.hotswap.agent.plugin=TRACE 48 | #LOGGER.org.hotswap.agent.watch=TRACE 49 | #LOGGER.org.hotswap.agent.command=TRACE -------------------------------------------------------------------------------- /collabora-share-extension-docker/src/main/docker/log4j.properties: -------------------------------------------------------------------------------- 1 | # Set root logger level to error 2 | log4j.rootLogger=error, Console 3 | 4 | # Console appender definition # 5 | 6 | # All outputs currently set to be a ConsoleAppender. 7 | log4j.appender.Console=org.apache.log4j.ConsoleAppender 8 | log4j.appender.Console.layout=org.apache.log4j.PatternLayout 9 | 10 | # use log4j NDC to replace %x with tenant domain / username 11 | log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n 12 | #log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n 13 | 14 | # Spring 15 | log4j.logger.org.springframework=warn 16 | # Turn off Spring remoting warnings that should really be info or debug. 17 | log4j.logger.org.springframework.remoting.support=error 18 | log4j.logger.org.springframework.util=error 19 | 20 | # MyFaces 21 | log4j.logger.org.apache.myfaces.util.DebugUtils=info 22 | log4j.logger.org.apache.myfaces.el.VariableResolverImpl=error 23 | log4j.logger.org.apache.myfaces.application.jsp.JspViewHandlerImpl=error 24 | log4j.logger.org.apache.myfaces.taglib=error 25 | 26 | # Alfresco 27 | log4j.logger.org.alfresco=error 28 | log4j.logger.org.alfresco.config=warn 29 | log4j.logger.org.alfresco.config.JndiObjectFactoryBean=warn 30 | log4j.logger.org.alfresco.web=info 31 | 32 | # Web Framework 33 | log4j.logger.org.springframework.extensions.webscripts=info 34 | log4j.logger.org.springframework.extensions.webscripts.ScriptLogger=warn 35 | log4j.logger.org.springframework.extensions.webscripts.ScriptDebugger=off 36 | 37 | # Freemarker 38 | # Note the freemarker.runtime logger is used to log non-fatal errors that are handled by Alfresco's retrying transaction handler 39 | log4j.logger.freemarker.runtime= 40 | 41 | #----------------------------------------------------------------------- 42 | # Custom Share module logging goes here... 43 | #----------------------------------------------------------------------- 44 | 45 | log4j.logger.fr.jeci.collabora.evaluator.doclib.indicator=debug 46 | log4j.logger.dk.magenta.libreOffice.online=debug -------------------------------------------------------------------------------- /collabora-share-extension/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | collabora-share-extension 6 | Collabora Online Alfresco Share Module 7 | Collabora Online JAR Module for Alfresco Share 8 | jar 9 | 10 | 11 | fr.jeci.alfresco 12 | alfresco-collabora-online 13 | 1.2.0 14 | 15 | 16 | 19 | 20 | 21 | ${alfresco.groupId} 22 | share 23 | classes 24 | 25 | 26 | 27 | 28 | 29 | 30 | org.apache.maven.plugins 31 | maven-assembly-plugin 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /collabora-share-extension/src/main/assembly/amp.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 18 | 19 | build-amp-file 20 | 21 | 22 | amp 23 | 24 | 25 | false 26 | 27 | 28 | 29 | 30 | src/main/resources/alfresco/module/${project.artifactId}/module.properties 31 | true 32 | 33 | 34 | 35 | src/main/assembly/file-mapping.properties 36 | false 37 | 38 | 39 | 40 | src/main/resources/alfresco/module/${project.artifactId}/log4j.properties 41 | false 42 | 43 | 44 | 45 | 46 | 47 | 48 | src/main/assembly/web 49 | web 50 | true 51 | 52 | README.md 53 | 54 | 55 | 56 | 57 | 60 | 61 | 62 | lib 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /collabora-share-extension/src/main/assembly/file-mapping.properties: -------------------------------------------------------------------------------- 1 | # Custom AMP to WAR location mappings 2 | 3 | # 4 | # The following property can be used to include the standard set of mappings. 5 | # The contents of this file will override any defaults. The default is 6 | # 'true', i.e. the default mappings will be augmented or modified by values in 7 | # this file. 8 | # 9 | # Default mappings are: 10 | # 11 | # /config=/WEB-INF/classes 12 | # /lib=/WEB-INF/lib 13 | # /licenses=/WEB-INF/licenses 14 | # /web/jsp=/jsp 15 | # /web/css=/css 16 | # /web/images=/images 17 | # /web/scripts=/scripts 18 | # /web/php=/php 19 | # 20 | include.default=true 21 | 22 | # 23 | # Custom mappings. If 'include.default' is false, then this is the complete set. 24 | # Map /web to / in AMP so we can override things like favicon.ico 25 | # 26 | /web=/ 27 | 28 | -------------------------------------------------------------------------------- /collabora-share-extension/src/main/assembly/web/README.md: -------------------------------------------------------------------------------- 1 | # Web resources that should override out-of-the-box files 2 | 3 | Put here any web resources that should override out-of-the-box 4 | web resources, such as favicon.ico. They will then end up in the 5 | */web* directory in the AMP, and applied to the WAR, and override 6 | any existing web resources in the Share.WAR. 7 | 8 | **Note**. Module dependency needs to be set to amp for the web resources to be applied by MMT: 9 | 10 | ` 11 | 12 | ${project.groupId} 13 | some-share 14 | ${project.version} 15 | amp 16 | 17 | ` 18 | 19 | **Important**. New web resources should not be located here, but instead 20 | in the usual place in the *src/main/resources/META-INF/resources//* directory. 21 | 22 | 23 | -------------------------------------------------------------------------------- /collabora-share-extension/src/main/java/dk/magenta/libreOffice/online/PageModuleEvaluator.java: -------------------------------------------------------------------------------- 1 | package dk.magenta.libreOffice.online; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.extensions.surf.RequestContext; 6 | import org.springframework.extensions.surf.extensibility.ExtensionModuleEvaluator; 7 | import java.util.Map; 8 | 9 | /** 10 | * @author DarkStar1. 11 | */ 12 | public class PageModuleEvaluator implements ExtensionModuleEvaluator{ 13 | private static final Logger logger = LoggerFactory.getLogger(PageModuleEvaluator.class); 14 | public static final String PAGE_ID = "pageId"; 15 | 16 | /** 17 | *

Determines whether or not to apply a module. The module being processed will already have been matched to the 18 | * path being processed but an evaluator can still be used to only apply the module in certain circumstances. These 19 | * will typically be dictated by whether or not some data in the supplied model matches the criteria defined in the 20 | * supplied evaluationProperties.

21 | * 22 | * @param context The current {@link RequestContext} 23 | * @param evaluationProperties The evaluation properties defined in the module. 24 | * @return true if the module should be applied and false otherwise. 25 | */ 26 | @Override 27 | public boolean applyModule(RequestContext context, Map evaluationProperties) { 28 | String currPage = context.getPageId(); 29 | String targetPage = evaluationProperties.get( PAGE_ID); 30 | 31 | logger.debug("__Current Page Id: " + currPage); 32 | logger.debug("__Target Page Id: " + targetPage); 33 | 34 | return (targetPage != null && targetPage.equals(currPage)); 35 | } 36 | 37 | /** 38 | *

Returns the names of the required evaluation properties that are needed to successfully perform an evaluation. 39 | * This information is used when provided a user-interface that allows a {@link ExtensionModuleEvaluator} to be 40 | * dynamically configured for a module.

41 | * 42 | * @return A String array containing the names of the properties that are required by the evaluator. 43 | */ 44 | @Override 45 | public String[] getRequiredProperties() { 46 | return new String[] { PAGE_ID}; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /collabora-share-extension/src/main/java/fr/jeci/collabora/evaluator/doclib/indicator/EditingEvaluator.java: -------------------------------------------------------------------------------- 1 | package fr.jeci.collabora.evaluator.doclib.indicator; 2 | 3 | import org.alfresco.error.AlfrescoRuntimeException; 4 | import org.alfresco.web.evaluator.BaseEvaluator; 5 | import org.json.simple.JSONObject; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | public class EditingEvaluator extends BaseEvaluator { 10 | 11 | private static final Logger logger = LoggerFactory.getLogger(EditingEvaluator.class); 12 | private static final String LOCK_WRITE = "LOCK_WRITE"; 13 | 14 | @Override 15 | public boolean evaluate(JSONObject jsonObject) { 16 | try { 17 | if (logger.isDebugEnabled()) { 18 | logger.debug("EditingEvalutor - jsonObject" + jsonObject.toString()); 19 | } 20 | String lockType = (String) getProperty(jsonObject, "cm:lockType"); 21 | return LOCK_WRITE.equals(lockType); 22 | } catch (Exception err) { 23 | throw new AlfrescoRuntimeException("Failed to run UI evaluator: " + err.getMessage()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /collabora-share-extension/src/main/resources/META-INF/resources/components/documentlibrary/actions/document-edit-collabora-online-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CollaboraOnline/alfresco-collabora-online/96d8b4f07069241b8966d85a47fa9e4a5d29c45f/collabora-share-extension/src/main/resources/META-INF/resources/components/documentlibrary/actions/document-edit-collabora-online-16.png -------------------------------------------------------------------------------- /collabora-share-extension/src/main/resources/META-INF/resources/components/documentlibrary/collabora-online-metadata-template-renderer.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | YAHOO.Bubbling 3 | .fire( 4 | "registerRenderer", 5 | { 6 | propertyName : "editingBanner", 7 | renderer : function collaboraEditing_renderer(record, label) { 8 | var jsNode = record.jsNode, properties = jsNode.properties, html = ""; 9 | var editors = properties["cm:lockOwner"] || ""; 10 | var txt = this.msg("details.banner.collabora-editing"); 11 | return '' + label + '' + txt 12 | + ' ' + editors.displayName + ''; 13 | } 14 | }); 15 | })(); 16 | -------------------------------------------------------------------------------- /collabora-share-extension/src/main/resources/META-INF/resources/components/documentlibrary/document-edit-collabora-online-action-default.js: -------------------------------------------------------------------------------- 1 | YAHOO.Bubbling.fire("registerAction", { 2 | actionName: "onActionEditInCollaboraOnline", 3 | fn: function (node) { 4 | var COLLABORA_GET_TOKEN = Alfresco.constants.PROXY_URI + "collabora/token"; 5 | 6 | Alfresco.util.Ajax.jsonGet( 7 | { 8 | url: COLLABORA_GET_TOKEN + "?nodeRef=" + encodeURIComponent(node.nodeRef) + "&action=edit", 9 | successCallback: { 10 | fn: function (response) { 11 | var access_token = response.json.access_token; 12 | var wopi_src_url = response.json.wopi_src_url; 13 | console.log(access_token, wopi_src_url); 14 | 15 | // Get fileId from nodeRef (just use the uuid part) 16 | var fileId = Alfresco.util.NodeRef(node.nodeRef).id; 17 | 18 | var wopiFileURL = window.location.origin+"/alfresco/s/wopi/files/" + fileId; 19 | 20 | var frameSrcURL = wopi_src_url + "WOPISrc=" + encodeURIComponent(wopiFileURL) + "&lang=" + navigator.language.substring(0,2); 21 | 22 | require(["jquery"], (function ($) { 23 | var form = '
' + 24 | '
'; 25 | 26 | var frame = '