diff --git a/.travis.yml b/.travis.yml index 4b5e2df81..b08104189 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,8 @@ sudo: true language: php php: #- 8.0 -- 7.1 - 7.2 +- 7.1 - 5.6 matrix: allow_failures: @@ -33,7 +33,7 @@ install: - sudo mv ./tests/bootstrap-config-sample.php ./tests/bootstrap-config.php - sudo ./tests/bin/install-wp-tests.sh test travis "" /tmp/wordpress localhost latest true -- composer install +- if [[ $TRAVIS_PHP_VERSION = 7.1 || $TRAVIS_PHP_VERSION = 5.6 ]]; then composer install --ignore-platform-reqs; else composer install; fi - sudo mkdir /tmp/wordpress/wordpress-test/wp-content/uploads - sudo chmod -R 777 /tmp/wordpress/wordpress-test/wp-content/uploads - sudo wget https://phar.phpunit.de/phpunit-6.5.7.phar -P /tmp diff --git a/build.sh b/build.sh index 3408e8c45..ccd25386e 100755 --- a/build.sh +++ b/build.sh @@ -19,7 +19,7 @@ if [ $current_OS == "Darwin" ]; then find ./package.json -type f \( -name "package.json" -or -name "package-lock.json" \) -exec md5 {} \; | sort -k 2 | md5 > last-package-build.md5 else find src *.js -type f \( -name "*.js" -or -name "*.vue" -or -name "webpack.common.js" -or -name "webpack.dev.js" -or -name "webpack.prod.js" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-js-build.md5 - find ./src/views/admin/scss/ ./src/views/gutenberg-blocks ./src/views/gutenberg-blocks/tainacan-collections/collections-list ./src/views/gutenberg-blocks/tainacan-facets/facets-list ./src/views/gutenberg-blocks/tainacan-items/dynamic-items-list ./src/views/gutenberg-blocks/tainacan-items/items-list ./src/views/gutenberg-blocks/tainacan-terms/terms-list -type f \( -name "*.scss" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-sass-build.md5 + find ./src/views/admin/scss/ ./src/views/roles/ ./src/views/media-component/ ./src/views/reports/ ./src/views/gutenberg-blocks ./src/views/gutenberg-blocks/tainacan-collections/collections-list ./src/views/gutenberg-blocks/tainacan-facets/facets-list ./src/views/gutenberg-blocks/tainacan-items/dynamic-items-list ./src/views/gutenberg-blocks/tainacan-items/items-list ./src/views/gutenberg-blocks/tainacan-terms/terms-list -type f \( -name "*.scss" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-sass-build.md5 find ./composer.json -type f \( -name "composer.json" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-composer-build.md5 find ./package.json -type f \( -name "package.json" -or -name "package-lock.json" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-package-build.md5 fi diff --git a/compile-sass.sh b/compile-sass.sh index 18ea85b54..88be95d24 100644 --- a/compile-sass.sh +++ b/compile-sass.sh @@ -12,7 +12,6 @@ sass -E 'UTF-8' --cache-location .tmp/sass-cache-1 src/views/admin/scss/tainacan sass -E 'UTF-8' --cache-location .tmp/sass-cache-2 src/views/roles/tainacan-roles.scss:src/assets/css/tainacan-roles.css - sass -E 'UTF-8' --cache-location .tmp/sass-cache-3 src/views/reports/tainacan-reports.scss:src/assets/css/tainacan-reports.css sass -E 'UTF-8' --cache-location .tmp/sass-cache-4 src/views/media-component/media-component.scss:src/assets/css/media-component.css diff --git a/composer.json b/composer.json index 09e2d774b..b0615d74a 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "platform-check": false }, "scripts": { - "post-install-cmd": "\"src/vendor/bin/phpcs\" --config-set installed_paths src/vendor/wimg/php-compatibility", - "post-update-cmd" : "\"src/vendor/bin/phpcs\" --config-set installed_paths src/vendor/wimg/php-compatibility" + "post-install-cmd": "\"src/vendor/bin/phpcs\" --config-set installed_paths src/vendor/phpcompatibility/php-compatibility", + "post-update-cmd" : "\"src/vendor/bin/phpcs\" --config-set installed_paths src/vendor/phpcompatibility/php-compatibility" } } diff --git a/composer.lock b/composer.lock index cdefe23ac..375b61091 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "977d4fe3cad3f53c6559a0cc2656dcc1", + "content-hash": "8eb9217097c6d62dba6409b24f81c0ad", "packages": [ { "name": "kornrunner/blurhash", @@ -164,16 +164,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.22.0", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13" + "reference": "39d483bdf39be819deabf04ec872eb0b2410b531" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", - "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/39d483bdf39be819deabf04ec872eb0b2410b531", + "reference": "39d483bdf39be819deabf04ec872eb0b2410b531", "shasum": "" }, "require": { @@ -185,7 +185,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.20-dev" }, "thanks": { "name": "symfony/polyfill", @@ -223,6 +223,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.20.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -237,7 +240,7 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2020-10-23T14:02:19+00:00" } ], "packages-dev": [ @@ -358,8 +361,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "platform-overrides": { - "php": "7.2" - }, - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.0.0" } diff --git a/package-lock.json b/package-lock.json index 48fd6890e..78fc06528 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1666,9 +1666,9 @@ } }, "apexcharts": { - "version": "3.24.0", - "resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-3.24.0.tgz", - "integrity": "sha512-iT6czJCIVrmAtrcO90MZTQCvC+xi6R6Acf0jNH/d40FVTtCfcqECuKIh5iAMyOTtgUb7+fQ8rbadH2bm1kbL9Q==", + "version": "3.26.3", + "resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-3.26.3.tgz", + "integrity": "sha512-zbP7RBBV2CGffoVMIuTCUG64YbEUzV8IIT7iNVLMtY/OAVXTjPksDxSqKIniTvgJoscKe6sx4P56qDpBSU19VA==", "requires": { "svg.draggable.js": "^2.2.2", "svg.easing.js": "^2.0.0", @@ -3724,9 +3724,9 @@ } }, "lodash": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, "ms": { @@ -5471,9 +5471,9 @@ "dev": true }, "hosted-git-info": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", - "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==" + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" }, "hpack.js": { "version": "2.1.6", @@ -5851,9 +5851,9 @@ "dev": true }, "lodash": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, "string-width": { @@ -6459,9 +6459,15 @@ } }, "lodash": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "lodash.difference": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz", + "integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=", + "dev": true }, "loglevel": { "version": "1.6.8", @@ -6836,6 +6842,15 @@ "resolved": "https://registry.npmjs.org/moment/-/moment-2.25.3.tgz", "integrity": "sha512-PuYv0PHxZvzc15Sp8ybUCoQ+xpyPWvjOuK72a5ovzp2LI32rJXOiIfyoFoYvG3s6EwwrdkMyWuRiEHSZRLJNdg==" }, + "moment-locales-webpack-plugin": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/moment-locales-webpack-plugin/-/moment-locales-webpack-plugin-1.2.0.tgz", + "integrity": "sha512-QAi5v0OlPUP7GXviKMtxnpBAo8WmTHrUNN7iciAhNOEAd9evCOvuN0g1N7ThIg3q11GLCkjY1zQ2saRcf/43nQ==", + "dev": true, + "requires": { + "lodash.difference": "^4.5.0" + } + }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", @@ -8280,9 +8295,9 @@ "dev": true }, "querystringify": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", - "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", "dev": true }, "randombytes": { @@ -8452,8 +8467,7 @@ "regenerator-runtime": { "version": "0.13.5", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", - "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==", - "dev": true + "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==" }, "regenerator-transform": { "version": "0.14.4", @@ -10123,9 +10137,9 @@ "dev": true }, "lodash": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, "string-width": { @@ -10708,9 +10722,9 @@ } }, "url-parse": { - "version": "1.4.7", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz", - "integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz", + "integrity": "sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==", "dev": true, "requires": { "querystringify": "^2.1.1", @@ -10749,13 +10763,29 @@ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" }, "v-tooltip": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/v-tooltip/-/v-tooltip-2.0.3.tgz", - "integrity": "sha512-KZZY3s+dcijzZmV2qoDH4rYmjMZ9YKGBVoUznZKQX0e3c2GjpJm3Sldzz8HHH2Ud87JqhZPB4+4gyKZ6m98cKQ==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/v-tooltip/-/v-tooltip-2.1.3.tgz", + "integrity": "sha512-xXngyxLQTOx/yUEy50thb8te7Qo4XU6h4LZB6cvEfVd9mnysUxLEoYwGWDdqR+l69liKsy3IPkdYff3J1gAJ5w==", "requires": { - "lodash": "^4.17.15", - "popper.js": "^1.16.0", - "vue-resize": "^0.4.5" + "@babel/runtime": "^7.13.10", + "lodash": "^4.17.21", + "popper.js": "^1.16.1", + "vue-resize": "^1.0.1" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.0.tgz", + "integrity": "sha512-JELkvo/DlpNdJ7dlyw/eY7E0suy5i5GQH+Vlxaq1nsNJ+H7f4Vtv3jMeCEgRhZZQFXTjldYfQgv2qmM6M1v5wA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + } } }, "v8-compile-cache": { @@ -10801,9 +10831,9 @@ "integrity": "sha512-VfPwgcGABbGAue9+sfrD4PuwFar7gPb1yl1UK1MwXoQPAw0BKSqWfoYCT/ThFrdEVWoI51dBuyCoiNU9bZDZxQ==" }, "vue-apexcharts": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/vue-apexcharts/-/vue-apexcharts-1.6.0.tgz", - "integrity": "sha512-sT6tuVTLBwfH3TA7azecDNS/W70bmz14ZJI7aE7QIqcG9I6OywyH7x3hcOeY1v1DxttI8Svc5RuYj4Dd+A5F4g==" + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vue-apexcharts/-/vue-apexcharts-1.6.1.tgz", + "integrity": "sha512-ILn3/55IvZQUgsc7+jKDjPfHfGUlcUQi/lDrLjRe5g7gfjj99o8otXoHwMeib3CBHYdQXNG9foe1vzv7RdUzXA==" }, "vue-awesome-swiper": { "version": "4.1.1", @@ -10887,9 +10917,22 @@ "integrity": "sha512-viecHQiHVLez7HlYUQsv1wJb2MT/RDSzkDp6m3In41vPrk6OsBmT2qRE8LZqYIA4daIwrnx/Xm8h4fjOpuE3hw==" }, "vue-resize": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-0.4.5.tgz", - "integrity": "sha512-bhP7MlgJQ8TIkZJXAfDf78uJO+mEI3CaLABLjv0WNzr4CcGRGPIAItyWYnP6LsPA4Oq0WE+suidNs6dgpO4RHg==" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-1.0.1.tgz", + "integrity": "sha512-z5M7lJs0QluJnaoMFTIeGx6dIkYxOwHThlZDeQnWZBizKblb99GSejPnK37ZbNE/rVwDcYcHY+Io+AxdpY952w==", + "requires": { + "@babel/runtime": "^7.13.10" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.0.tgz", + "integrity": "sha512-JELkvo/DlpNdJ7dlyw/eY7E0suy5i5GQH+Vlxaq1nsNJ+H7f4Vtv3jMeCEgRhZZQFXTjldYfQgv2qmM6M1v5wA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } + } }, "vue-router": { "version": "3.1.6", diff --git a/package.json b/package.json index 9668e5286..494b57d20 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "build-prod": "cross-env NODE_ENV=production webpack --config webpack.prod.js --display-error-details --progress --hide-modules" }, "dependencies": { - "apexcharts": "^3.24.0", + "apexcharts": "^3.26.3", "countup.js": "^2.0.7", "axios": "^0.21.1", "blurhash": "^1.1.3", @@ -24,9 +24,9 @@ "react-dom": "^16.13.1", "swiper": "^5.2.0", "t": "^0.5.1", - "v-tooltip": "^2.0.3", + "v-tooltip": "^2.1.3", "vue": "^2.6.11", - "vue-apexcharts": "^1.6.0", + "vue-apexcharts": "^1.6.1", "vue-awesome-swiper": "^4.1.1", "vue-blurhash": "^0.1.4", "vue-countup-v2": "^4.0.0", @@ -49,6 +49,7 @@ "eslint-loader": "^2.2.1", "eslint-plugin-vue": "^5.2.3", "file-loader": "^2.0.0", + "moment-locales-webpack-plugin": "^1.2.0", "postcss-loader": "^3.0.0", "sass-loader": "^7.3.1", "style-loader": "^0.23.1", diff --git a/src/assets/css/media-component.css b/src/assets/css/media-component.css index b77b24c43..f2b015783 100644 --- a/src/assets/css/media-component.css +++ b/src/assets/css/media-component.css @@ -657,7 +657,6 @@ a.pswp__share--download:hover { .tainacan-media-component__swiper-main li.swiper-slide { height: 100%; max-width: calc(100% - var(--swiper-navigation-size, 44px) - var(--swiper-navigation-size, 44px)); - min-width: 100%; padding: 0 var(--swiper-navigation-size, 44px); opacity: 1.0; transition: opacity 0.2s linear; } @@ -687,17 +686,37 @@ a.pswp__share--download:hover { .tainacan-media-component__swiper-main .swiper-slide-content { width: 100%; height: 100%; - display: flex; - align-items: center; - justify-content: center; - flex-direction: column; } - .tainacan-media-component__swiper-main .swiper-slide-content .tainacan-embed-container { + display: block; + text-align: center; } + .tainacan-media-component__swiper-main .swiper-slide-content .tainacan-content-embed { width: 100%; height: auto; } + .tainacan-media-component__swiper-main .swiper-slide-content .tainacan-content-embed.tainacan-has-aspect-ratio { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 2) / 1); + /* Default to 2:1 aspect ratio. */ + margin-left: auto; + margin-right: auto; } + .tainacan-media-component__swiper-main .swiper-slide-content .tainacan-content-embed.tainacan-embed-aspect-21-9 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 21) / 9); } + .tainacan-media-component__swiper-main .swiper-slide-content .tainacan-content-embed.tainacan-embed-aspect-18-9 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 18) / 9); } + .tainacan-media-component__swiper-main .swiper-slide-content .tainacan-content-embed.tainacan-embed-aspect-16-9 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 16) / 9); } + .tainacan-media-component__swiper-main .swiper-slide-content .tainacan-content-embed.tainacan-embed-aspect-4-3 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 4) / 3); } + .tainacan-media-component__swiper-main .swiper-slide-content .tainacan-content-embed.tainacan-embed-aspect-1-1 { + max-width: var(--tainacan-media-main-carousel-height, 60vh); } + .tainacan-media-component__swiper-main .swiper-slide-content .tainacan-content-embed.tainacan-embed-aspect-3-4 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 3) / 4); } + .tainacan-media-component__swiper-main .swiper-slide-content .tainacan-content-embed.tainacan-embed-aspect-9-16 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 9) / 16); } + .tainacan-media-component__swiper-main .swiper-slide-content .tainacan-content-embed.tainacan-embed-aspect-1-2 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 1) / 2); } .tainacan-media-component__swiper-main .swiper-slide-content iframe { max-height: var(--tainacan-media-main-carousel-height, 60vh); - width: 100%; max-width: 100%; + margin-left: auto; + margin-right: auto; border: none; display: block; background-image: url("../images/preloader.gif"); @@ -708,7 +727,8 @@ a.pswp__share--download:hover { z-index: 99; background: var(--tainacan-media-background, #ffffff); border-radius: 3px; - word-wrap: break-word; } + word-wrap: break-word; + padding: 1rem 2rem; } .tainacan-media-component__swiper-main .swiper-slide-content audio { background: black; min-height: 38px; @@ -724,6 +744,9 @@ a.pswp__share--download:hover { .tainacan-media-component__swiper-main .swiper-slide-content img { width: auto; max-height: var(--tainacan-media-main-carousel-height, 60vh); } + .tainacan-media-component__swiper-main .swiper-slide-content .twitter-tweet { + margin-left: auto; + margin-right: auto; } .tainacan-media-component__swiper-thumbs { width: 100%; @@ -833,27 +856,53 @@ a.pswp__share--download:hover { justify-content: center; } .tainacan-photoswipe-layer .pswp__container .attachment-without-image { width: 100%; - height: 100%; + height: calc(100% - 44px); display: flex; + justify-content: center; align-items: center; - justify-content: center; } - .tainacan-photoswipe-layer .pswp__container .attachment-without-image.tainacan-embed-container:not(.tainacan-embed-without-iframe) { - padding: 0px; } - .tainacan-photoswipe-layer .pswp__container .attachment-without-image .tainacan-embed-container .twitter-tweet { - width: 100vw !important; } - .tainacan-photoswipe-layer .pswp__container iframe { + text-align: center; padding: 44px; - min-height: 90vh; - max-height: 90vh; - height: 100%; - width: 100%; - max-width: 100%; - margin: 0 auto; + margin-top: 22px; } + .tainacan-photoswipe-layer .pswp__container .attachment-without-image > iframe:not(.wp-embedded-content) { + width: 90vw; + height: 90vh; + border: none; + margin: 44px; + display: block; + background-image: url("../images/preloader.gif"); + background-repeat: no-repeat; + background-position: center; } + .tainacan-photoswipe-layer .pswp__container .pswp__zoom-wrap > iframe#iframePDF { + width: 90vw; + height: 90vh; border: none; + margin: 44px auto; display: block; background-image: url("../images/preloader.gif"); background-repeat: no-repeat; background-position: center; } + .tainacan-photoswipe-layer .pswp__container .tainacan-content-embed { + width: 100%; + height: auto; } + .tainacan-photoswipe-layer .pswp__container .tainacan-content-embed.tainacan-has-aspect-ratio { + max-width: calc((90vh * 2) / 1); + /* Default to 2:1 aspect ratio. */ + margin-left: auto; + margin-right: auto; } + .tainacan-photoswipe-layer .pswp__container .tainacan-content-embed.tainacan-embed-aspect-21-9 { + max-width: calc((90vh * 21) / 9); } + .tainacan-photoswipe-layer .pswp__container .tainacan-content-embed.tainacan-embed-aspect-18-9 { + max-width: calc((90vh * 18) / 9); } + .tainacan-photoswipe-layer .pswp__container .tainacan-content-embed.tainacan-embed-aspect-16-9 { + max-width: calc((90vh * 16) / 9); } + .tainacan-photoswipe-layer .pswp__container .tainacan-content-embed.tainacan-embed-aspect-4-3 { + max-width: calc((90vh * 4) / 3); } + .tainacan-photoswipe-layer .pswp__container .tainacan-content-embed.tainacan-embed-aspect-1-1 { + max-width: 90vh; } + .tainacan-photoswipe-layer .pswp__container .tainacan-content-embed.tainacan-embed-aspect-9-16 { + max-width: calc((90vh * 9) / 16); } + .tainacan-photoswipe-layer .pswp__container .tainacan-content-embed.tainacan-embed-aspect-1-2 { + max-width: calc((90vh * 1) / 2); } .tainacan-photoswipe-layer .pswp__container a:first-of-type, .tainacan-photoswipe-layer .pswp__container p:first-of-type, .tainacan-photoswipe-layer .pswp__container article:first-of-type { diff --git a/src/assets/css/media-component.css.map b/src/assets/css/media-component.css.map index 9d873030b..b6314d212 100644 --- a/src/assets/css/media-component.css.map +++ b/src/assets/css/media-component.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,2EAA2E;AAE3E;;EAEE;AAOF,uBAAuB;AACvB,KAAM;EACL,OAAO,EAAE,IAAI;EACb,QAAQ,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B,KAAK,EAAE,IAAI;EACX,IAAI,EAAE,IAAI;EACV,QAAQ,EAAE,QAAQ;EAClB,QAAQ,EAAE,MAAM;EAChB,aAAa,EAAE,QAAQ;EACvB,WAAW,EAAE,MAAM;EACnB,WAAW,EAAE,IAAI;EACjB,OAAO,EAAE,MAAM;AAEnB,gDAAsB;EAClB,SAAS,EAAE,OAAO;EAClB,UAAU,EAAE,MAAM;AAEtB,6CAAmB;EACf,SAAS,EAAE,QAAQ;AAEvB,iDAAuB;EACnB,UAAU,EAAE,MAAM;EAClB,SAAS,EAAE,GAAG;EACd,SAAS,EAAE,KAAK", "sources": ["../../../node_modules/photoswipe/src/css/main.scss","../../views/media-component/media-component.scss","../../../node_modules/photoswipe/src/css/default-skin/default-skin.scss"], "names": [], "file": "media-component.css" diff --git a/src/assets/css/tainacan-embeds.css b/src/assets/css/tainacan-embeds.css index 324579fc7..5cbe681b2 100644 --- a/src/assets/css/tainacan-embeds.css +++ b/src/assets/css/tainacan-embeds.css @@ -1,44 +1,64 @@ -.tainacan-embed-container { - position: relative; - height: 0; - overflow: hidden; +/* TAINACAN EMBEDS + * This file copies most of Gutenberg's logic for responsive blocks, + * but uses different classes to avoid future conflicts. + * Check their original css: /packages/block-library/src/embed/style.scss + */ + +/* + * The embed container is in a `figure` element, and many themes zero this out. + * This rule explicitly sets it, to ensure at least some bottom-margin in the flow. + */ +:not(.wp-block-embed__wrapper)>.tainacan-content-embed { + margin-bottom: 1em; + margin-left: 0; + margin-right: 0; + clear: both; +} + +/* Don't allow iframe to overflow it's container. */ +:not(.wp-block-embed__wrapper)>.tainacan-content-embed iframe { max-width: 100%; - height: auto; } -.tainacan-embed-container:not(.tainacan-embed-without-iframe) { - padding-bottom: 56.25%; - padding-top: 30px; - width: 100%; - margin: auto; +:not(.wp-block-embed__wrapper)>.tainacan-content-embed .tainacan-content-embed__wrapper { + position: relative; } -.tainacan-embed-container .twitter-tweet { - margin: 0 auto; + +/* Add responsiveness to embeds with aspect ratios. */ +:not(.wp-block-embed__wrapper)>.tainacan-has-aspect-ratio .tainacan-content-embed__wrapper::before { + content: ""; + display: block; + padding-top: 50%; /* Default to 2:1 aspect ratio. */ } -.tainacan-embed-container iframe.wp-embedded-content { - display: flex !important; - align-items: center; - justify-content: center; - margin: auto !important; - width: auto !important; - top: 50%; - bottom: 50%; +:not(.wp-block-embed__wrapper)>.tainacan-has-aspect-ratio iframe { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + height: 100%; + width: 100%; } -@media screen and (max-width: 1024px) { - .tainacan-embed-container iframe.wp-embedded-content { - position: relative; - } +:not(.wp-block-embed__wrapper)>.tainacan-embed-aspect-21-9 .tainacan-content-embed__wrapper::before { + padding-top: 42.85%; /* 9 / 21 * 100 */ } -.tainacan-embed-container #tainacan-attachment-iframe { /* PDF */ - width: 100%; +:not(.wp-block-embed__wrapper)>.tainacan-embed-aspect-18-9 .tainacan-content-embed__wrapper::before { + padding-top: 50%; /* 9 / 18 * 100 */ } -.tainacan-embed-container iframe, -.tainacan-embed-container object, -.tainacan-embed-container embed { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - width: 100%; - height: 100%; +:not(.wp-block-embed__wrapper)>.tainacan-embed-aspect-16-9 .tainacan-content-embed__wrapper::before { + padding-top: 56.25%; /* 9 / 16 * 100 */ } +:not(.wp-block-embed__wrapper)>.tainacan-embed-aspect-4-3 .tainacan-content-embed__wrapper::before { + padding-top: 75%; /* 3 / 4 * 100 */ +} +:not(.wp-block-embed__wrapper)>.tainacan-embed-aspect-1-1 .tainacan-content-embed__wrapper::before { + padding-top: 100%; /* 1 / 1 * 100 */ +} +:not(.wp-block-embed__wrapper)>.tainacan-embed-aspect-9-16 .tainacan-content-embed__wrapper::before { + padding-top: 177.77%; /* 16 / 9 * 100 */ +} +:not(.wp-block-embed__wrapper)>.tainacan-embed-aspect-3-4 .tainacan-content-embed__wrapper::before { + padding-top: 133.33%; /* 4 / 3 * 100 */ +} +:not(.wp-block-embed__wrapper)>.tainacan-embed-aspect-1-2 .tainacan-content-embed__wrapper::before { + padding-top: 200%; /* 2 / 1 * 100 */ +} \ No newline at end of file diff --git a/src/assets/css/tainacan-gutenberg-block-common-styles.css b/src/assets/css/tainacan-gutenberg-block-common-styles.css index 0d835f9c4..27fbe77c5 100644 --- a/src/assets/css/tainacan-gutenberg-block-common-styles.css +++ b/src/assets/css/tainacan-gutenberg-block-common-styles.css @@ -158,6 +158,10 @@ .wp-block-tainacan-modal .modal-radio-list .components-base-control__field .modal-checkbox-list-item label, .wp-block-tainacan-modal .modal-radio-list .components-base-control__field .components-radio-control__option label { max-width: 80%; } } + .wp-block-tainacan-modal .modal-checkbox-list .components-radio-control__option .components-radio-control__input, + .wp-block-tainacan-modal .modal-radio-list .components-base-control__field .components-radio-control__option .components-radio-control__input { + min-width: 20px; + min-height: 20px; } .wp-block-tainacan-modal .modal-checkbox-list .components-radio-control__option .components-radio-control__input::before, .wp-block-tainacan-modal .modal-radio-list .components-base-control__field .components-radio-control__option .components-radio-control__input::before { border-width: 0px; } diff --git a/src/assets/css/tainacan-gutenberg-block-common-styles.css.map b/src/assets/css/tainacan-gutenberg-block-common-styles.css.map index ec413528c..0fa6ec71e 100644 --- a/src/assets/css/tainacan-gutenberg-block-common-styles.css.map +++ b/src/assets/css/tainacan-gutenberg-block-common-styles.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAIA,KAAM;EACF,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,sBAAsB,CAAC,QAAU;EACjC,wBAAwB,CAAC,QAAY;;AAIzC,kDAAmD;EAC/C,WAAW,EAAE,iBAAiB;EAC9B,aAAa,EAAE,YAAY;EAC3B,UAAU,EAAE,oCAAmC;EAE/C,iFAA+B;IAC3B,aAAa,EAAE,CAAC;EAEpB,oFAAkC;IAC9B,OAAO,EAAE,IA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W,EAAE,MAAM;QACnB,aAAa,EAAE,QAAQ;QACvB,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE,GAAG;QAEd,yCAA0C;UAP9C;;;4HAAM;YAO0C,SAAS,EAAE,GAAG;IAGlE;iJAAmE;MAC/D,SAAS,EAAE,IAAI;MACf,UAAU,EAAE,IAAI;IAEpB;yJAA2E;MACvE,YAAY,EAAE,GAAG;EAGzB,gDAAwB;IACpB,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,MAAM;IAEvB,kDAAE;MACE,KAAK,EAAE,oCAAmC;MAC1C,YAAY,EAAE,IAAI;MAClB,UAAU,EAAE,GAAG;EAGvB,2CAAmB;IACf,UAAU,EAAE,iBAAiB;IAC7B,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,aAAa;IAC9B,OAAO,EAAE,gBAAgB;IACzB,MAAM,EAAE,OAAO;IAEf,6CAAE;MACE,OAAO,EAAE,MAAM;MACf,KAAK,EAAE,oCAAmC", "sources": ["../../views/gutenberg-blocks/gutenberg-blocks-style.scss","../../views/gutenberg-blocks/gutenberg-blocks-variables.scss"], "names": [], "file": "tainacan-gutenberg-block-common-styles.css" diff --git a/src/assets/css/tainacan-reports.css b/src/assets/css/tainacan-reports.css index a66b58d81..8d0757161 100644 --- a/src/assets/css/tainacan-reports.css +++ b/src/assets/css/tainacan-reports.css @@ -5,8 +5,59 @@ opacity: 0.0; } #tainacan-reports-app a:hover { cursor: pointer; } - #tainacan-reports-app .wp-heading-inline { - margin-bottom: 2rem; } + #tainacan-reports-app .tainacan-reports-header { + display: flex; + justify-content: space-between; + align-items: center; + margin: 10px 24px 10px 0px; } + #tainacan-reports-app .tainacan-reports-header .wp-heading-inline { + margin: 0rem; } + #tainacan-reports-app .tainacan-reports-header select { + margin-right: auto; + margin-left: 6px; } + #tainacan-reports-app .tainacan-reports-subheader { + display: flex; + align-items: center; + margin: 6px 0px 36px 0px; + color: var(--tainacan-block-gray4, #555758); } + #tainacan-reports-app .tainacan-reports-subheader .tainacan-reports-subheader-box:not(:first-child) { + padding-left: 14px; + border-left: 1px solid var(--tainacan-block-gray3, #cbcbcb); } + #tainacan-reports-app .tainacan-reports-subheader .tainacan-reports-subheader-box__title { + font-weight: bold; + margin-left: 2px; } + #tainacan-reports-app .tainacan-reports-subheader .tainacan-reports-subheader-box__content { + display: flex; + align-items: center; + margin: 0px 14px 0px 0px; + flex-wrap: wrap; } + #tainacan-reports-app .tainacan-reports-subheader .tainacan-reports-subheader-box__content.tainacan-reports-subheader-box__content--two-columns li { + flex-basis: calc(50% - 8px); } + @media screen and (max-width: 986px) { + #tainacan-reports-app .tainacan-reports-subheader .tainacan-reports-subheader-box__content.tainacan-reports-subheader-box__content--two-columns li { + flex-basis: 100%; } } + #tainacan-reports-app .tainacan-reports-subheader .tainacan-reports-subheader-box__content.tainacan-reports-subheader-box__content--three-columns li { + flex-basis: calc(33.3333% - 8px); } + @media screen and (max-width: 1024px) { + #tainacan-reports-app .tainacan-reports-subheader .tainacan-reports-subheader-box__content.tainacan-reports-subheader-box__content--three-columns li { + flex-basis: calc(50% - 8px); } } + @media screen and (max-width: 768px) { + #tainacan-reports-app .tainacan-reports-subheader .tainacan-reports-subheader-box__content.tainacan-reports-subheader-box__content--three-columns li { + flex-basis: 100%; } } + #tainacan-reports-app .tainacan-reports-subheader .tainacan-reports-subheader-box__content li { + display: flex; + align-items: center; + margin: 0px 8px 0px 0px; + flex-basis: 100%; } + #tainacan-reports-app .tainacan-reports-subheader .icon svg { + fill: var(--tainacan-block-gray4, #555758); + margin-left: -0.5rem; + cursor: default; } + #tainacan-reports-app .tainacan-reports-subheader .apexcharts-pan-icon svg { + fill: transparent; + stroke: var(--tainacan-block-gray4, #555758); } + #tainacan-reports-app .tainacan-reports-subheader .apexcharts-reset-icon { + margin-left: 0; } #tainacan-reports-app .columns { max-width: 100%; align-items: flex-start; @@ -57,6 +108,16 @@ #tainacan-reports-app .postbox .box-header .box-header__item { margin-bottom: 10px; line-height: 2rem; } + #tainacan-reports-app .empty-postbox-placeholder { + display: flex; + align-items: center; + justify-content: center; + padding: 1rem; + min-height: 380px; + flex-direction: column; + opacity: 0.75; } + #tainacan-reports-app .empty-postbox-placeholder p { + color: var(--tainacan-block-gray4, #555758); } #tainacan-reports-app .graph-mode-switch { display: inline-block; } #tainacan-reports-app .graph-mode-switch button { @@ -92,5 +153,8 @@ #tainacan-reports-app .tainacan-custom-tooltip .tainacan-custom-tooltip__body p { margin-bottom: 4px; font-size: 0.85rem; } + #tainacan-reports-app .apexcharts-legend-series { + display: flex; + align-items: center; } /*# sourceMappingURL=tainacan-reports.css.map */ diff --git a/src/assets/css/tainacan-reports.css.map b/src/assets/css/tainacan-reports.css.map index 5666c19b6..346b11c6f 100644 --- a/src/assets/css/tainacan-reports.css.map +++ b/src/assets/css/tainacan-reports.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,qBAAsB;EAClB,OAAO,EAAE,iBAAiB;EAC1B,MAAM,EAAE,CAAC;EAGT,4CAAuB;IACnB,OAAO,EAAE,GAAG;EAGhB,6BAAQ;IACJ,MAAM,EAAE,OAAO;EAGnB,wCAAmB;IACf,aAAa,EAAE,IAAI;EAGvB,8BAAS;IACL,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,UAAU;IACvB,eAAe,EAAE,MAAM;IAEvB,sCAAQ;MACJ,SAAS,EAAE,IAAI;MACf,OAAO,EAAE,CAAC;MACV,QAAQ,EAAE,QAAQ;MAClB,UAAU,EAAE,WAAW;MAEvB,+CAAS;QACL,MAAM,EAAE,OAAO;MAEnB,0DAAoB;QAChB,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,mBAAmB;QAC3B,KAAK,EAAE,mBAAmB;QAC1B,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,QAAQ;QACjB,gBAAgB,EAAE,oCAAoC;QACtD,KAAK,EAAE,oCAA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AAa;MAC9B,SAAS,EAAE,IAAI;MAEf,4DAAkB;QACd,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,IAAI;EAK7B,gDAA2B;IACvB,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,MAAM;IACnB,eAAe,EAAE,MAAM;IACvB,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,MAAM;IACtB,OAAO,EAAE,IAAI;IAEb,kDAAE;MACE,KAAK,EAAE,oCAAoC;EAInD,wCAAmB;IACf,OAAO,EAAE,YAAY;IACrB,+CAAO;MACH,MAAM,EAAE,eAAe;MACvB,UAAU,EAAE,eAAe;MAC3B,UAAU,EAAE,eAAe;MAC3B,OAAO,EAAE,CAAC;MACV,MAAM,EAAE,OAAO;MAEf,uDAAU;QACN,KAAK,EAAE,oCAAoC;EAKvD,8CAAyB;IACrB,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,MAAM;IACvB,WAAW,EAAE,UAAU;IACvB,cAAc,EAAE,MAAM;IAEtB,+EAAiC;MAC7B,gBAAgB,EAAE,oCAAoC;MACtD,OAAO,EAAE,IAAI;MACb,eAAe,EAAE,UAAU;MAC3B,WAAW,EAAE,MAAM;MACnB,KAAK,EAAE,IAAI;MACX,OAAO,EAAE,iBAAiB;IAG9B,gHAAgE;MAC5D,OAAO,EAAE,iBAAiB;IAE9B,6EAA+B;MAC3B,KAAK,EAAE,IAAI;MACX,OAAO,EAAE,QAAQ;MACjB,OAAO,EAAE,IAAI;MACb,eAAe,EAAE,MAAM;MACvB,WAAW,EAAE,UAAU;MACvB,cAAc,EAAE,MAAM;MAEtB,+EAAE;QACE,aAAa,EAAE,GAAG;QAClB,SAAS,EAAE,OAAO;EAK9B,+CAA0B;IACtB,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,MAAM", "sources": ["../../views/reports/tainacan-reports.scss"], "names": [], "file": "tainacan-reports.css" diff --git a/src/assets/css/tainacanicons.css b/src/assets/css/tainacanicons.css index b6b87975e..99d21ca54 100644 --- a/src/assets/css/tainacanicons.css +++ b/src/assets/css/tainacanicons.css @@ -7,7 +7,7 @@ url("../fonts/TainacanIcons.woff") format("woff"), url("../fonts/TainacanIcons.ttf") format("truetype"), url("../fonts/TainacanIcons.svg") format("svg"); -font-weight: normal; + font-weight: normal; font-style: normal; text-rendering: optimizeLegibility; } diff --git a/src/classes/api/endpoints/class-tainacan-rest-bulkedit-controller.php b/src/classes/api/endpoints/class-tainacan-rest-bulkedit-controller.php index c1ad30ec9..40ca5129f 100644 --- a/src/classes/api/endpoints/class-tainacan-rest-bulkedit-controller.php +++ b/src/classes/api/endpoints/class-tainacan-rest-bulkedit-controller.php @@ -382,8 +382,9 @@ class REST_Bulkedit_Controller extends REST_Controller { global $Tainacan_Generic_Process_Handler; $process = $Tainacan_Generic_Process_Handler->get_process_instance_by_session_id($bulk_id); if ($process !== false) { + $bulk_edit_value = isset($body['new_value']) ? $body['new_value'] : (isset($body['value']) ? $body['value'] : null); $bulk_edit_data = [ - "value" => isset($body['new_value']) ? $body['new_value'] : $body['value'], + "value" => $bulk_edit_value, "method" => $method, "old_value" => isset($body['old_value']) ? $body['old_value'] : null, "metadatum_id" => isset($body['metadatum_id']) ? $body['metadatum_id'] : null, diff --git a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php index cf52a9550..576586bb3 100644 --- a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php +++ b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php @@ -883,7 +883,7 @@ class REST_Items_Controller extends REST_Controller { return new \WP_REST_Response( [ 'error_message' => __( 'Please verify, invalid value(s)', 'tainacan' ), 'errors' => $item_metadata->get_errors(), - 'item_metadata' => $this->prepare_item_for_response($item_metadata, $request), + 'item_metadata' => $this->prepare_item_for_response($item_metadata->get_item(), $request), ], 400 ); } } diff --git a/src/classes/api/endpoints/class-tainacan-rest-reports-controller.php b/src/classes/api/endpoints/class-tainacan-rest-reports-controller.php index df40371d3..f6599e194 100644 --- a/src/classes/api/endpoints/class-tainacan-rest-reports-controller.php +++ b/src/classes/api/endpoints/class-tainacan-rest-reports-controller.php @@ -35,10 +35,10 @@ class REST_Reports_Controller extends REST_Controller { 'permission_callback' => array($this, 'reports_permissions_check'), 'args' => [ 'force' => [ - 'title' => __( 'Force regenerete', 'tainacan' ), + 'title' => __( 'Force regenerate', 'tainacan' ), 'type' => 'string', 'default' => 'no', - 'description' => __( 'Force generates the reports graphic.', 'tainacan' ), + 'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ), 'enum' => array( 'no', 'yes' @@ -56,10 +56,10 @@ class REST_Reports_Controller extends REST_Controller { 'permission_callback' => array($this, 'reports_permissions_check'), 'args' => [ 'force' => [ - 'title' => __( 'Force regenerete', 'tainacan' ), + 'title' => __( 'Force regenerate', 'tainacan' ), 'type' => 'string', 'default' => 'no', - 'description' => __( 'Force generates the reports graphic.', 'tainacan' ), + 'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ), 'enum' => array( 'no', 'yes' @@ -77,10 +77,10 @@ class REST_Reports_Controller extends REST_Controller { 'permission_callback' => array($this, 'reports_permissions_check'), 'args' => [ 'force' => [ - 'title' => __( 'Force regenerete', 'tainacan' ), + 'title' => __( 'Force regenerate', 'tainacan' ), 'type' => 'string', 'default' => 'no', - 'description' => __( 'Force generates the reports graphic.', 'tainacan' ), + 'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ), 'enum' => array( 'no', 'yes' @@ -98,10 +98,10 @@ class REST_Reports_Controller extends REST_Controller { 'permission_callback' => array($this, 'reports_permissions_check'), 'args' => [ 'force' => [ - 'title' => __( 'Force regenerete', 'tainacan' ), + 'title' => __( 'Force regenerate', 'tainacan' ), 'type' => 'string', 'default' => 'no', - 'description' => __( 'Force generates the reports graphic.', 'tainacan' ), + 'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ), 'enum' => array( 'no', 'yes' @@ -119,10 +119,10 @@ class REST_Reports_Controller extends REST_Controller { 'permission_callback' => array($this, 'reports_permissions_check'), 'args' => [ 'force' => [ - 'title' => __( 'Force regenerete', 'tainacan' ), + 'title' => __( 'Force regenerate', 'tainacan' ), 'type' => 'string', 'default' => 'no', - 'description' => __( 'Force generates the reports graphic.', 'tainacan' ), + 'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ), 'enum' => array( 'no', 'yes' @@ -140,10 +140,10 @@ class REST_Reports_Controller extends REST_Controller { 'permission_callback' => array($this, 'reports_permissions_check'), 'args' => [ 'force' => [ - 'title' => __( 'Force regenerete', 'tainacan' ), + 'title' => __( 'Force regenerate', 'tainacan' ), 'type' => 'string', 'default' => 'no', - 'description' => __( 'Force generates the reports graphic.', 'tainacan' ), + 'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ), 'enum' => array( 'no', 'yes' @@ -161,10 +161,10 @@ class REST_Reports_Controller extends REST_Controller { 'permission_callback' => array($this, 'reports_permissions_check'), 'args' => [ 'force' => [ - 'title' => __( 'Force regenerete', 'tainacan' ), + 'title' => __( 'Force regenerate', 'tainacan' ), 'type' => 'string', 'default' => 'no', - 'description' => __( 'Force generates the reports graphic.', 'tainacan' ), + 'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ), 'enum' => array( 'no', 'yes' @@ -192,10 +192,10 @@ class REST_Reports_Controller extends REST_Controller { 'format' => 'date-time', // RFC3339. https://tools.ietf.org/html/rfc3339#section-5.8 ], 'force' => [ - 'title' => __( 'Force regenerete', 'tainacan' ), + 'title' => __( 'Force regenerate', 'tainacan' ), 'type' => 'string', 'default' => 'no', - 'description' => __( 'Force generates the reports graphic.', 'tainacan' ), + 'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ), 'enum' => array( 'no', 'yes' @@ -223,10 +223,10 @@ class REST_Reports_Controller extends REST_Controller { 'format' => 'date-time', // RFC3339. https://tools.ietf.org/html/rfc3339#section-5.8 ], 'force' => [ - 'title' => __( 'Force regenerete', 'tainacan' ), + 'title' => __( 'Force regenerate', 'tainacan' ), 'type' => 'string', 'default' => 'no', - 'description' => __( 'Force generates the reports graphic.', 'tainacan' ), + 'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ), 'enum' => array( 'no', 'yes' @@ -248,10 +248,10 @@ class REST_Reports_Controller extends REST_Controller { 'type' => 'integer', ], 'force' => [ - 'title' => __( 'Force regenerete', 'tainacan' ), + 'title' => __( 'Force regenerate', 'tainacan' ), 'type' => 'string', 'default' => 'no', - 'description' => __( 'Force generates the reports graphic.', 'tainacan' ), + 'description' => __( 'Force generating the report, despite presence of cache.', 'tainacan' ), 'enum' => array( 'no', 'yes' @@ -264,7 +264,7 @@ class REST_Reports_Controller extends REST_Controller { } public function reports_permissions_check($request) { - return true; + return \is_user_logged_in() && current_user_can('read'); } public function get_collections($request) { @@ -311,7 +311,9 @@ class REST_Reports_Controller extends REST_Controller { 'trash' => 0, 'draft' => 0, 'publish' => 0, - 'private' => 0 + 'private' => 0, + 'restrict' => 0, + 'not_restrict' => 0 ) ) ); @@ -333,13 +335,24 @@ class REST_Reports_Controller extends REST_Controller { $response['totals']['items']['draft'] = intval($total_items->draft); $response['totals']['items']['publish'] = intval($total_items->publish); $response['totals']['items']['private'] = intval($total_items->private); + + if ( \is_post_status_viewable( $collection->get_status() ) === true ) { + $response['totals']['items']['not_restrict'] += isset($total_items->publish) ? intval($total_items->publish) : 0; + } else { + $response['totals']['items']['restrict'] += ( + //(isset($total_items->trash) ? intval($total_items->trash) : 0) + + (isset($total_items->draft) ? intval($total_items->draft) : 0) + + (isset($total_items->publish) ? intval($total_items->publish) : 0) + + (isset($total_items->private) ? intval($total_items->private) : 0) + ); + } } } else { $key_cache_object = 'summary'; $cached_object = $this->get_cache_object($key_cache_object, $request); if($cached_object !== false ) return new \WP_REST_Response($cached_object, 200); - $collections = $this->collections_repository->fetch([]); + $collections = $this->collections_repository->fetch(['status'=> ['publish', 'private', 'trash']]); $response['totals']['collections'] = array( 'total' => 0, 'trash' => 0, @@ -354,12 +367,20 @@ class REST_Reports_Controller extends REST_Controller { $response['totals']['collections']['total']++; $total_items = wp_count_posts( $collection->get_db_identifier(), 'readable' ); - if (isset($total_items->publish) || isset($total_items->private) || - isset($total_items->trash) || isset($total_items->draft)) { - $response['totals']['items']['trash'] += $total_items->trash; - $response['totals']['items']['draft'] += $total_items->draft; - $response['totals']['items']['publish'] += $total_items->publish; - $response['totals']['items']['private'] += $total_items->private; + $response['totals']['items']['trash'] += isset($total_items->trash) ? intval($total_items->trash) : 0; + $response['totals']['items']['draft'] += isset($total_items->draft) ? intval($total_items->draft) : 0; + $response['totals']['items']['publish'] += isset($total_items->publish)? intval($total_items->publish) : 0; + $response['totals']['items']['private'] += isset($total_items->private)? intval($total_items->private) : 0; + + if ( \is_post_status_viewable( $collection->get_status() ) === true ) { + $response['totals']['items']['not_restrict'] += isset($total_items->publish) ? intval($total_items->publish) : 0; + } else { + $response['totals']['items']['restrict'] += ( + //(isset($total_items->trash) ? intval($total_items->trash) : 0) + + (isset($total_items->draft) ? intval($total_items->draft) : 0) + + (isset($total_items->publish) ? intval($total_items->publish) : 0) + + (isset($total_items->private) ? intval($total_items->private) : 0) + ); } } wp_reset_postdata(); @@ -376,19 +397,13 @@ class REST_Reports_Controller extends REST_Controller { ); $total_taxonomies = wp_count_posts( 'tainacan-taxonomy', 'readable' ); - if (isset($total_taxonomies->publish) || - isset($total_taxonomies->private) || - isset($total_taxonomies->trash) || - isset($total_taxonomies->draft)) { - - $response['totals']['taxonomies']['trash'] = intval($total_taxonomies->trash); - $response['totals']['taxonomies']['publish'] = intval($total_taxonomies->publish); - $response['totals']['taxonomies']['draft'] = intval($total_taxonomies->draft); - $response['totals']['taxonomies']['private'] = intval($total_taxonomies->private); - $response['totals']['taxonomies']['total'] = $response['totals']['taxonomies']['trash'] + $response['totals']['taxonomies']['publish'] + $response['totals']['taxonomies']['draft'] + $response['totals']['taxonomies']['private']; - $response['totals']['taxonomies']['used'] = $this->query_count_used_taxononomies(); - $response['totals']['taxonomies']['not_used'] = $response['totals']['taxonomies']['total'] - $response['totals']['taxonomies']['used']; - } + $response['totals']['taxonomies']['trash'] = isset($total_taxonomies->trash) ? intval($total_taxonomies->trash) : 0; + $response['totals']['taxonomies']['draft'] = isset($total_taxonomies->draft) ? intval($total_taxonomies->draft) : 0; + $response['totals']['taxonomies']['publish'] = isset($total_taxonomies->publish)? intval($total_taxonomies->publish) : 0; + $response['totals']['taxonomies']['private'] = isset($total_taxonomies->private)? intval($total_taxonomies->private) : 0; + $response['totals']['taxonomies']['total'] = $response['totals']['taxonomies']['trash'] + $response['totals']['taxonomies']['publish'] + $response['totals']['taxonomies']['draft'] + $response['totals']['taxonomies']['private']; + $response['totals']['taxonomies']['used'] = $this->query_count_used_taxononomies(); + $response['totals']['taxonomies']['not_used'] = $response['totals']['taxonomies']['total'] - $response['totals']['taxonomies']['used']; } $response['totals']['items']['total'] = ($response['totals']['items']['trash'] + $response['totals']['items']['draft'] + $response['totals']['items']['publish'] + $response['totals']['items']['private']); $this->set_cache_object($key_cache_object, $response); @@ -550,10 +565,22 @@ class REST_Reports_Controller extends REST_Controller { } $response['totals']['metadata'][$metadatum->get_status()]++; - $response['totals']['metadata_per_type'][$meta_type]['name'] = $meta_type_name; + if ( !isset($response['totals']['metadata_per_type'][$meta_type]) ) { + $response['totals']['metadata_per_type'][$meta_type] = array( + 'name' => $meta_type_name, + 'count' => 0, + ); + } $response['totals']['metadata_per_type'][$meta_type]['count']++; - $meta_ids[] = $metadatum->get_id(); + if ( $metadatum->get_metadata_type() == 'Tainacan\Metadata_Types\Compound' ) { + $metadatum_childs = $this->metadatum_repository->fetch(['parent' => $metadatum->get_id()], 'OBJECT'); + foreach($metadatum_childs as $childs) { + $meta_ids[] = $childs->get_id(); + } + } else { + $meta_ids[] = $metadatum->get_id(); + } } $response['distribution'] = $this->query_item_metadata_distribution($meta_ids, $collection->get_db_identifier()); //wp_count_posts() @@ -604,9 +631,11 @@ class REST_Reports_Controller extends REST_Controller { global $wpdb; $string_meta_ids = "'".implode("','", $meta_ids)."'"; $sql_statement = $wpdb->prepare( - "SELECT p.post_title AS 'name', p.id AS id, IFNULL(((m.total/$total_items) * 100), 0) as fill_percentage + "SELECT p.post_title AS 'name', pp.post_title AS 'parent_name', p.id AS id, IFNULL(((m.total/$total_items) * 100), 0) as fill_percentage FROM - $wpdb->posts p LEFT JOIN + $wpdb->posts p + LEFT JOIN $wpdb->posts pp ON (p.post_parent = pp.id) + LEFT JOIN ( SELECT meta_key, count(DISTINCT post_id) AS total FROM $wpdb->postmeta @@ -636,7 +665,7 @@ class REST_Reports_Controller extends REST_Controller { ) m ON (p.id = m.meta_key) WHERE p.id IN($string_meta_ids) - " + ", [] ); $res = $wpdb->get_results($sql_statement); //return ['t' => $res, 's' => $sql_statement]; @@ -649,7 +678,7 @@ class REST_Reports_Controller extends REST_Controller { "SELECT COUNT(DISTINCT($wpdb->postmeta.meta_value)) FROM $wpdb->postmeta WHERE meta_key = '_option_taxonomy_id' - " + ", [] ); $res = intval($wpdb->get_var( $sql_statement )); @@ -717,7 +746,7 @@ class REST_Reports_Controller extends REST_Controller { FROM $wpdb->posts p $collection_from WHERE p.post_type='tainacan-log' AND p.post_date BETWEEN '$start' AND '$end' GROUP BY DATE(p.post_date) - ORDER BY DATE(p.post_date)" + ORDER BY DATE(p.post_date)", [] ); return $wpdb->get_results($sql_statement); } @@ -735,7 +764,7 @@ class REST_Reports_Controller extends REST_Controller { FROM $wpdb->posts p $collection_from WHERE p.post_type='tainacan-log' AND p.post_date BETWEEN '$start' AND '$end' GROUP BY p.post_author, DATE(p.post_date) - ORDER BY DATE(p.post_date)" + ORDER BY DATE(p.post_date)", [] ); $data =$wpdb->get_results($sql_statement); $arr = array(); @@ -781,7 +810,7 @@ class REST_Reports_Controller extends REST_Controller { $collection_from WHERE p.post_type='tainacan-log' GROUP BY p.post_author, pm.meta_value - ORDER BY total DESC" + ORDER BY total DESC", [] ); $results = $wpdb->get_results($sql_statement); $response = []; diff --git a/src/classes/class-tainacan-embed.php b/src/classes/class-tainacan-embed.php index da65db0d5..055518c11 100644 --- a/src/classes/class-tainacan-embed.php +++ b/src/classes/class-tainacan-embed.php @@ -12,6 +12,19 @@ class Embed { return self::$instance; } + + private static $aspect_ratios = array( + // Common video resolutions. + array("ratio" => '2.33', "className" => 'tainacan-embed-aspect-21-9'), + array("ratio" => '2.00', "className" => 'tainacan-embed-aspect-18-9'), + array("ratio" => '1.78', "className" => 'tainacan-embed-aspect-16-9'), + array("ratio" => '1.33', "className" => 'tainacan-embed-aspect-4-3'), + // Vertical video and instagram square video support. + array("ratio" => '1.00', "className" => 'tainacan-embed-aspect-1-1' ), + array("ratio" => '0.75', "className" => 'tainacan-embed-aspect-3-4'), + array("ratio" => '0.56', "className" => 'tainacan-embed-aspect-9-16'), + array("ratio" => '0.50', "className" => 'tainacan-embed-aspect-1-2' ) + ); protected function __construct() { @@ -24,7 +37,7 @@ class Embed { /** * Add responsiveness to embeds */ - add_filter('embed_oembed_html', [$this, 'responsive_embed'], 10, 3); + add_filter( 'embed_oembed_html', [$this, 'responsive_embed'], 10, 3); add_action( 'admin_enqueue_scripts', array( &$this, 'add_css' ) ); add_action( 'wp_enqueue_scripts', array( &$this, 'add_css' ) ); @@ -74,7 +87,7 @@ class Embed { ); $args = array_merge($attr, $defaults); - + $dimensions = ''; if ( ! empty( $args['width'] ) && ! empty( $args['height'] ) ) { $dimensions .= sprintf( "width='%s' ", $args['width'] ); @@ -109,7 +122,6 @@ class Embed { } - /** * Responsiveness */ @@ -117,6 +129,69 @@ class Embed { global $TAINACAN_BASE_URL; wp_enqueue_style( 'tainacan-embeds', $TAINACAN_BASE_URL . '/assets/css/tainacan-embeds.css', [], TAINACAN_VERSION ); } + + /** + * Get responsive class based on aspect ratio + * This code is heavily inspired by Gutenberg plugin's "getClassNames" function. + * Check their source code for more details: /packages/block-library/src/embed/util.js + * + * @param {string} html The preview HTML that possibly contains an iframe with width and height set. + * @param {string} existingClassNames Any existing class names. + * @return {string} Deduped class names. + */ + public function add_responsive_wrapper( $html, $existingClassNames = '' ) { + + $height = false; + $width = false; + + $dom = new \DOMDocument(); + $dom->loadHTML($html); + + // If we have a fixed aspect iframe, and it's a responsive embed content. + if ($dom) { + $externalContentElement = $dom->getElementsByTagName('iframe'); + + if (!$externalContentElement) + $externalContentElement = $dom->getElementsByTagName('embed'); + + if (!$externalContentElement) + $externalContentElement = $dom->getElementsByTagName('object'); + + if ($externalContentElement) { + foreach($externalContentElement as $element) { + foreach($element->attributes as $attribute) { + if ($attribute->nodeName == 'width') + $width = $attribute->nodeValue; + if ($attribute->nodeName == 'height') + $height = $attribute->nodeValue; + + if ($attribute->nodeName == 'class' && $attribute->nodeValue == 'wp-embedded-content') { + $height = false; + $width = false; + break; + } + } + } + } + + if ( $height && $width ) { + $aspect_ratio = number_format(( $width / $height ), 2, '.', ""); + + // Given the actual aspect ratio, find the widest ratio to support it. + for ($ratioIndex = 0; $ratioIndex < count(self::$aspect_ratios); $ratioIndex++) { + + $potentialRatio = self::$aspect_ratios[ $ratioIndex ]; + if ( $aspect_ratio >= $potentialRatio['ratio'] ) { + $class = $potentialRatio['className'] . ' tainacan-content-embed tainacan-has-aspect-ratio'; + return '
' . $html . '
'; + } + } + } + } + + return $html; + } + /** * Adds a responsive embed wrapper around oEmbed content * @param string $html The oEmbed markup @@ -126,12 +201,9 @@ class Embed { */ function responsive_embed($html, $url, $attr) { - $class = 'tainacan-embed-container'; + $element = $this->add_responsive_wrapper($html); - if ( !preg_match('/(?:]*)(?:(?:\/>)|(?:>.*?<\/iframe>))/i', $html ) && !preg_match('/(?:]*)(?:(?:\/>)|(?:>.*?<\/object>))/i', $html) && !preg_match('/(?:]*)(?:(?:\/>)|(?:>.*?<\/embed>))/i', $html ) ) - $class .= ' tainacan-embed-without-iframe'; - - return $html !== '' ? '
'.$html.'
' : ''; + return $element; } } \ No newline at end of file diff --git a/src/classes/class-tainacan-media.php b/src/classes/class-tainacan-media.php index f80f19316..72ba499a8 100644 --- a/src/classes/class-tainacan-media.php +++ b/src/classes/class-tainacan-media.php @@ -103,7 +103,6 @@ class Media { * @return string the file path */ public function save_remote_file($url) { - set_time_limit(0); $filename = tempnam(sys_get_temp_dir(), basename($url)); @@ -134,7 +133,7 @@ class Media { # Assign a callback function to the CURL Write-Function curl_setopt($ch, CURLOPT_WRITEFUNCTION, $callback); - # Exceute the download - note we DO NOT put the result into a variable! + # Execute the download - note we DO NOT put the result into a variable! curl_exec($ch); if (curl_errno($ch)) { $error_msg = curl_error($ch); diff --git a/src/classes/entities/class-tainacan-item-metadata-entity.php b/src/classes/entities/class-tainacan-item-metadata-entity.php index 9c87479d9..83b3b89df 100644 --- a/src/classes/entities/class-tainacan-item-metadata-entity.php +++ b/src/classes/entities/class-tainacan-item-metadata-entity.php @@ -414,7 +414,7 @@ class Item_Metadata_Entity extends Entity { return $this->has_value; $value = $this->get_value(); - $this->has_value = (is_array($value)) ? !empty(array_filter($value)) : !empty($value); + $this->has_value = (is_array($value)) ? !empty(array_filter($value)) : (is_numeric($value) || !empty($value)); return $this->has_value; } diff --git a/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php b/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php index 62eb39b8e..28554df36 100644 --- a/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php +++ b/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php @@ -278,7 +278,8 @@ class Bulk_Edit_Process extends Generic_Process { private function clear_value(\Tainacan\Entities\Item $item) { $metadatum = $this->metadatum_repository->fetch($this->bulk_edit_data['metadatum_id']); - $item_metadata = new Entities\Item_Metadata_Entity( $item, $metadatum ); + $parent_meta_id = $this->get_parent_meta_id($item, $metadatum); + $item_metadata = new Entities\Item_Metadata_Entity( $item, $metadatum, null, $parent_meta_id ); $item_metadata->set_value(""); return $this->save_item_metadata($item_metadata, $item); } @@ -286,8 +287,9 @@ class Bulk_Edit_Process extends Generic_Process { private function set_value(\Tainacan\Entities\Item $item) { $metadatum = $this->metadatum_repository->fetch($this->bulk_edit_data['metadatum_id']); $value = $this->bulk_edit_data['value']; + $parent_meta_id = $this->get_parent_meta_id($item, $metadatum); - $item_metadata = new Entities\Item_Metadata_Entity( $item, $metadatum ); + $item_metadata = new Entities\Item_Metadata_Entity( $item, $metadatum, null, $parent_meta_id ); if($item_metadata->is_multiple()) { $value = is_array( $value ) ? $value : [$value]; @@ -300,6 +302,22 @@ class Bulk_Edit_Process extends Generic_Process { } + private function get_parent_meta_id($item, $metadatum) { + $metadatum_parent_id = $metadatum->get_parent(); + if ($metadatum_parent_id > 0) { + $metadatum_parent = $this->metadatum_repository->fetch($metadatum_parent_id); + $compoundItem = new Entities\Item_Metadata_Entity($item, $metadatum_parent); + $unique = !$compoundItem->is_multiple(); + $compoundValue = $compoundItem->get_value(); + if ( $unique && !empty($compoundValue) ) { + $key = array_keys($compoundValue)[0]; // get the first metadata ID, if the argument metadata does not exist + $parent_meta_id = $compoundValue[$key]->get_parent_meta_id(); + return $parent_meta_id; + } // elseif ((is_array($compoundValue) && sizeof($compoundValue) > 0)) + } + return null; + } + private function add_value(\Tainacan\Entities\Item $item) { $metadatum_id = $this->bulk_edit_data['metadatum_id']; $metadatum = $this->metadatum_repository->fetch($metadatum_id); diff --git a/src/classes/generic-background-process/class-tainacan-generic-handler.php b/src/classes/generic-background-process/class-tainacan-generic-handler.php index 8a3fcf704..829c27eea 100644 --- a/src/classes/generic-background-process/class-tainacan-generic-handler.php +++ b/src/classes/generic-background-process/class-tainacan-generic-handler.php @@ -38,7 +38,7 @@ class Generic_Process_Handler { $data = $process_object->_to_Array(true); $process = $this->get_generic_process_by_object($process_object); - $process_name = sprintf( __('%s process', 'tainacan'), $process['name'] ); + $process_name = sprintf( __('%s processing', 'tainacan'), $process['name'] ); $bg_process = $this->bg_process->data($data)->set_name($process_name)->save(); if ( is_wp_error($bg_process->dispatch()) ) { diff --git a/src/classes/importer/class-tainacan-csv.php b/src/classes/importer/class-tainacan-csv.php index f767d2dba..2a39bf8df 100644 --- a/src/classes/importer/class-tainacan-csv.php +++ b/src/classes/importer/class-tainacan-csv.php @@ -36,13 +36,15 @@ class CSV extends Importer { } $columns = []; - - if( $rawColumns ) { + if ($rawColumns) { foreach( $rawColumns as $index => $rawColumn ) { if( strpos($rawColumn,'special_') === 0 ) { if( $rawColumn === 'special_document' ) { $this->set_option('document_index', $index); - } else if( $rawColumn === 'special_attachments' || + } else if ($rawColumn === 'special_document|REPLACE') { + $this->set_option('document_import_mode', 'replace'); + $this->set_option('document_index', $index); + } else if( $rawColumn === 'special_attachments' || $rawColumn === 'special_attachments|APPEND' || $rawColumn === 'special_attachments|REPLACE' ) { $this->set_option('attachment_index', $index); @@ -84,7 +86,7 @@ class CSV extends Importer { if( $rawColumns ) { foreach( $rawColumns as $index => $rawColumn ) { if( strpos($rawColumn,'special_') === 0 ) { - if( in_array( $rawColumn, ['special_document', 'special_attachments', 'special_item_status', 'special_item_id', 'special_comment_status', 'special_attachments|APPEND', 'special_attachments|REPLACE'] ) ) { + if( in_array( $rawColumn, ['special_document', 'special_attachments', 'special_item_status', 'special_item_id', 'special_comment_status', 'special_attachments|APPEND', 'special_attachments|REPLACE', 'special_document|REPLACE'] ) ) { $columns[] = $rawColumn; } } @@ -197,8 +199,10 @@ class CSV extends Importer { $returnValue = []; foreach($valueToInsert as $index => $metadatumValue) { $childrenHeaders = str_getcsv($compoundHeaders[$key], $this->get_option('delimiter'), $this->get_option('enclosure')); - $childrenValue = str_getcsv($metadatumValue, $this->get_option('delimiter'), $this->get_option('enclosure')); - + $childrenValue = $this->is_clear_value($metadatumValue) ? + array_fill(0, sizeof($childrenHeaders), $this->get_option('escape_empty_value') ) : + str_getcsv($metadatumValue, $this->get_option('delimiter'), $this->get_option('enclosure')); + if ( sizeof($childrenHeaders) != sizeof($childrenValue) ) { $this->add_error_log('Mismatch count headers childrens and row columns. file value:' . $metadatumValue); return false; @@ -514,7 +518,14 @@ class CSV extends Importer { } } else if( strpos($column_value,'file:') === 0 ) { $correct_value = trim(substr($column_value, 5)); - if( isset(parse_url($correct_value)['scheme'] ) ) { + //removing the old document attachment + if ($this->get_option('document_import_mode') === 'replace' && $item_inserted->get_document_type() == 'attachment' ) { + $this->add_log('Item Document will be replaced ... '); + wp_delete_attachment($item_inserted->get_document(), true); + $this->add_log('Deleted previous Item Documents ... '); + } + + if (isset(parse_url($correct_value)['scheme'] )) { $id = $TainacanMedia->insert_attachment_from_url($correct_value, $item_inserted->get_id()); if(!$id){ @@ -571,15 +582,7 @@ class CSV extends Importer { break; case 'REPLACE': $this->add_log('Attachment REPLACE file '); - $args['post_parent'] = $item_inserted->get_id(); - $args['post_type'] = 'attachment'; - $args['post_status'] = 'any'; - $args['post__not_in'] = [$item_inserted->get_document()]; - $posts_query = new \WP_Query(); - $query_result = $posts_query->query( $args ); - foreach ( $query_result as $post ) { - wp_delete_attachment( $post->ID, true ); - } + $this->delete_previous_document_imgs($item_inserted->get_id(), $item_inserted->get_document()); break; } @@ -624,10 +627,10 @@ class CSV extends Importer { $line = substr($line, $cut_start); } - $end = substr($line, ( strlen($line) - strlen($this->get_option('enclosure')) ) , strlen($this->get_option('enclosure'))); + $end = substr($line, ( strlen($line) - strlen($this->get_option('enclosure')) ) , strlen($this->get_option('enclosure'))); if( $this->get_option('enclosure') === $end ) { - $line = substr($line, 0, ( strlen($line) - strlen($this->get_option('enclosure')) ) ); + $line = substr($line, 0, ( strlen($line) - strlen($this->get_option('enclosure')) ) ); } $delimiter = $this->get_option('enclosure').$this->get_option('delimiter').$this->get_option('enclosure'); @@ -681,7 +684,7 @@ class CSV extends Importer { * its value or values * @param integer $collection_index The index in the $this->collections array of the collection the item is being inserted into * - * @return Tainacan\Entities\Item Item inserted + * @return bool|Tainacan\Entities\Item Item inserted */ public function insert( $processed_item, $collection_index ) { remove_action( 'post_updated', 'wp_save_post_revision' ); @@ -790,7 +793,12 @@ class CSV extends Importer { foreach($children_mapping as $tainacan_children_metadatum_id => $tainacan_children_header) { $metadatumChildren = $Tainacan_Metadata->fetch( $tainacan_children_metadatum_id, 'OBJECT' ); $compoundItemMetadata = new Entities\Item_Metadata_Entity( $item, $metadatumChildren); - $compoundItemMetadata->set_value($compoundValue[$tainacan_children_header]); + $childrenCompoundvalue = $compoundValue[$tainacan_children_header]; + if ($this->is_clear_value($childrenCompoundvalue)) { + $compoundItemMetadata->set_value(""); + } else { + $compoundItemMetadata->set_value($childrenCompoundvalue); + } $tmp[] = $compoundItemMetadata; } $singleItemMetadata[] = $tmp; @@ -877,12 +885,18 @@ class CSV extends Importer { } } + private function is_assoc(array $arr) { + if (array() === $arr) return false; + return array_keys($arr) !== range(0, count($arr) - 1); + } + private function deleteAllValuesCompoundItemMetadata($item, $compoundMetadataID) { $Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance(); $Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance(); $compound_metadata = $Tainacan_Metadata->fetch($compoundMetadataID, 'OBJECT'); $compound_item_metadata = new Entities\Item_Metadata_Entity($item, $compound_metadata); $compound_item_metadata_value = $compound_item_metadata->get_value(); + $compound_item_metadata_value = $this->is_assoc($compound_item_metadata_value) ? [$compound_item_metadata_value] : $compound_item_metadata_value; foreach($compound_item_metadata_value as $item_metadata_value) { foreach ($item_metadata_value as $itemMetadata) { $Tainacan_Item_Metadata->remove_compound_value($item, $compound_metadata, $itemMetadata->get_parent_meta_id()); @@ -916,10 +930,9 @@ class CSV extends Importer { * @param $metadatum the metadata * @param $values the categories names * - * @return array empty with no category or array with IDs + * @return bool|array empty with no category or array with IDs */ - private function insert_hierarchy( $metadatum, $values ){ - + private function insert_hierarchy( $metadatum, $values ) { if (empty($values)) { return false; } @@ -982,14 +995,13 @@ class CSV extends Importer { /** * @param $collection_id * - * @return array/bool false if has no mapping or associated array with metadata id and header + * @return array|bool false if has no mapping or associated array with metadata id and header */ public function get_mapping( $collection_id ){ $mapping = get_post_meta( $collection_id, 'metadata_mapping', true ); - return ( $mapping ) ? $mapping : false; + return $mapping ?: false; } - /** * @inheritdoc * @@ -1081,4 +1093,19 @@ class CSV extends Importer { return $message; } + private function delete_previous_document_imgs($item_id, $item_document) { + $previous_imgs = [ + 'post_parent' => $item_id, + 'post_type' => 'attachment', + 'post_status' => 'any', + 'post__not_in' => [$item_document] + ]; + $posts_query = new \WP_Query(); + $attachs = $posts_query->query($previous_imgs); + foreach ($attachs as $att) { + $this->add_log( "Deleting attachment [". $att->ID . "] " . $att->post_title); + wp_delete_attachment($att->ID, true); + } + } + } diff --git a/src/classes/importer/class-tainacan-importer-handler.php b/src/classes/importer/class-tainacan-importer-handler.php index 250293c0a..33767e069 100644 --- a/src/classes/importer/class-tainacan-importer-handler.php +++ b/src/classes/importer/class-tainacan-importer-handler.php @@ -44,7 +44,7 @@ class Importer_Handler { $this->register_importer([ 'name' => 'Vocabulary CSV', - 'description' => __('Import a vaculary from a CSV file into a taxonomy', 'tainacan'), + 'description' => __('Import a vocabulary from a CSV file into a taxonomy', 'tainacan'), 'slug' => 'terms', 'class_name' => '\Tainacan\Importer\Term_Importer', 'manual_collection' => false, diff --git a/src/classes/importer/class-tainacan-importer.php b/src/classes/importer/class-tainacan-importer.php index 02aaaf2ae..8112ddaee 100644 --- a/src/classes/importer/class-tainacan-importer.php +++ b/src/classes/importer/class-tainacan-importer.php @@ -59,7 +59,7 @@ abstract class Importer { private $options = []; /** - * Stores the default options for the importer options + * Stores default options for importer options * @var array */ protected $default_options = []; @@ -114,7 +114,7 @@ abstract class Importer { private $error_log = []; /** - * Wether to abort importer execution. + * Whether to abort importer execution. * @var bool */ private $abort = false; @@ -137,7 +137,6 @@ abstract class Importer { ]; public function __construct($attributess = array()) { - $this->id = uniqid(); $author = get_current_user_id(); @@ -153,8 +152,6 @@ abstract class Importer { } } } - - } public function _to_Array($short = false) { @@ -193,8 +190,7 @@ abstract class Importer { * @param $url string * @return bool */ - public function set_url($url) - { + public function set_url($url) { if(!empty($url) && !is_array($url)) { $this->url = rtrim(trim($url), "/"); @@ -207,8 +203,7 @@ abstract class Importer { /** * @return string or bool */ - public function get_url() - { + public function get_url() { if(!empty($this->url)) { return $this->url; @@ -293,7 +288,6 @@ abstract class Importer { $this->default_options = $options; } - public function set_steps($steps) { $this->steps = $steps; } @@ -302,7 +296,6 @@ abstract class Importer { return $this->steps; } - private function get_transients() { return $this->transients; } @@ -559,7 +552,6 @@ abstract class Importer { $step = $steps[$current_step]; if ($step['callback'] == 'process_collections') { - $totalItems = 0; $currentItem = $this->get_current_collection_item(); $current_collection = $this->get_current_collection(); @@ -577,18 +569,12 @@ abstract class Importer { if ($totalItems > 0) { $value = round( ($currentItem/$totalItems) * 100 ); } - - } else { - if ( isset($step['total']) && is_numeric($step['total']) && $step['total'] > 0 ) { $current = $this->get_in_step_count(); $value = round( ($current/$step['total']) * 100 ); } - } - - } return $value; } diff --git a/src/classes/importer/class-tainacan-oaipmh-importer.php b/src/classes/importer/class-tainacan-oaipmh-importer.php index d9db9e3ab..f0a61eee8 100644 --- a/src/classes/importer/class-tainacan-oaipmh-importer.php +++ b/src/classes/importer/class-tainacan-oaipmh-importer.php @@ -5,872 +5,868 @@ use Tainacan\Entities; class Oaipmh_Importer extends Importer { - protected $steps = [ - [ - 'name' => 'Create Collections', - 'progress_label' => 'Create Collections', - 'callback' => 'create_collections' - ], - [ - 'name' => 'Import Items', - 'progress_label' => 'Import Items', - 'callback' => 'process_collections', - 'total' => 2 - ], - ]; - - protected $NAME_FOR_SETS = 'Sets'; - protected $tainacan_api_address, $wordpress_api_address, $actual_collection; - protected $has_sets = true; - protected $items_per_page = 100; - - /** - * tainacan old importer construct - */ - public function __construct($attributes = array()) { - parent::__construct($attributes); - $this->set_default_options([ - 'delimiter' => ',' - ]); - - $this->col_repo = \Tainacan\Repositories\Collections::get_instance(); - $this->items_repo = \Tainacan\Repositories\Items::get_instance(); - $this->metadata_repo = \Tainacan\Repositories\Metadata::get_instance(); - $this->item_metadata_repo = \Tainacan\Repositories\Item_Metadata::get_instance(); - $this->tax_repo = \Tainacan\Repositories\Taxonomies::get_instance(); - $this->term_repo = \Tainacan\Repositories\Terms::get_instance(); - - $this->remove_import_method('file'); - $this->add_import_method('url'); - - } - - /** - * Method implemented by the child importer class to proccess each item - * @return int - */ - public function process_item( $index, $collection_id ){ - $this->add_log('Proccess item index' . $index . ' in set ' . $collection_id['source_id'] ); - $records = [ 'records' => [] , 'collection_definition' => $collection_id ]; - $record_processed = []; - - if( $index === 0 ){ - - if( $collection_id['source_id'] !== 'sets' && $this->has_sets ){ - $info = $this->requester( $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc&set=" . $collection_id['source_id'] ); - $this->add_log('fetching ' . $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc&set=" . $collection_id['source_id']); - } else { - $info = $this->requester( $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc" ); - $this->add_log('fetching ' . $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc"); - } - - } else { - $token = $this->get_transient('resumptionToken'); - $info = $this->requester( $this->get_url() . "?verb=ListRecords&resumptionToken=" . $token); - $this->add_log('fetching ' . $this->get_url() . "?verb=ListRecords&resumptionToken=" . $token); - } - - if( !isset($info['body']) ){ - $this->add_log('no answer'); - return false; - } - - - try { - $xml = new \SimpleXMLElement($info['body']); - - if ( isset($xml->ListRecords) && isset($xml->ListRecords->resumptionToken) ){ - - $resumptionToken = $xml->ListRecords->resumptionToken; - if ($resumptionToken) { - $this->add_transient('resumptionToken',(string) $resumptionToken); - } - - // if there is no total in resumption token and exists cursor - // it will change dynamic the total of items - - $resumptionToken_attributes = $xml->ListRecords->resumptionToken->attributes(); - $real_total = $this->get_transient('total_general'); - - foreach ($resumptionToken_attributes as $tag => $attribute) { - - if ( $tag == 'cursor' && $real_total == ( (string) $attribute ) && !$this->hasCompleteSize( $resumptionToken_attributes ) ) { - - $real_total = $real_total + intval($this->get_transient('items_per_page')); - $this->add_transient('total_general', $real_total); - - $total = ( $this->get_transient('change_total') ) ? $this->get_transient('change_total') : 1; - - $this->add_transient('change_total', $total + 1); - break; - } - } - } - - } catch (Exception $e) { - $this->add_log('error on read xml and get '); - return false; - } - - if( $xml->ListRecords ){ - $j = 0; - - while ( isset($xml->ListRecords->record[$j]) ) { - $record = $record = $xml->ListRecords->record[$j]; - $dc = $record->metadata->children("http://www.openarchives.org/OAI/2.0/oai_dc/"); - $header = $record->header; - - $is_inserted = $this->get_transient($header->identifier); - if( $is_inserted ){ - continue; - } - - if( $this->get_option('using_set') == 'taxonomy' && ( isset($header) && isset($header->setSpec) ) ){ - foreach ($header->setSpec as $item ) { - $record_processed['sets'][] = (string) $item; - } - } - - if ($record->metadata->Count() > 0 ) { - $metadata = $dc->children('http://purl.org/dc/elements/1.1/'); - $tam_metadata = count($metadata); - for ($i = 0; $i < $tam_metadata; $i++) { - - $value = (string) $metadata[$i]; - $identifier = $this->get_identifier($metadata[$i]); - $record_processed['dc:' . $identifier ][] = $value; + protected $steps = [ + [ + 'name' => 'Create Collections', + 'progress_label' => 'Create Collections', + 'callback' => 'create_collections' + ], + [ + 'name' => 'Import Items', + 'progress_label' => 'Import Items', + 'callback' => 'process_collections', + 'total' => 2 + ], + ]; + + protected $NAME_FOR_SETS = 'Sets'; + protected $tainacan_api_address, $wordpress_api_address, $actual_collection; + protected $has_sets = true; + protected $items_per_page = 100; + + /** + * tainacan old importer construct + */ + public function __construct($attributes = array()) { + parent::__construct($attributes); + $this->set_default_options([ + 'delimiter' => ',' + ]); + + $this->col_repo = \Tainacan\Repositories\Collections::get_instance(); + $this->items_repo = \Tainacan\Repositories\Items::get_instance(); + $this->metadata_repo = \Tainacan\Repositories\Metadata::get_instance(); + $this->item_metadata_repo = \Tainacan\Repositories\Item_Metadata::get_instance(); + $this->tax_repo = \Tainacan\Repositories\Taxonomies::get_instance(); + $this->term_repo = \Tainacan\Repositories\Terms::get_instance(); + + $this->remove_import_method('file'); + $this->add_import_method('url'); + } + + /** + * Method implemented by child importer class to proccess each item + * @return int + */ + public function process_item( $index, $collection_id ){ + $this->add_log('Proccess item index' . $index . ' in set ' . $collection_id['source_id'] ); + $records = [ 'records' => [] , 'collection_definition' => $collection_id ]; + $record_processed = []; + + if ($index === 0) { + if( $collection_id['source_id'] !== 'sets' && $this->has_sets ){ + $info = $this->requester( $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc&set=" . $collection_id['source_id'] ); + $this->add_log('fetching ' . $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc&set=" . $collection_id['source_id']); + } else { + $info = $this->requester( $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc" ); + $this->add_log('fetching ' . $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc"); + } + } else { + $token = $this->get_transient('resumptionToken'); + $info = $this->requester( $this->get_url() . "?verb=ListRecords&resumptionToken=" . $token); + $this->add_log('fetching ' . $this->get_url() . "?verb=ListRecords&resumptionToken=" . $token); + } + + if (!isset($info['body'])) { + $this->add_log('no answer'); + return false; + } + + try { + $xml = new \SimpleXMLElement($info['body']); + + if ( isset($xml->ListRecords) && isset($xml->ListRecords->resumptionToken) ){ + + $resumptionToken = $xml->ListRecords->resumptionToken; + if ($resumptionToken) { + $this->add_transient('resumptionToken',(string) $resumptionToken); + } + + // if there is no total in resumption token and exists cursor + // it will change dynamic the total of items + + $resumptionToken_attributes = $xml->ListRecords->resumptionToken->attributes(); + $real_total = $this->get_transient('total_general'); + + foreach ($resumptionToken_attributes as $tag => $attribute) { + + if ( $tag == 'cursor' && $real_total == ( (string) $attribute ) && !$this->hasCompleteSize( $resumptionToken_attributes ) ) { + + $real_total = $real_total + intval($this->get_transient('items_per_page')); + $this->add_transient('total_general', $real_total); + + $total = ( $this->get_transient('change_total') ) ? $this->get_transient('change_total') : 1; + + $this->add_transient('change_total', $total + 1); + break; + } + } + } + + } catch (Exception $e) { + $this->add_log('error on read xml and get '); + return false; + } + + if( $xml->ListRecords ){ + $j = 0; + + while ( isset($xml->ListRecords->record[$j]) ) { + $record = $record = $xml->ListRecords->record[$j]; + $dc = $record->metadata->children("http://www.openarchives.org/OAI/2.0/oai_dc/"); + $header = $record->header; + + $is_inserted = $this->get_transient($header->identifier); + if( $is_inserted ){ + continue; + } + + if( $this->get_option('using_set') == 'taxonomy' && ( isset($header) && isset($header->setSpec) ) ){ + foreach ($header->setSpec as $item ) { + $record_processed['sets'][] = (string) $item; + } + } + + if ($record->metadata->Count() > 0 ) { + $metadata = $dc->children('http://purl.org/dc/elements/1.1/'); + $tam_metadata = count($metadata); + for ($i = 0; $i < $tam_metadata; $i++) { + + $value = (string) $metadata[$i]; + $identifier = $this->get_identifier($metadata[$i]); + $record_processed['dc:' . $identifier ][] = $value; + + } + } + + if( $record_processed ){ + $records['records'][] = $record_processed; + $record_processed = []; + } + + $j++; + } + } + + if( $records['records'] ){ + return $records; + } else { + $this->add_log('proccessing an item empty or xml not found'); + return false; + } + } + + /** + * create all collections and its metadata + * + */ + public function create_collections(){ + + $this->add_log('Creating collections'); + $collection_xml = $this->fetch_collections(); + + if( $collection_xml ){ + + if( !$this->get_option('using_set') || $this->get_option('using_set') == 'collection' ){ + + foreach ($collection_xml as $set ) { - } - } - - if( $record_processed ){ - $records['records'][] = $record_processed; - $record_processed = []; - } - - $j++; - } - } - - if( $records['records'] ){ - return $records; - } else { - $this->add_log('proccessing an item empty or xml not found'); - return false; - } - } - - /** - * create all collections and its metadata - * - */ - public function create_collections(){ - - $this->add_log('Creating collections'); - $collection_xml = $this->fetch_collections(); - - if( $collection_xml ){ - - if( !$this->get_option('using_set') || $this->get_option('using_set') == 'collection' ){ - - foreach ($collection_xml as $set ) { - - $setSpec = (string) $set->setSpec; - $setName = (string) $set->setName; - - $collection = $this->create_collection( $setSpec, $setName ); - - $metadata_map = $this->create_collection_metadata($collection); - $total = intval($this->get_total_items_from_source($setSpec)); - $this->add_log('total in collection: ' . $total); - $this->add_log('collection id ' . (string) $collection->get_id()); - - $this->add_collection([ - 'id' => $collection->get_id(), - 'mapping' => $metadata_map, - 'total_items' => ceil( $total / $this->items_per_page ), - 'source_id' => $setSpec, - ]); - } - } else if( $this->get_option('using_set') == 'taxonomy') { - - $collection = $this->create_collection( 'set', $this->getRepoName() ); - $metadata_map = $this->create_collection_metadata($collection); - $total = intval( $this->get_total_items_from_source(false) ); - $this->add_log('total in collection: ' . $total); - $this->add_log('collection id ' . (string) $collection->get_id()); - - $tax = new Entities\Taxonomy(); - $tax->set_name( $this->NAME_FOR_SETS ); - $tax->set_allow_insert('yes'); - $tax->set_status('publish'); - - if ($tax->validate()) { - - $is_tax_created = $this->get_transient('set_taxonomy_id'); - if( $is_tax_created ){ - $tax = new Entities\Taxonomy( $is_tax_created ); - } else { - $tax = $this->tax_repo->insert($tax); - $this->add_transient('set_taxonomy_id', $tax->get_id()); - } - - $metadatum_set_id = $this->create_set_metadata( $collection->get_id(), $tax->get_id() ); - - if( $metadatum_set_id ){ - $this->add_transient('set_metadatum_id', $metadatum_set_id); - - $this->add_collection([ - 'id' => $collection->get_id(), - 'mapping' => $metadata_map, - 'total_items' =>ceil( $total / $this->items_per_page ), - 'source_id' => 'sets', - 'metadatum_id' => $metadatum_set_id - ]); - } - - $this->add_log('Taxonomy ' . $tax->get_name() . ' created' ); - - foreach ($collection_xml as $set) { - - $setSpec = (string)$set->setSpec; - $setName = (string)$set->setName; - - $this->createTerms( $tax, $setName, $setSpec ); - } - - } else { - $this->add_log('Error creating taxonomy Sets' ); - $this->add_log($tax->get_errors()); - - } - - } - - } - // if there is no set - else { - $collection = $this->create_collection( 'set', $this->getRepoName() ); - $metadata_map = $this->create_collection_metadata($collection); - $total = intval( $this->get_total_items_from_source(false) ); - $this->add_log('total in collection: ' . $total); - $this->add_log('collection id ' . (string) $collection->get_id()); - - $this->add_collection([ - 'id' => $collection->get_id(), - 'mapping' => $metadata_map, - 'total_items' =>ceil( $total / $this->items_per_page ), - ]); - - $this->has_sets = false; - } - - $resumptionToken = $this->get_transient('collection_resump'); - if( $resumptionToken !== ''){ - return 1; - } else { - return false; - } - - } - - /** - * insert processed item from source to Tainacan - * - * @param array $processed_item Associative array with metadatum source's as index with - * its value or values - * @param integet $collection_index The index in the $this->collections array of the collection the item is beeing inserted into - * - * @return Tainacan\Entities\Item Item inserted - */ - public function insert( $processed_item, $collection_index ) { - $this->items_repo->disable_logs(); - $records = $processed_item['records']; - $collection_id = $processed_item['collection_definition']; - $collection = new Entities\Collection($collection_id['id']); - $map = $collection_id['mapping']; - - foreach ( $records as $record ) { - $item = new Entities\Item(); - $item->set_status('publish'); - $item->set_collection( $collection ); - $item->set_title( ( isset($record['dc:title']) ) ? $record['dc:title'][0] : 'title' ); - $item->set_description( '' ); - - $this->add_log( ( isset($record['dc:title']) ) ? $record['dc:title'][0] : 'title' ); - if( $record && $item->validate() ){ - $insertedItem = $this->items_repo->insert( $item ); - - if( isset($record['sets']) ){ - $terms = []; - $metadatum_set_id = $this->get_transient('set_metadatum_id'); - - foreach ($record['sets'] as $set) { - $term_id = $this->get_transient($set); - - if( $term_id ) $terms[] = $term_id; - } - - if( $metadatum_set_id && $terms ){ - $newMetadatum = new Entities\Metadatum($metadatum_set_id); - - $item_metadata = new Entities\Item_Metadata_Entity( $insertedItem, $newMetadatum ); - $item_metadata->set_value($terms); - - if( $item_metadata->validate() ){ - $this->item_metadata_repo->insert( $item_metadata ); - } - } - - unset($record['sets']); - } - - foreach ( $record as $index => $value ){ - - if( in_array( $index, $map ) && $insertedItem->get_id()){ - $metadatum_id = array_search($index, $map ); - $newMetadatum = new Entities\Metadatum($metadatum_id); - - $item_metadata = new Entities\Item_Metadata_Entity( $insertedItem, $newMetadatum ); - - $unique = !$item_metadata->is_multiple(); - $value_final = ( is_array($value) && $unique ) ? $value[0] : $value; - $item_metadata->set_value($value_final); - - if( $item_metadata->validate() ){ - $inserted = $this->item_metadata_repo->insert( $item_metadata ); - // $this->add_log('Item Metadata inserted for item ' .$item->get_title() . ' and metadata ' . $newMetadatum->get_name() ); - } else { - $this->add_log( 'Error inserting metadatum' . $newMetadatum->get_name() ); - $this->add_log( 'Values' . $value ); - $this->add_log( $item_metadata->get_errors() ); - } - } - - } - } else { - $this->add_log('item not inserted '); - } - - } - - return isset($insertedItem) ? $insertedItem : false; - } - - //protected functions - - /** - * @signature - get_identifyier($metadata) - * @param \SimpleXMLElement $metadata - * @return string O identifier - */ - protected function get_identifier($metadata) { - $attributes = $metadata->attributes(); // atributos - if ($attributes) { - foreach ($attributes as $a => $b) { - return $metadata->getName().'_'.(string) $b; - } - } else { - return $metadata->getName(); - } - } - - - /** - * Method implemented by the child importer class to return the number of items to be imported - * @return int - */ - public function get_total_items_from_source( $setSpec ) { - - if($setSpec) - $info = $this->requester( $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc&set=" . $setSpec); - else - $info = $this->requester( $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc"); - - if( !isset($info['body']) ){ - $this->add_log('ERROR'); - $this->add_error_log('Error in fetch remote total items'); - $this->abort(); - return false; - } - - try { - $xml = new \SimpleXMLElement($info['body']); - - if( isset($xml->ListRecords) && !isset($xml->ListRecords->resumptionToken) ){ - $cont = 0; - foreach ($xml->ListRecords->record as $record) $cont++; - - $this->add_transient('total_general', (string) $cont ); - return $cont; - } elseif ( isset($xml->ListRecords) && isset($xml->ListRecords->resumptionToken) ){ - - $resumptionToken_attributes = $xml->ListRecords->resumptionToken->attributes(); - - foreach ($resumptionToken_attributes as $tag => $attribute) { - if ($tag == 'completeListSize') { - $this->add_transient('total_general', (string) $attribute); - return (string) $attribute; - } - } - - foreach ($resumptionToken_attributes as $tag => $attribute) { - if ($tag == 'cursor') { - $this->items_per_page = $attribute; - $this->add_transient('items_per_page', (string) $this->items_per_page); - } - } - - // if the total is not found - $this->add_transient('total_general', (string) $this->items_per_page); - return $this->items_per_page; - } - } catch (Exception $e) { - $this->add_log('ERROR'); - return 0; - } - - return 0; - } - - /** - * create the collection in tainacan - * - * @return Entities\Collection - */ - protected function create_collection( $setSpec, $setName ){ - $is_created = $this->get_transient('collection_' . $setSpec. '_name'); - if( $is_created ){ - $new_collection = new Entities\Collection( $is_created ); - return $new_collection; - } - - $new_collection = new Entities\Collection(); - $new_collection->set_name($setName); - $new_collection->set_status('publish'); - $new_collection->validate(); - - - if($new_collection->validate()){ - $new_collection =$this->col_repo->insert($new_collection); - - $this->add_log('Collection created: ' . $new_collection->get_name()); - - if( $new_collection ) - $this->add_transient('collection_' . $setSpec. '_name', $new_collection->get_id()); - - return $new_collection; - } else{ - $this->add_error_log('Error creating collection ' . $setName ); - $this->add_error_log($new_collection->get_errors()); - $this->abort(); - return false; - } - - } - - /** - * @param $collection_object - * @throws \ErrorException - */ - protected function create_collection_metadata( $collection_object ){ - $Tainacan_Mappers = \Tainacan\Mappers_Handler::get_instance(); - $mapper_obj = $Tainacan_Mappers->check_class_name('dublin-core', true, $Tainacan_Mappers::MAPPER_CLASS_PREFIX); - $mapper = new $mapper_obj; - $array_metadata = []; - - $mapper_metadata = $mapper->metadata; - if(is_array($mapper_metadata) ) { - $id = $collection_object->get_id(); - - $Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance(); - foreach ($mapper_metadata as $slug => $mapper_metadatum) { - if( array_key_exists('core_metadatum', $mapper_metadatum) ) { - $method = 'get_core_' . $mapper_metadatum['core_metadatum'] . '_metadatum'; - if (method_exists($collection_object, $method)) { - $core_meta = $collection_object->$method(); - if ( ! $core_meta ) { - $Tainacan_Metadata->register_core_metadata( $collection_object, true ); - $core_meta = $collection_object->$method(); - } - $_meta_mapping = $core_meta->get_exposer_mapping(); - $_meta_mapping[$mapper->slug] = $slug; - $core_meta->set_exposer_mapping($_meta_mapping); - if ($core_meta->validate()) { - $new_metadata = $Tainacan_Metadata->insert($core_meta); - $array_metadata[$new_metadata->get_id()] = $slug; - } - } - continue; - } - - $metadatum = new \Tainacan\Entities\Metadatum(); - if( - array_key_exists('metadata_type', $mapper_metadatum) && - $mapper_metadatum['metadata_type'] != false && - class_exists($mapper_metadatum['metadata_type']) - ) { - $metadatum->set_metadata_type($mapper_metadatum['metadata_type']); - } else { - $metadatum->set_metadata_type('Tainacan\Metadata_Types\Text'); - } - $metadatum->set_name($mapper_metadatum['label']); - $metadatum->set_semantic_uri($mapper->get_url($slug)); - $metadatum->set_exposer_mapping([ - $mapper->slug => $slug - ]); - $metadatum->set_status('publish'); - $metadatum->set_collection_id($id); - $metadatum->set_slug($slug); - - if($metadatum->validate()){ - - $metadatum_id_created = $this->get_transient('collection_' . $id . '_' . $slug ); - if( $metadatum_id_created ){ - $array_metadata[$metadatum_id_created] = $slug; - } else { - $new_metadata = $Tainacan_Metadata->insert($metadatum); - $array_metadata[$new_metadata->get_id()] = $slug; - } - - } - } - } - - return $array_metadata; - } - - /** - * return all taxonomies from tainacan old - * @return array - */ - protected function fetch_collections(){ - - $collections_array = []; - // block terms with same set spec - $resumptionToken = $this->get_transient('collection_resump'); - if( $resumptionToken ){ - $collections_link = $this->get_url() . "?verb=ListSets&resumptionToken=" . $resumptionToken; - } else { - $collections_link = $this->get_url() . "?verb=ListSets"; - } - - $collections = $this->requester($collections_link); - $xml = $this->decode_request($collections, $collections_link); - - if( isset($xml->ListSets->set) ) { - foreach ($xml->ListSets->set as $set) { - - $collections_array[] = $set; - } - } - - if( isset($xml->ListSets) && isset($xml->ListSets->resumptionToken) ){ - $this->add_transient('collection_resump',(string) $xml->ListSets->resumptionToken); - } else { - $this->add_transient('collection_resump', (string) $xml->ListSets->resumptionToken); - } - - // TODO: verify if exists resumption token - - return ($collections_array) ? $collections_array : []; - } - - /** - * decode request from wp_remote - * @return array/bool - */ - protected function decode_request($result, $url){ - if (is_wp_error($result)) { - - $this->add_error_log($result->get_error_message()); - $this->add_error_log('Error in fetch remote' . $url); - $this->abort(); - return false; - - } else if (isset($result['body'])){ - - try { - $xml = new \SimpleXMLElement($result['body']); - return $xml; - } catch (Exception $e) { - return false; - } - } - - $this->add_error_log('Error in fetch remote'); - $this->abort(); - return false; - } - - /** - * executes the request - */ - protected function requester( $link ){ - $has_response = false; - $requests = 0; - - $args = array( - 'timeout' => 60, - 'redirection' => 30, - 'sslverify' => false - ); - - $this->add_log('fetching init ' . $link ); - $result = wp_remote_get($link, $args); - - while( !$has_response ){ - - if (is_wp_error($result)) { - - $this->add_log($result->get_error_message()); - $this->add_log('Error in fetch remote' . $link); - $this->add_log('request number ' . $requests); - - } else if (isset($result['body'])){ - $this->add_log('fetch OK '); - return $result; - } - - if( $requests > 10 ){ - break; - } - - if( $requests > 3 ){ - $this->add_log('taking a moment to breathe, waiting for ' . ( $requests * 10 ) . ' seconds ' ); - sleep( $requests * 10 ); - } - - $args = array( - 'timeout' => 60, - 'redirection' => 30, - 'sslverify' => false - ); - - $result = wp_remote_get($link, $args); - - $requests++; - $this->add_log('going to ' . $requests ); - } - - - - $this->add_error_log('Error in fetch remote, expired the 10 requests limit ' . $link); - $this->abort(); - return false; - } - - /** - * @param $taxonomy_father - * @param $name - * @param $slug - * @return bool - */ - public function createTerms( $taxonomy_father, $name, $slug ){ - $new_term = new Entities\Term(); - $new_term->set_taxonomy($taxonomy_father->get_db_identifier()); - $new_term->set_name($name); - - // block terms with same set spec - $map = $this->get_transient($slug); - - if($map){ - return false; - } - - if ($new_term->validate()) { - $inserted_term = $this->term_repo->insert($new_term); - } else { - $this->add_log( implode(',', $new_term->get_errors()) ); - return false; - } - - - if (is_wp_error($inserted_term)) { - - $this->add_log($inserted_term->get_error_message()); - - } else { - $this->add_transient($slug, $inserted_term->get_id()); - $this->add_log('Added term: ' . $inserted_term->get_name() . ' in tax: ' . $taxonomy_father->get_name()); - return true; - } - - return false; - } - - /** - * @param $collection_id - * @param $taxonomy_id - * @return bool|int - * @throws \Exception - */ - public function create_set_metadata( $collection_id, $taxonomy_id ){ - $newMetadatum = new Entities\Metadatum(); - - $name = $this->NAME_FOR_SETS; - $type = 'Taxonomy'; - - $newMetadatum->set_name($name); - $newMetadatum->set_metadata_type('Tainacan\Metadata_Types\\'.$type); - $newMetadatum->set_collection_id( (isset($collection_id)) ? $collection_id : 'default'); - $newMetadatum->set_status('publish'); - $newMetadatum->set_metadata_type_options(['taxonomy_id' => $taxonomy_id ]); - $newMetadatum->set_multiple('yes'); - - if($newMetadatum->validate()){ - $is_meta_created = $this->get_transient('set_metadatum_id'); - if( $is_meta_created ){ - $inserted_metadata = new Entities\Metadatum($is_meta_created); - - $this->add_log('Metadata get: ' . $inserted_metadata->get_name()); - } else { - $inserted_metadata = $this->metadata_repo->insert( $newMetadatum ); - - $this->add_log('Metadata created: ' . $inserted_metadata->get_name()); - } - - return $inserted_metadata->get_id(); - } else{ - return false; - } - } - - public function getRepoName(){ - $info = $this->requester( $this->get_url() . "?verb=Identify"); - - if( !isset($info['body']) ){ - $this->add_log('ERROR on get repo name'); - $this->add_error_log('Error in fetch remote total items'); - $this->abort(); - return __('Imported Repo'); - } else { - - try { - $xml = new \SimpleXMLElement($info['body']); - - if( isset($xml->Identify) && isset($xml->Identify->repositoryName) && !empty($xml->Identify->repositoryName) ){ - return (string) $xml->Identify->repositoryName; - } - } catch (Exception $e) { - return __('Imported Repo'); - } - - return __('Imported Repo'); - - } - } - - /** - * @param $attributes - * @return bool - */ - public function hasCompleteSize( $attributes ) { - foreach ( $attributes as $tag => $attribute ) { - if ( $tag == 'completeListSize' ) { - return true; - } - } - return false; - } - - /** - * Gets the current value to build the progress bar and give feedback to the user - * on the background process that is running the importer. - * - * It does so by comparing the "size" attribute with the $in_step_count class attribute - * where size indicates the total size of iterations the step will take and $this->in_step_count - * is the current iteration. - * - * For the step with "process_items" as a callback, this method will look for the the $this->collections array - * and sum the value of all "total_items" attributes of each collection. Then it will look for - * $this->get_current_collection and $this->set_current_collection_item to calculate the progress. - * - * The value must be from 0 to 100 - * - * If a negative value is passed, it is assumed that the progress is unknown - */ - public function get_progress_value() { - $current_step = $this->get_current_step(); - $steps = $this->get_steps(); - $value = -1; - - if ( isset($steps[$current_step]) ) { - $step = $steps[$current_step]; - - if ($step['callback'] == 'process_collections') { - - $totalItems = 0; - $currentItem = $this->get_current_collection_item(); - $current_collection = $this->get_current_collection(); - $collections = $this->get_collections(); - - foreach ($collections as $i => $col) { - if ( isset($col['total_items']) && is_numeric($col['total_items']) ) { - $totalItems += intval($col['total_items']); - if ($i < $current_collection) { - $currentItem += $col['total_items']; - } - } - } - - if ($totalItems > 0) { - $totalItems = ($this->get_transient('change_total')) ? $this->get_transient('change_total') : $totalItems; - $value = round( ($currentItem/$totalItems) * 100 ); - } - - - } else { - - if ( isset($step['total']) && is_numeric($step['total']) && $step['total'] > 0 ) { - $total = ($this->get_transient('change_total')) ? $this->get_transient('change_total') : $step['total']; - - $current = $this->get_in_step_count(); - $value = round( ($current/$total) * 100 ); - } - - } - - - } - return $value; - } - - public function options_form(){ - ob_start(); - ?> -
-
-
- - - - - - - - -
-
-
-
-

-
-
-
-
-
- -
-
-
-
-
- setSpec; + $setName = (string) $set->setName; + + $collection = $this->create_collection( $setSpec, $setName ); + + $metadata_map = $this->create_collection_metadata($collection); + $total = intval($this->get_total_items_from_source($setSpec)); + $this->add_log('total in collection: ' . $total); + $this->add_log('collection id ' . (string) $collection->get_id()); + + $this->add_collection([ + 'id' => $collection->get_id(), + 'mapping' => $metadata_map, + 'total_items' => ceil( $total / $this->items_per_page ), + 'source_id' => $setSpec, + ]); + } + } else if( $this->get_option('using_set') == 'taxonomy') { + + $collection = $this->create_collection( 'set', $this->getRepoName() ); + $metadata_map = $this->create_collection_metadata($collection); + $total = intval( $this->get_total_items_from_source(false) ); + $this->add_log('total in collection: ' . $total); + $this->add_log('collection id ' . (string) $collection->get_id()); + + $tax = new Entities\Taxonomy(); + $tax->set_name( $this->NAME_FOR_SETS ); + $tax->set_allow_insert('yes'); + $tax->set_status('publish'); + + if ($tax->validate()) { + + $is_tax_created = $this->get_transient('set_taxonomy_id'); + if( $is_tax_created ){ + $tax = new Entities\Taxonomy( $is_tax_created ); + } else { + $tax = $this->tax_repo->insert($tax); + $this->add_transient('set_taxonomy_id', $tax->get_id()); + } + + $metadatum_set_id = $this->create_set_metadata( $collection->get_id(), $tax->get_id() ); + + if( $metadatum_set_id ){ + $this->add_transient('set_metadatum_id', $metadatum_set_id); + + $this->add_collection([ + 'id' => $collection->get_id(), + 'mapping' => $metadata_map, + 'total_items' =>ceil( $total / $this->items_per_page ), + 'source_id' => 'sets', + 'metadatum_id' => $metadatum_set_id + ]); + } + + $this->add_log('Taxonomy ' . $tax->get_name() . ' created' ); + + foreach ($collection_xml as $set) { + + $setSpec = (string)$set->setSpec; + $setName = (string)$set->setName; + + $this->createTerms( $tax, $setName, $setSpec ); + } + + } else { + $this->add_log('Error creating taxonomy Sets' ); + $this->add_log($tax->get_errors()); + + } + + } + + } + // if there is no set + else { + $collection = $this->create_collection( 'set', $this->getRepoName() ); + $metadata_map = $this->create_collection_metadata($collection); + $total = intval( $this->get_total_items_from_source(false) ); + $this->add_log('total in collection: ' . $total); + $this->add_log('collection id ' . (string) $collection->get_id()); + + $this->add_collection([ + 'id' => $collection->get_id(), + 'mapping' => $metadata_map, + 'total_items' =>ceil( $total / $this->items_per_page ), + ]); + + $this->has_sets = false; + } + + $resumptionToken = $this->get_transient('collection_resump'); + if( $resumptionToken !== ''){ + return 1; + } else { + return false; + } + + } + + /** + * insert processed item from source to Tainacan + * + * @param array $processed_item Associative array with metadatum source's as index with + * its value or values + * @param integet $collection_index The index in the $this->collections array of the collection the item is beeing inserted into + * + * @return Tainacan\Entities\Item Item inserted + */ + public function insert( $processed_item, $collection_index ) { + $this->items_repo->disable_logs(); + $records = $processed_item['records']; + $collection_id = $processed_item['collection_definition']; + $collection = new Entities\Collection($collection_id['id']); + $map = $collection_id['mapping']; + + foreach ( $records as $record ) { + $item = new Entities\Item(); + $item->set_status('publish'); + $item->set_collection( $collection ); + $item->set_title( ( isset($record['dc:title']) ) ? $record['dc:title'][0] : 'title' ); + $item->set_description( '' ); + + $this->add_log( ( isset($record['dc:title']) ) ? $record['dc:title'][0] : 'title' ); + if( $record && $item->validate() ){ + $insertedItem = $this->items_repo->insert( $item ); + + if( isset($record['sets']) ){ + $terms = []; + $metadatum_set_id = $this->get_transient('set_metadatum_id'); + + foreach ($record['sets'] as $set) { + $term_id = $this->get_transient($set); + + if( $term_id ) $terms[] = $term_id; + } + + if( $metadatum_set_id && $terms ){ + $newMetadatum = new Entities\Metadatum($metadatum_set_id); + + $item_metadata = new Entities\Item_Metadata_Entity( $insertedItem, $newMetadatum ); + $item_metadata->set_value($terms); + + if( $item_metadata->validate() ){ + $this->item_metadata_repo->insert( $item_metadata ); + } + } + + unset($record['sets']); + } + + foreach ( $record as $index => $value ){ + + if( in_array( $index, $map ) && $insertedItem->get_id()){ + $metadatum_id = array_search($index, $map ); + $newMetadatum = new Entities\Metadatum($metadatum_id); + + $item_metadata = new Entities\Item_Metadata_Entity( $insertedItem, $newMetadatum ); + + $unique = !$item_metadata->is_multiple(); + $value_final = ( is_array($value) && $unique ) ? $value[0] : $value; + $item_metadata->set_value($value_final); + + if( $item_metadata->validate() ){ + $inserted = $this->item_metadata_repo->insert( $item_metadata ); + // $this->add_log('Item Metadata inserted for item ' .$item->get_title() . ' and metadata ' . $newMetadatum->get_name() ); + } else { + $this->add_log( 'Error inserting metadatum' . $newMetadatum->get_name() ); + $this->add_log( 'Values' . $value ); + $this->add_log( $item_metadata->get_errors() ); + } + } + + } + } else { + $this->add_log('item not inserted '); + } + + } + + return isset($insertedItem) ? $insertedItem : false; + } + + //protected functions + + /** + * @signature - get_identifyier($metadata) + * @param \SimpleXMLElement $metadata + * @return string O identifier + */ + protected function get_identifier($metadata) { + $attributes = $metadata->attributes(); // atributos + if ($attributes) { + foreach ($attributes as $a => $b) { + return $metadata->getName().'_'.(string) $b; + } + } else { + return $metadata->getName(); + } + } + + + /** + * Method implemented by the child importer class to return the number of items to be imported + * @return int + */ + public function get_total_items_from_source( $setSpec ) { + + if($setSpec) + $info = $this->requester( $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc&set=" . $setSpec); + else + $info = $this->requester( $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc"); + + if( !isset($info['body']) ){ + $this->add_log('ERROR'); + $this->add_error_log('Error in fetch remote total items'); + $this->abort(); + return false; + } + + try { + $xml = new \SimpleXMLElement($info['body']); + + if( isset($xml->ListRecords) && !isset($xml->ListRecords->resumptionToken) ){ + $cont = 0; + foreach ($xml->ListRecords->record as $record) $cont++; + + $this->add_transient('total_general', (string) $cont ); + return $cont; + } elseif ( isset($xml->ListRecords) && isset($xml->ListRecords->resumptionToken) ){ + + $resumptionToken_attributes = $xml->ListRecords->resumptionToken->attributes(); + + foreach ($resumptionToken_attributes as $tag => $attribute) { + if ($tag == 'completeListSize') { + $this->add_transient('total_general', (string) $attribute); + return (string) $attribute; + } + } + + foreach ($resumptionToken_attributes as $tag => $attribute) { + if ($tag == 'cursor') { + $this->items_per_page = $attribute; + $this->add_transient('items_per_page', (string) $this->items_per_page); + } + } + + // if the total is not found + $this->add_transient('total_general', (string) $this->items_per_page); + return $this->items_per_page; + } + } catch (Exception $e) { + $this->add_log('ERROR'); + return 0; + } + + return 0; + } + + /** + * create the collection in tainacan + * + * @return Entities\Collection + */ + protected function create_collection( $setSpec, $setName ){ + $is_created = $this->get_transient('collection_' . $setSpec. '_name'); + if( $is_created ){ + $new_collection = new Entities\Collection( $is_created ); + return $new_collection; + } + + $new_collection = new Entities\Collection(); + $new_collection->set_name($setName); + $new_collection->set_status('publish'); + $new_collection->validate(); + + + if($new_collection->validate()){ + $new_collection =$this->col_repo->insert($new_collection); + + $this->add_log('Collection created: ' . $new_collection->get_name()); + + if( $new_collection ) + $this->add_transient('collection_' . $setSpec. '_name', $new_collection->get_id()); + + return $new_collection; + } else{ + $this->add_error_log('Error creating collection ' . $setName ); + $this->add_error_log($new_collection->get_errors()); + $this->abort(); + return false; + } + + } + + /** + * @param $collection_object + * @throws \ErrorException + */ + protected function create_collection_metadata( $collection_object ){ + $Tainacan_Mappers = \Tainacan\Mappers_Handler::get_instance(); + $mapper_obj = $Tainacan_Mappers->check_class_name('dublin-core', true, $Tainacan_Mappers::MAPPER_CLASS_PREFIX); + $mapper = new $mapper_obj; + $array_metadata = []; + + $mapper_metadata = $mapper->metadata; + if(is_array($mapper_metadata) ) { + $id = $collection_object->get_id(); + + $Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance(); + foreach ($mapper_metadata as $slug => $mapper_metadatum) { + if( array_key_exists('core_metadatum', $mapper_metadatum) ) { + $method = 'get_core_' . $mapper_metadatum['core_metadatum'] . '_metadatum'; + if (method_exists($collection_object, $method)) { + $core_meta = $collection_object->$method(); + if ( ! $core_meta ) { + $Tainacan_Metadata->register_core_metadata( $collection_object, true ); + $core_meta = $collection_object->$method(); + } + $_meta_mapping = $core_meta->get_exposer_mapping(); + $_meta_mapping[$mapper->slug] = $slug; + $core_meta->set_exposer_mapping($_meta_mapping); + if ($core_meta->validate()) { + $new_metadata = $Tainacan_Metadata->insert($core_meta); + $array_metadata[$new_metadata->get_id()] = $slug; + } + } + continue; + } + + $metadatum = new \Tainacan\Entities\Metadatum(); + if( + array_key_exists('metadata_type', $mapper_metadatum) && + $mapper_metadatum['metadata_type'] != false && + class_exists($mapper_metadatum['metadata_type']) + ) { + $metadatum->set_metadata_type($mapper_metadatum['metadata_type']); + } else { + $metadatum->set_metadata_type('Tainacan\Metadata_Types\Text'); + } + $metadatum->set_name($mapper_metadatum['label']); + $metadatum->set_semantic_uri($mapper->get_url($slug)); + $metadatum->set_exposer_mapping([ + $mapper->slug => $slug + ]); + $metadatum->set_status('publish'); + $metadatum->set_collection_id($id); + $metadatum->set_slug($slug); + + if($metadatum->validate()){ + + $metadatum_id_created = $this->get_transient('collection_' . $id . '_' . $slug ); + if( $metadatum_id_created ){ + $array_metadata[$metadatum_id_created] = $slug; + } else { + $new_metadata = $Tainacan_Metadata->insert($metadatum); + $array_metadata[$new_metadata->get_id()] = $slug; + } + + } + } + } + + return $array_metadata; + } + + /** + * return all taxonomies from tainacan old + * @return array + */ + protected function fetch_collections(){ + + $collections_array = []; + // block terms with same set spec + $resumptionToken = $this->get_transient('collection_resump'); + if( $resumptionToken ){ + $collections_link = $this->get_url() . "?verb=ListSets&resumptionToken=" . $resumptionToken; + } else { + $collections_link = $this->get_url() . "?verb=ListSets"; + } + + $collections = $this->requester($collections_link); + $xml = $this->decode_request($collections, $collections_link); + + if( isset($xml->ListSets->set) ) { + foreach ($xml->ListSets->set as $set) { + + $collections_array[] = $set; + } + } + + if( isset($xml->ListSets) && isset($xml->ListSets->resumptionToken) ){ + $this->add_transient('collection_resump',(string) $xml->ListSets->resumptionToken); + } else { + $this->add_transient('collection_resump', (string) $xml->ListSets->resumptionToken); + } + + // TODO: verify if exists resumption token + + return ($collections_array) ? $collections_array : []; + } + + /** + * decode request from wp_remote + * @return array/bool + */ + protected function decode_request($result, $url){ + if (is_wp_error($result)) { + + $this->add_error_log($result->get_error_message()); + $this->add_error_log('Error in fetch remote' . $url); + $this->abort(); + return false; + + } else if (isset($result['body'])){ + + try { + $xml = new \SimpleXMLElement($result['body']); + return $xml; + } catch (Exception $e) { + return false; + } + } + + $this->add_error_log('Error in fetch remote'); + $this->abort(); + return false; + } + + /** + * executes the request + */ + protected function requester( $link ){ + $has_response = false; + $requests = 0; + + $args = array( + 'timeout' => 60, + 'redirection' => 30, + 'sslverify' => false + ); + + $this->add_log('fetching init ' . $link ); + $result = wp_remote_get($link, $args); + + while( !$has_response ){ + + if (is_wp_error($result)) { + + $this->add_log($result->get_error_message()); + $this->add_log('Error in fetch remote' . $link); + $this->add_log('request number ' . $requests); + + } else if (isset($result['body'])){ + $this->add_log('fetch OK '); + return $result; + } + + if( $requests > 10 ){ + break; + } + + if( $requests > 3 ){ + $this->add_log('taking a moment to breathe, waiting for ' . ( $requests * 10 ) . ' seconds ' ); + sleep( $requests * 10 ); + } + + $args = array( + 'timeout' => 60, + 'redirection' => 30, + 'sslverify' => false + ); + + $result = wp_remote_get($link, $args); + + $requests++; + $this->add_log('going to ' . $requests ); + } + + + + $this->add_error_log('Error in fetch remote, expired the 10 requests limit ' . $link); + $this->abort(); + return false; + } + + /** + * @param $taxonomy_father + * @param $name + * @param $slug + * @return bool + */ + public function createTerms( $taxonomy_father, $name, $slug ){ + $new_term = new Entities\Term(); + $new_term->set_taxonomy($taxonomy_father->get_db_identifier()); + $new_term->set_name($name); + + // block terms with same set spec + $map = $this->get_transient($slug); + + if($map){ + return false; + } + + if ($new_term->validate()) { + $inserted_term = $this->term_repo->insert($new_term); + } else { + $this->add_log( implode(',', $new_term->get_errors()) ); + return false; + } + + + if (is_wp_error($inserted_term)) { + + $this->add_log($inserted_term->get_error_message()); + + } else { + $this->add_transient($slug, $inserted_term->get_id()); + $this->add_log('Added term: ' . $inserted_term->get_name() . ' in tax: ' . $taxonomy_father->get_name()); + return true; + } + + return false; + } + + /** + * @param $collection_id + * @param $taxonomy_id + * @return bool|int + * @throws \Exception + */ + public function create_set_metadata( $collection_id, $taxonomy_id ){ + $newMetadatum = new Entities\Metadatum(); + + $name = $this->NAME_FOR_SETS; + $type = 'Taxonomy'; + + $newMetadatum->set_name($name); + $newMetadatum->set_metadata_type('Tainacan\Metadata_Types\\'.$type); + $newMetadatum->set_collection_id( (isset($collection_id)) ? $collection_id : 'default'); + $newMetadatum->set_status('publish'); + $newMetadatum->set_metadata_type_options(['taxonomy_id' => $taxonomy_id ]); + $newMetadatum->set_multiple('yes'); + + if($newMetadatum->validate()){ + $is_meta_created = $this->get_transient('set_metadatum_id'); + if( $is_meta_created ){ + $inserted_metadata = new Entities\Metadatum($is_meta_created); + + $this->add_log('Metadata get: ' . $inserted_metadata->get_name()); + } else { + $inserted_metadata = $this->metadata_repo->insert( $newMetadatum ); + + $this->add_log('Metadata created: ' . $inserted_metadata->get_name()); + } + + return $inserted_metadata->get_id(); + } else{ + return false; + } + } + + public function getRepoName(){ + $info = $this->requester( $this->get_url() . "?verb=Identify"); + + if( !isset($info['body']) ){ + $this->add_log('ERROR on get repo name'); + $this->add_error_log('Error in fetch remote total items'); + $this->abort(); + return __('Imported repository'); + } else { + + try { + $xml = new \SimpleXMLElement($info['body']); + + if( isset($xml->Identify) && isset($xml->Identify->repositoryName) && !empty($xml->Identify->repositoryName) ){ + return (string) $xml->Identify->repositoryName; + } + } catch (Exception $e) { + return __('Imported repository'); + } + + return __('Imported repository'); + + } + } + + /** + * @param $attributes + * @return bool + */ + public function hasCompleteSize( $attributes ) { + foreach ( $attributes as $tag => $attribute ) { + if ( $tag == 'completeListSize' ) { + return true; + } + } + return false; + } + + /** + * Gets the current value to build the progress bar and give feedback to the user + * on the background process that is running the importer. + * + * It does so by comparing the "size" attribute with the $in_step_count class attribute + * where size indicates the total size of iterations the step will take and $this->in_step_count + * is the current iteration. + * + * For the step with "process_items" as a callback, this method will look for the the $this->collections array + * and sum the value of all "total_items" attributes of each collection. Then it will look for + * $this->get_current_collection and $this->set_current_collection_item to calculate the progress. + * + * The value must be from 0 to 100 + * + * If a negative value is passed, it is assumed that the progress is unknown + */ + public function get_progress_value() { + $current_step = $this->get_current_step(); + $steps = $this->get_steps(); + $value = -1; + + if ( isset($steps[$current_step]) ) { + $step = $steps[$current_step]; + + if ($step['callback'] == 'process_collections') { + + $totalItems = 0; + $currentItem = $this->get_current_collection_item(); + $current_collection = $this->get_current_collection(); + $collections = $this->get_collections(); + + foreach ($collections as $i => $col) { + if ( isset($col['total_items']) && is_numeric($col['total_items']) ) { + $totalItems += intval($col['total_items']); + if ($i < $current_collection) { + $currentItem += $col['total_items']; + } + } + } + + if ($totalItems > 0) { + $totalItems = ($this->get_transient('change_total')) ? $this->get_transient('change_total') : $totalItems; + $value = round( ($currentItem/$totalItems) * 100 ); + } + + + } else { + + if ( isset($step['total']) && is_numeric($step['total']) && $step['total'] > 0 ) { + $total = ($this->get_transient('change_total')) ? $this->get_transient('change_total') : $step['total']; + + $current = $this->get_in_step_count(); + $value = round( ($current/$total) * 100 ); + } + + } + + + } + return $value; + } + + public function options_form(){ + ob_start(); + ?> +
+
+
+ + + + + + + + +
+
+
+
+

+
+
+
+
+
+ +
+
+
+
+
+ 'Create Taxonomies', 'progress_label' => 'Creating taxonomies', @@ -33,7 +32,6 @@ class Old_Tainacan extends Importer{ 'callback' => 'link_relationships', 'total' => 5 ] - ]; protected $tainacan_api_address, $wordpress_api_address, $actual_collection; @@ -64,8 +62,7 @@ class Old_Tainacan extends Importer{ * */ public function create_taxonomies() { - - if(!$this->get_url()){ + if (!$this->get_url()) { $this->add_error_log('Site url not found'); $this->abort(); return false; @@ -74,57 +71,49 @@ class Old_Tainacan extends Importer{ $this->add_log('Creating taxonomies'); foreach ($this->get_taxonomies() as $taxonomy) { + $tax = new Entities\Taxonomy(); + $tax->set_name( $taxonomy->name ); + $tax->set_description( $taxonomy->description ); + $tax->set_allow_insert('yes'); + $tax->set_status('publish'); - $tax = new Entities\Taxonomy(); - $tax->set_name( $taxonomy->name ); - $tax->set_description( $taxonomy->description ); - $tax->set_allow_insert('yes'); - $tax->set_status('publish'); - - if ($tax->validate()) { - $tax = $this->tax_repo->insert($tax); + if ($tax->validate()) { + $tax = $this->tax_repo->insert($tax); $this->add_log('Taxonomy ' . $tax->get_name() . ' created, id from Old'. $taxonomy->term_id ); + $this->add_transient('tax_' . $taxonomy->term_id . '_id', $tax->get_id()); + $this->add_transient('tax_' . $taxonomy->term_id . '_name', $tax->get_name()); - $this->add_transient('tax_' . $taxonomy->term_id . '_id', $tax->get_id()); - $this->add_transient('tax_' . $taxonomy->term_id . '_name', $tax->get_name()); - - if (isset($taxonomy->children) && $tax) { - $this->add_all_terms($tax, $taxonomy->children); - } - + if (isset($taxonomy->children) && $tax) { + $this->add_all_terms($tax, $taxonomy->children); + } } else { - $this->add_log('Error creating taxonomy ' . $taxonomy->name ); - $this->add_log($tax->get_errors()); - - } + $this->add_log('Error creating taxonomy ' . $taxonomy->name ); + $this->add_log($tax->get_errors()); + } + } - } - return false; - } + } /** * create the repository metadata which each collection inherits by default * */ - public function create_repo_metadata(){ - - $this->add_log('Creating repository metadata'); + public function create_repo_metadata() { + $this->add_log('Creating repository metadata'); foreach ($this->get_repo_metadata() as $metadata) { + if (isset($metadata->slug) && strpos($metadata->slug, 'socialdb_property_fixed') === false) { + $metadatum_id = $this->create_metadata( $metadata ); + } elseif ( strpos($metadata->slug, 'socialdb_property_fixed_tags') !== false ) { + $metadatum_id = $this->create_metadata( $metadata ); + } + } - if (isset($metadata->slug) && strpos($metadata->slug, 'socialdb_property_fixed') === false) { - $metadatum_id = $this->create_metadata( $metadata ); - } elseif ( strpos($metadata->slug, 'socialdb_property_fixed_tags') !== false ){ - $metadatum_id = $this->create_metadata( $metadata ); - } - - } - - $this->add_log('FInished repository metadata'); - return false; - } + $this->add_log('FInished repository metadata'); + return false; + } /** * create all collections and its metadata diff --git a/src/classes/importer/class-tainacan-test-importer.php b/src/classes/importer/class-tainacan-test-importer.php index b129691a5..db47658f3 100644 --- a/src/classes/importer/class-tainacan-test-importer.php +++ b/src/classes/importer/class-tainacan-test-importer.php @@ -316,11 +316,9 @@ class Test_Importer extends Importer { - validate()) { $tax1 = $this->tax_repo->insert($tax1); } else { - /** * In these set up steps, if we have an error adding * a taxonomy, collection or metadatum, there is no point @@ -345,14 +342,12 @@ class Test_Importer extends Importer { $this->add_error_log('Error creating taxonomy Color'); $this->add_error_log($tax1->get_errors()); $this->abort(); - return false; - + return false; } $this->add_transient('tax_1_id', $tax1->get_id()); return false; - } public function create_collections() { @@ -366,11 +361,9 @@ class Test_Importer extends Importer { $this->add_error_log('Error creating Collection 1'); $this->add_error_log($col1->get_errors()); $this->abort(); - return false; - + return false; } - $col1_map = []; // metadata @@ -696,8 +689,7 @@ class Test_Importer extends Importer { * @param $collection * */ - private function create_metadata( $args, $collection ){ - + private function create_metadata( $args, $collection ) { $metadatum = new Entities\Metadatum(); $metadatum->set_name($args['name']); $metadatum->set_collection($collection); @@ -758,7 +750,6 @@ class Test_Importer extends Importer { return $array; } - public function get_col2_item($index) { return [ 'field1' => 'Collection 2 item ' . $index, @@ -766,7 +757,5 @@ class Test_Importer extends Importer { 'field3' => 'Collection 2 whatever ' . $index, ]; } - - - + } \ No newline at end of file diff --git a/src/classes/repositories/class-tainacan-collections.php b/src/classes/repositories/class-tainacan-collections.php index 780d3442e..c287e4436 100644 --- a/src/classes/repositories/class-tainacan-collections.php +++ b/src/classes/repositories/class-tainacan-collections.php @@ -40,7 +40,7 @@ class Collections extends Repository { 'title' => __( 'Status', 'tainacan' ), 'type' => 'string', 'default' => '', - 'description' => __( 'The current situation of the post', 'tainacan' ) + 'description' => __( 'The current situation of the collection. It also affects the visibility of the collection items, as public items from private collections do not appear in the site.', 'tainacan' ) ], 'author_id' => [ 'map' => 'post_author', @@ -169,7 +169,7 @@ class Collections extends Repository { 'map' => 'meta', 'title' => __( 'Header Image', 'tainacan' ), 'type' => 'string', - 'description' => __( 'The image to be used in collection header', 'tainacan' ), + 'description' => __( 'The image to be used in collection header, if the theme has one.', 'tainacan' ), 'on_error' => __( 'Invalid image', 'tainacan' ), //'validation' => v::numeric(), 'default' => '' @@ -189,10 +189,10 @@ class Collections extends Repository { ], 'allow_comments' => [ 'map' => 'meta', - 'title' => __( 'Allow Items Comments', 'tainacan' ), - 'type' => 'string', - 'description' => __( 'Collection items comment status: "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ), - 'default' => 'open', + 'title' => __( 'Allow enabling comments on items', 'tainacan' ), + 'type' => 'string', + 'description' => __( 'If this option is enabled, items of this collection can be set to enable a comments section on their page. "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ), + 'default' => 'closed', 'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )), ], 'submission_anonymous_user' => [ diff --git a/src/classes/repositories/class-tainacan-item-metadata.php b/src/classes/repositories/class-tainacan-item-metadata.php index d82260fa9..ca088f0d7 100644 --- a/src/classes/repositories/class-tainacan-item-metadata.php +++ b/src/classes/repositories/class-tainacan-item-metadata.php @@ -403,7 +403,7 @@ class Item_Metadata extends Repository { $metadatum = $item_metadata->get_metadatum(); if ( $metadatum->get_metadata_type() == 'Tainacan\Metadata_Types\User' ) { $options = $metadatum->get_metadata_type_options(); - if ( isset($options['default_author']) && $options['default_author'] = 'yes') { + if ( isset($options['default_author']) && $options['default_author'] == 'yes') { $value = $metadatum->is_multiple() ? [strval(get_current_user_id())] : strval(get_current_user_id()); $item_metadata->set_value($value); if ( $item_metadata->validate() ) { diff --git a/src/classes/repositories/class-tainacan-items.php b/src/classes/repositories/class-tainacan-items.php index bd255e3ca..776c627ce 100644 --- a/src/classes/repositories/class-tainacan-items.php +++ b/src/classes/repositories/class-tainacan-items.php @@ -46,7 +46,7 @@ class Items extends Repository { 'title' => __( 'Status', 'tainacan' ), 'type' => 'string', 'default' => 'draft', - 'description' => __( 'The posts status', 'tainacan' ) + 'description' => __( 'The current situation of the item. Notice that the item visibility also depends on the collection status.', 'tainacan' ) ], 'description' => [ 'map' => 'post_content', diff --git a/src/classes/repositories/class-tainacan-metadata.php b/src/classes/repositories/class-tainacan-metadata.php index d511a6cc1..26f78d289 100644 --- a/src/classes/repositories/class-tainacan-metadata.php +++ b/src/classes/repositories/class-tainacan-metadata.php @@ -63,7 +63,7 @@ class Metadata extends Repository { 'map' => 'post_name', 'title' => __( 'Slug', 'tainacan' ), 'type' => 'string', - 'description' => __( 'A unique and santized string representation of the metadata', 'tainacan' ), + 'description' => __( 'A unique and sanitized string representation of the metadata', 'tainacan' ), //'validation' => v::stringType(), ], 'order' => [ diff --git a/src/classes/repositories/class-tainacan-repository.php b/src/classes/repositories/class-tainacan-repository.php index 01566ac7b..dec38cb9e 100644 --- a/src/classes/repositories/class-tainacan-repository.php +++ b/src/classes/repositories/class-tainacan-repository.php @@ -89,7 +89,7 @@ abstract class Repository { * 'map' => 'post_name', * 'title' => __('Slug', 'tainacan'), * 'type' => 'string', - * 'description'=> __('A unique and santized string representation of the collection, used to build the collection URL', 'tainacan'), + * 'description'=> __('A unique and sanitized string representation of the collection, used to build the collection URL', 'tainacan'), * 'validation' => v::stringType(), * ], */ diff --git a/src/classes/theme-helper/class-tainacan-theme-helper.php b/src/classes/theme-helper/class-tainacan-theme-helper.php index bdecf5708..e0e93efb5 100644 --- a/src/classes/theme-helper/class-tainacan-theme-helper.php +++ b/src/classes/theme-helper/class-tainacan-theme-helper.php @@ -683,6 +683,8 @@ class Theme_Helper { $excerpt = strip_tags(tainacan_get_the_collection_description()); } elseif ( is_post_type_archive('tainacan-collection') ) { $title = __('Collections', 'tainacan'); + } else { + $title = get_the_archive_title(); } } elseif ( is_singular() ) { global $post; diff --git a/src/readme.txt b/src/readme.txt index e465e24c2..aa5d375a4 100644 --- a/src/readme.txt +++ b/src/readme.txt @@ -1,10 +1,10 @@ === Tainacan === -Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila, vnmedeiros, tainacan, r-guimaraes +Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila, vnmedeiros, tainacan, r-guimaraes, suelanesilva, ccaio, alanargomes, ateneagarcia123, rodrigo0freire, clarandreozzi Tags: museums, libraries, archives, GLAM, collections, repository -Requires at least: 4.8 +Requires at least: 5.0 Tested up to: 5.6 Requires PHP: 5.6 -Stable tag: 0.17.4 +Stable tag: 0.18 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html diff --git a/src/tainacan.php b/src/tainacan.php index 9cce31da1..3d1d0ef07 100644 --- a/src/tainacan.php +++ b/src/tainacan.php @@ -4,13 +4,13 @@ Plugin Name: Tainacan Plugin URI: https://tainacan.org/ Description: Open source, powerful and flexible repository platform for WordPress. Manage and publish you digital collections as easily as publishing a post to your blog, while having all the tools of a professional repository platform. Author: Tainacan.org -Version: 0.17.4 +Version: 0.18 Text Domain: tainacan License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html */ -const TAINACAN_VERSION = '0.17.4'; +const TAINACAN_VERSION = '0.18'; defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); $TAINACAN_BASE_URL = plugins_url('', __FILE__); diff --git a/src/views/admin/admin.vue b/src/views/admin/admin.vue index b5d446c6c..0a504c205 100644 --- a/src/views/admin/admin.vue +++ b/src/views/admin/admin.vue @@ -20,15 +20,16 @@ @click="isMenuCompressed = !isMenuCompressed"> - + @@ -99,7 +100,8 @@ hideCancel: true }, ariaRole: 'alertdialog', - ariaModal: true + ariaModal: true, + customClass: 'tainacan-modal' }); } }); diff --git a/src/views/admin/components/edition/collection-edition-form.vue b/src/views/admin/components/edition/collection-edition-form.vue index c44f6a255..8eee48549 100644 --- a/src/views/admin/components/edition/collection-edition-form.vue +++ b/src/views/admin/components/edition/collection-edition-form.vue @@ -204,7 +204,7 @@ :label="$i18n.getHelperTitle('collections', 'hide_items_thumbnail_on_lists')">   - + + :label="$i18n.getHelperTitle('collections', 'allow_comments')">   { - resp.request.then((collections) => { - this.collections = collections; - this.isFetchingCollections = false; - }) - .catch((error) => { - this.$console.error(error); - this.isFetchingCollections = false; - }); - }) - .catch(() => { - this.isFetchingCollections = false; - }); + // DISABLED IN 0.18 AS WE DISCUSS BETTER IMPLEMENTATION FOR COLLECTIONS HIERARCHY + // this.isFetchingCollections = true; + // this.fetchAllCollectionNames() + // .then((resp) => { + // resp.request.then((collections) => { + // this.collections = collections; + // this.isFetchingCollections = false; + // }) + // .catch((error) => { + // this.$console.error(error); + // this.isFetchingCollections = false; + // }); + // }) + // .catch(() => { + // this.isFetchingCollections = false; + // }); this.isLoading = false; }); @@ -949,22 +951,23 @@ export default { this.form.status = 'publish'; // Generates options for parent collection - this.isFetchingCollections = true; - this.fetchAllCollectionNames() - .then((resp) => { - resp.request.then((collections) => { - this.collections = collections; - this.isFetchingCollections = false; - }) - .catch((error) => { - this.$console.error(error); - this.isFetchingCollections = false; - }); - }) - .catch((error) => { - this.$console.error(error); - this.isFetchingCollections = false; - }); + // DISABLED IN 0.18 AS WE DISCUSS BETTER IMPLEMENTATION FOR COLLECTIONS HIERARCHY + // this.isFetchingCollections = true; + // this.fetchAllCollectionNames() + // .then((resp) => { + // resp.request.then((collections) => { + // this.collections = collections; + // this.isFetchingCollections = false; + // }) + // .catch((error) => { + // this.$console.error(error); + // this.isFetchingCollections = false; + // }); + // }) + // .catch((error) => { + // this.$console.error(error); + // this.isFetchingCollections = false; + // }); this.isLoading = false; diff --git a/src/views/admin/components/edition/filter-edition-form.vue b/src/views/admin/components/edition/filter-edition-form.vue index ee962a6d1..837fc229a 100644 --- a/src/views/admin/components/edition/filter-edition-form.vue +++ b/src/views/admin/components/edition/filter-edition-form.vue @@ -72,7 +72,7 @@ - {{ $i18n.get('publish_visibility') }} + {{ $i18n.get('status_public') }}
- {{ $i18n.get('private_visibility') }} + {{ $i18n.get('status_private') }}
diff --git a/src/views/admin/components/edition/importer-edition-form.vue b/src/views/admin/components/edition/importer-edition-form.vue index 2fcd5417b..a58c30e73 100644 --- a/src/views/admin/components/edition/importer-edition-form.vue +++ b/src/views/admin/components/edition/importer-edition-form.vue @@ -167,8 +167,8 @@ (importer.accepts.file && importer.accepts.url && !importerFile && !url)" id="button-submit-importer-creation" @click.prevent="onFinishImporter()" - :class="{'is-loading': isLoadingRun }" - class="button is-success">{{ $i18n.get('run') }} + :class="{ 'is-loading': isLoadingRun, 'is-success': !isLoadingRun }" + class="button">{{ $i18n.get('run') }}
{{ $i18n.get('next') }} + :class="{ 'is-loading': isLoadingUpload, 'is-success': !isLoadingUpload }" + class="button">{{ $i18n.get('next') }}
@@ -500,7 +500,7 @@ export default { margin: 12px 0 6px 0; } - .modal .animation-content { + .tainacan-modal .animation-content { width: 100%; z-index: 99999; diff --git a/src/views/admin/components/edition/importer-mapping-form.vue b/src/views/admin/components/edition/importer-mapping-form.vue index 514917566..a415f47a2 100644 --- a/src/views/admin/components/edition/importer-mapping-form.vue +++ b/src/views/admin/components/edition/importer-mapping-form.vue @@ -37,7 +37,6 @@

{{ $i18n.get('info_metadata_mapping_helper') }}


- + + + + + {{ $i18n.get('label_set_all_create_metadada') }} + + + + + + {{ $i18n.get('label_add_more_metadata') }} +
@@ -183,7 +202,8 @@ :active.sync="isNewMetadatumModalActive" trap-focus aria-modal - aria-role="dialog"> + aria-role="dialog" + custom-class="tainacan-modal">
- - - - - {{ $i18n.get('label_add_more_metadata') }}
{{ $i18n.get('run') }} + :class="{ 'is-loading': isLoadingRun, 'is-success': !isLoadingRun }" + class="button">{{ $i18n.get('run') }}
@@ -293,7 +304,8 @@ autofocus role="dialog" tabindex="-1" - aria-modal> + aria-modal + custom-class="tainacan-modal">

{{ $i18n.get('instruction_select_title_mapping') }}

@@ -404,7 +416,7 @@ export default { metadataSearchCancel: undefined, showTitlePromptModal: false, selectedTitle: undefined, - formErrorMessage: '' + formErrorMessage: '', } }, computed: { @@ -785,6 +797,12 @@ export default { this.showTitlePromptModal = false; this.onRunImporter(); + }, + createAllMetadata() { + this.mappedCollection['mapping'] = {}; + this.importerSourceInfo.source_metadata.forEach((metadatum, index) => { + this.mappedCollection['mapping']['create_metadata'+ index] = metadatum; + }); } } } @@ -911,6 +929,7 @@ export default { } .mapping-header { + width: 100%; display: flex; justify-content: space-between; align-items: center; @@ -939,7 +958,7 @@ export default { } } - .modal .animation-content { + .tainacan-modal .animation-content { width: 100%; z-index: 99999; diff --git a/src/views/admin/components/edition/item-bulk-edition-form.vue b/src/views/admin/components/edition/item-bulk-edition-form.vue index f79980578..d7e0fa2b7 100644 --- a/src/views/admin/components/edition/item-bulk-edition-form.vue +++ b/src/views/admin/components/edition/item-bulk-edition-form.vue @@ -330,7 +330,8 @@ export default { collectionId: this.collectionId }, width: 'calc(100% - (2 * var(--tainacan-one-column)))', - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); }, deleteOneItem(itemId, index) { @@ -351,7 +352,8 @@ export default { }); } }, - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); }, } diff --git a/src/views/admin/components/edition/item-edition-form.vue b/src/views/admin/components/edition/item-edition-form.vue index 6b6c31526..26b8f44d5 100644 --- a/src/views/admin/components/edition/item-edition-form.vue +++ b/src/views/admin/components/edition/item-edition-form.vue @@ -217,7 +217,8 @@ scroll="keep" trap-focus aria-modal - aria-role="dialog"> + aria-role="dialog" + custom-class="tainacan-modal">

{{ $i18n.get('instruction_write_text') }}

@@ -258,7 +259,8 @@ role="dialog" tabindex="-1" aria-modal - aria-role="dialog"> + aria-role="dialog" + custom-class="tainacan-modal">

{{ $i18n.get('instruction_insert_url') }}

@@ -314,7 +316,7 @@ class="image"> + v-if="item.document_type == 'empty' && item.document_mimetype == 'empty'"> {{ $i18n.get('label_empty_thumbnail') }}
- {{ $i18n.get('publish_visibility') }} + {{ $i18n.get('status_public') }} - {{ $i18n.get('private_visibility') }} + {{ $i18n.get('status_private') }}
@@ -991,7 +993,8 @@ export default { next(); }, }, - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); } else { next() @@ -1232,6 +1235,7 @@ export default { this.updateItemDocument({ item_id: this.itemId, document: this.form.document, document_type: this.form.document_type }) .then(item => { this.item.document_as_html = item.document_as_html; + this.item.document_mimetype = item.document_mimetype; this.isLoading = false; }) .catch((errors) => { @@ -1263,6 +1267,7 @@ export default { this.updateItemDocument({ item_id: this.itemId, document: this.form.document, document_type: this.form.document_type }) .then(item => { this.item.document_as_html = item.document_as_html; + this.item.document_mimetype = item.document_mimetype; this.isLoading = false; let oldThumbnail = this.item.thumbnail; @@ -1298,6 +1303,7 @@ export default { document_type: this.form.document_type }) .then(() => { + this.item.document_mimetype = 'empty'; this.isLoadingAttachments = true; this.fetchAttachments({ page: 1, @@ -1359,7 +1365,8 @@ export default { }); } }, - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); }, @@ -1381,6 +1388,7 @@ export default { .then((item) => { this.isLoading = false; this.item.document_as_html = item.document_as_html; + this.item.document_mimetype = item.document_mimetype; let oldThumbnail = this.item.thumbnail; if (item.document_type == 'attachment' && oldThumbnail != item.thumbnail ) @@ -1480,7 +1488,8 @@ export default { this.$router.push(this.$routerHelper.getCollectionPath(this.form.collectionId)) } }, - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); }, loadExistingItem() { diff --git a/src/views/admin/components/edition/metadatum-edition-form.vue b/src/views/admin/components/edition/metadatum-edition-form.vue index 63d0e7553..ac85bf85b 100644 --- a/src/views/admin/components/edition/metadatum-edition-form.vue +++ b/src/views/admin/components/edition/metadatum-edition-form.vue @@ -89,7 +89,7 @@ - {{ $i18n.get('publish_visibility') }} + {{ $i18n.get('status_public') }} @@ -102,7 +102,7 @@ - {{ $i18n.get('private_visibility') }} + {{ $i18n.get('status_private') }} diff --git a/src/views/admin/components/edition/taxonomy-edition-form.vue b/src/views/admin/components/edition/taxonomy-edition-form.vue index 67f2dfa6b..d3a9e8803 100644 --- a/src/views/admin/components/edition/taxonomy-edition-form.vue +++ b/src/views/admin/components/edition/taxonomy-edition-form.vue @@ -193,10 +193,10 @@

+ class="button">{{ $i18n.get('save') }}
@@ -299,7 +299,8 @@ next(); } }, - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); } else if (this.isEditingTerm) { this.$buefy.modal.open({ @@ -313,7 +314,8 @@ next(); } }, - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); } else { next(); diff --git a/src/views/admin/components/filter-types/checkbox/Checkbox.vue b/src/views/admin/components/filter-types/checkbox/Checkbox.vue index 2c45e385a..85b2fc69d 100644 --- a/src/views/admin/components/filter-types/checkbox/Checkbox.vue +++ b/src/views/admin/components/filter-types/checkbox/Checkbox.vue @@ -181,7 +181,8 @@ this.loadOptions(); } }, - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); }, } @@ -192,7 +193,7 @@ .view-all-button { - font-size: 0.75em; + font-size: 0.75em !important; padding: 0.1em 1em; } diff --git a/src/views/admin/components/filter-types/tainacan-filter-item.vue b/src/views/admin/components/filter-types/tainacan-filter-item.vue index dfd5d3605..b85227d8e 100644 --- a/src/views/admin/components/filter-types/tainacan-filter-item.vue +++ b/src/views/admin/components/filter-types/tainacan-filter-item.vue @@ -95,16 +95,20 @@ &:not(:last-child) { margin-bottom: 0; - padding-bottom: 0.75em; + padding-bottom: 0.25em; } .collapse-trigger { margin-left: -7px; + button { + background-color: inherit !important; + color: inherit !important; + } .icon { margin-right: 5px; } .collapse-label { - display: inline-block; + display: inline; width: 100%; overflow-x: hidden; text-overflow: ellipsis; @@ -128,6 +132,7 @@ align-items: center; border: none; background-color: transparent; + color: var(--tainacan-label-color); text-align: left; cursor: pointer; outline: none; diff --git a/src/views/admin/components/filter-types/taxonomy/Checkbox.vue b/src/views/admin/components/filter-types/taxonomy/Checkbox.vue index 736f37687..2464af055 100644 --- a/src/views/admin/components/filter-types/taxonomy/Checkbox.vue +++ b/src/views/admin/components/filter-types/taxonomy/Checkbox.vue @@ -314,7 +314,8 @@ } }, width: 'calc(100% - (4 * var(--tainacan-one-column)))', - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); }, prepareOptionsForTaxonomy(items) { @@ -351,7 +352,7 @@ diff --git a/src/views/admin/components/other/metadatum-details.vue b/src/views/admin/components/other/metadatum-details.vue index 803e7c6ab..5d8e2ed93 100644 --- a/src/views/admin/components/other/metadatum-details.vue +++ b/src/views/admin/components/other/metadatum-details.vue @@ -12,13 +12,6 @@
{{ $i18n.getHelperTitle('metadata', 'semantic_uri') }}
{{ metadatum.semantic_uri }}
-
{{ $i18n.get('label_display') }}
diff --git a/src/views/admin/components/search/filters-items-list.vue b/src/views/admin/components/search/filters-items-list.vue index fed4d6533..b1efd3383 100644 --- a/src/views/admin/components/search/filters-items-list.vue +++ b/src/views/admin/components/search/filters-items-list.vue @@ -497,7 +497,7 @@ .collapse-all { display: inline-flex; align-items: center; - margin-left: -0.65em; + margin-left: -0.5em !important; } .collapse-all__text { font-size: 0.75em !important; diff --git a/src/views/admin/js/axios.js b/src/views/admin/js/axios.js index 070c0cee8..4ef8fbe2c 100644 --- a/src/views/admin/js/axios.js +++ b/src/views/admin/js/axios.js @@ -50,7 +50,8 @@ const tainacanErrorHandler = function(error){ hideCancel: true }, ariaRole: 'alertdialog', - ariaModal: true + ariaModal: true, + customClass: 'tainacan-modal' }); } }); diff --git a/src/views/admin/js/event-bus-item-metadata.js b/src/views/admin/js/event-bus-item-metadata.js index b06c015f1..c38ff5b98 100644 --- a/src/views/admin/js/event-bus-item-metadata.js +++ b/src/views/admin/js/event-bus-item-metadata.js @@ -31,7 +31,7 @@ export const eventBusItemMetadata = new Vue({ this.$emit('isUpdatingValue', true); - if (values.length > 0 && values[0].value) { + if (values.length > 0 && values[0] && values[0].value) { let onlyValues = values.map((aValueObject) => aValueObject.value); values = onlyValues; } diff --git a/src/views/admin/js/store/modules/collection/actions.js b/src/views/admin/js/store/modules/collection/actions.js index 95a7c5e45..54c2d5175 100644 --- a/src/views/admin/js/store/modules/collection/actions.js +++ b/src/views/admin/js/store/modules/collection/actions.js @@ -201,7 +201,7 @@ export const fetchCollection = ({ commit, }, id) => { export const fetchCollectionBasics = ({ commit }, {collectionId, isContextEdit }) => { return new Promise((resolve, reject) => { - let endpoint = '/collections/' + collectionId + '?fetch_only=name,url,allow_comments,hide_items_thumbnail_on_lists'; + let endpoint = '/collections/' + collectionId + '?fetch_only=name,url,status,allow_comments,hide_items_thumbnail_on_lists'; if (isContextEdit) endpoint += '&context=edit'; diff --git a/src/views/admin/js/store/modules/report/actions.js b/src/views/admin/js/store/modules/report/actions.js index 55e57118c..f223acead 100644 --- a/src/views/admin/js/store/modules/report/actions.js +++ b/src/views/admin/js/store/modules/report/actions.js @@ -55,12 +55,12 @@ export const fetchMetadataList = ({ commit }, { collectionId, onlyTaxonomies } ) let endpoint = ''; if (collectionId && collectionId != 'default') - endpoint += '/collection/' + collectionId + '/metadata/'; + endpoint += '/collection/' + collectionId + '/metadata/?nopaging=1'; else - endpoint += '/metadata/'; + endpoint += '/metadata/?nopaging=1'; if (onlyTaxonomies) - endpoint += '?metaquery[0][key]=metadata_type&metaquery[0][value]=Tainacan\\Metadata_Types\\Taxonomy'; + endpoint += '&metaquery[0][key]=metadata_type&metaquery[0][value]=Tainacan\\Metadata_Types\\Taxonomy'; return new Promise((resolve, reject) => { axios.tainacan.get(endpoint) diff --git a/src/views/admin/js/store/modules/report/getters.js b/src/views/admin/js/store/modules/report/getters.js index 103b9a341..514875868 100644 --- a/src/views/admin/js/store/modules/report/getters.js +++ b/src/views/admin/js/store/modules/report/getters.js @@ -30,6 +30,10 @@ export const getActivities = state => { return state.activities; }; +export const getStartDate = state => { + return state.startDate; +}; + export const getStackedBarChartOptions = state => { return state.stackedBarChartOptions; }; @@ -38,6 +42,10 @@ export const getHorizontalBarChartOptions = state => { return state.horizontalBarChartOptions; }; +export const getVisibilityHorizontalBarChartOptions = state => { + return state.visibilityHorizontalBarChartOptions; +}; + export const getDonutChartOptions = state => { return state.donutChartOptions; }; diff --git a/src/views/admin/js/store/modules/report/index.js b/src/views/admin/js/store/modules/report/index.js index 500763026..081dbf53d 100644 --- a/src/views/admin/js/store/modules/report/index.js +++ b/src/views/admin/js/store/modules/report/index.js @@ -12,6 +12,7 @@ const state = { metadata: {}, metadataList: {}, activities: {}, + startDate: '', stackedBarChartOptions: { chart: { type: 'bar', @@ -129,7 +130,6 @@ const state = { }, fill: { opacity: 1 - }, legend: { position: 'top', @@ -183,7 +183,7 @@ const state = { } } }, - treeMapOptions: { + treeMapChartOptions: { legend: { show: false }, @@ -193,8 +193,84 @@ const state = { }, title: { text: '' + }, + plotOptions: { + treemap: { + enableShades: false + } } - } + }, + visibilityHorizontalBarChartOptions: { + chart: { + type: 'bar', + height: 350, + stacked: true, + stackType: 'normal', + toolbar: { + show: false + }, + zoom: { + type: 'y', + enabled: false, + autoScaleYaxis: true, + } + }, + plotOptions: { + bar: { + horizontal: true, + columnWidth: '100%', + barHeight: '80%' + }, + }, + title: { + text: '' + }, + xaxis: { + type: 'category', + categories: [], + tooltip: { enabled: true }, + axisBorder: { + show: false + }, + axisTicks: { + show: false, + }, + labels: { + show: false + } + }, + yaxis: { + tooltip: { enabled: true }, + axisBorder: { + show: false + }, + axisTicks: { + show: false, + }, + labels: { + show: true, + style: { + fontSize: '17px', + fontFamily: 'TainacanIcons, Arial, sans-serif', + } + } + }, + tooltip: { + enabled: true + }, + fill: { + opacity: 1 + }, + grid: { + show: false + }, + legend: { + position: 'top', + horizontalAlign: 'left', + offsetX: 40 + } + }, + }; export default { diff --git a/src/views/admin/js/store/modules/report/mutations.js b/src/views/admin/js/store/modules/report/mutations.js index 563a71398..ef096e340 100644 --- a/src/views/admin/js/store/modules/report/mutations.js +++ b/src/views/admin/js/store/modules/report/mutations.js @@ -32,6 +32,10 @@ export const setActivities = (state, activities) => { state.activities = activities; }; +export const setStartDate = (state, startDate) => { + state.startDate = startDate; +}; + export const setStackedBarChartOptions = (state, stackedBarChartOptions) => { state.stackedBarChartOptions = stackedBarChartOptions; }; @@ -40,6 +44,10 @@ export const setHorizontalBarChartOptions = (state, horizontalBarChartOptions) = state.horizontalBarChartOptions = horizontalBarChartOptions; }; +export const setVisibilityHorizontalBarChartOptions = (state, visibilityHorizontalBarChartOptions) => { + state.visibilityHorizontalBarChartOptions = visibilityHorizontalBarChartOptions; +}; + export const setDonutChartOptions = (state, donutChartOptions) => { state.donutChartOptions = donutChartOptions; }; diff --git a/src/views/admin/pages/lists/collections-page.vue b/src/views/admin/pages/lists/collections-page.vue index 43c5dcbce..f53f9ba2a 100644 --- a/src/views/admin/pages/lists/collections-page.vue +++ b/src/views/admin/pages/lists/collections-page.vue @@ -477,7 +477,8 @@ export default { parent: this, component: AvailableImportersModal, hasModalCard: true, - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); }, searchCollections() { diff --git a/src/views/admin/pages/lists/filters-page.vue b/src/views/admin/pages/lists/filters-page.vue index 94aa6e81d..8e40181ef 100644 --- a/src/views/admin/pages/lists/filters-page.vue +++ b/src/views/admin/pages/lists/filters-page.vue @@ -298,7 +298,8 @@ :active.sync="isSelectingFilterType" trap-focus aria-modal - aria-role="dialog"> + aria-role="dialog" + custom-class="tainacan-modal">
+ custom-class="tainacan-modal tainacan-form filters-menu"> 0, messageKeyForUserPrefs: 'ItemsHiddenDueSorting' }, - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); }, hideFiltersOnMobile: _.debounce( function() { diff --git a/src/views/admin/pages/lists/metadata-page.vue b/src/views/admin/pages/lists/metadata-page.vue index 198c6fe23..45b2b4b5d 100644 --- a/src/views/admin/pages/lists/metadata-page.vue +++ b/src/views/admin/pages/lists/metadata-page.vue @@ -451,7 +451,8 @@ export default { next(); }, }, - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); } else { next(); @@ -597,7 +598,8 @@ export default { }); } }, - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); }, toggleMetadatumEdition(metadatumId) { diff --git a/src/views/admin/pages/singles/item-page.vue b/src/views/admin/pages/singles/item-page.vue index e06a99532..27dbf815e 100644 --- a/src/views/admin/pages/singles/item-page.vue +++ b/src/views/admin/pages/singles/item-page.vue @@ -154,23 +154,70 @@
- +
- {{ $i18n.get('publish_visibility') }} + {{ $i18n.get('status_public') }} - {{ $i18n.get('private_visibility') }} + {{ $i18n.get('status_private') }} + +
+
+
+ + +
+ +
+
+ + + + + + + + + + + + + + {{ $i18n.get('label_' + itemVisibility) }}
@@ -369,6 +416,9 @@ }, totalAttachments() { return this.getTotalAttachments(); + }, + itemVisibility() { + return (this.collection && this.collection.status == 'publish' && this.item && this.item.status == 'publish') ? 'open_access' : 'restrict_access' } }, created() { @@ -433,7 +483,8 @@ itemURL: this.item.url, totalItems: 1, }, - trapFocus: true + trapFocus: true, + customClass: 'tainacan-modal' }); } } diff --git a/src/views/admin/scss/_buttons.scss b/src/views/admin/scss/_buttons.scss index 2fdd50e72..b03f33b57 100644 --- a/src/views/admin/scss/_buttons.scss +++ b/src/views/admin/scss/_buttons.scss @@ -6,11 +6,11 @@ button.link-style:active { cursor: pointer; font-size: inherit; text-transform: inherit; - color: var(--tainacan-secondary); + color: var(--tainacan-secondary) !important; padding: 0; margin: 0; font-weight: normal; - background: transparent; + background: transparent !important; &:hover { text-decoration: underline; @@ -82,6 +82,11 @@ button.link-style:active { height: 1.625em !important; line-height: 0.75em; } + &.is-loading { + color: transparent !important; + background-color: transparent !important; + border-color: var(--tainacan-gray2) !important; + } &:not(.is-small):not(.is-medium):not(.is-large) { height: 1.875em !important; font-size: 0.875em !important; diff --git a/src/views/admin/scss/_filters-menu-modal.scss b/src/views/admin/scss/_filters-menu-modal.scss index d40d2dbb9..ce1dceb2e 100644 --- a/src/views/admin/scss/_filters-menu-modal.scss +++ b/src/views/admin/scss/_filters-menu-modal.scss @@ -6,6 +6,7 @@ } .modal-content { + background-color: var(--tainacan-background-color); padding: 24px 18px var(--tainacan-one-column); padding: 24px 18px 24px 4.1666667vw; margin: 0; @@ -20,6 +21,7 @@ h3 { font-size: 1em; color: var(--tainacan-heading-color); + margin-bottom: 1em; } } @@ -40,6 +42,7 @@ margin: 0 12% 0 0; margin: 0 12vw 0 0; padding: var(--tainacan-container-padding); + max-width: calc(100% - 12vw) !important; } } } \ No newline at end of file diff --git a/src/views/admin/scss/_modals.scss b/src/views/admin/scss/_modals.scss index 0f5db5010..3e375325c 100644 --- a/src/views/admin/scss/_modals.scss +++ b/src/views/admin/scss/_modals.scss @@ -1,5 +1,5 @@ // Tainacan modals -.modal .animation-content { +.tainacan-modal .animation-content { background: none; width: calc(100% - (2 * var(--tainacan-one-column))); width: 91.6666667vw; @@ -13,11 +13,8 @@ max-height: 95vh; } } -.modal.is-full-screen > .animation-content, -.modal.is-full-screen > .animation-content > .modal-card { - background-color: transparent; -} -.modal .modal-close { + +.tainacan-modal .modal-close { z-index: 99999; @media only screen and (max-width: 768px) { &:before, &:after { background-color: #298596; } @@ -98,8 +95,9 @@ display: block; } } + // Bulma modals customized for Tainacan (custom-dialog.vue) -.dialog { +.tainacan-dialog { .modal-background { background-color: rgba(0, 0, 0, 0.70); diff --git a/src/views/admin/scss/_notices.scss b/src/views/admin/scss/_notices.scss index 3b29725fc..d861144fe 100644 --- a/src/views/admin/scss/_notices.scss +++ b/src/views/admin/scss/_notices.scss @@ -1,5 +1,5 @@ .notices { - z-index: 99999999; + z-index: 99999999; .toast, .snackbar { min-width: auto !important; @@ -12,24 +12,28 @@ &.is-dark .button:hover { background-color: var(--tainacan-gray2) !important; color: var(--tainacan-info-color) !important; + font-size: 0.875em; } &.is-warning, &.is-warning .button, &.is-warning .button:hover { background-color: var(--tainacan-yellow1) !important; color: var(--tainacan-warning) !important; + font-size: 0.875em; } &.is-danger, &.is-danger .button, &.is-danger .button:hover { background-color: var(--tainacan-red1) !important; color: var(--tainacan-danger) !important; + font-size: 0.875em; } &.is-success, &.is-success .button, &.is-success .button:hover { background-color: var(--tainacan-green1) !important; color: var(--tainacan-success) !important; + font-size: 0.875em; } } } \ No newline at end of file diff --git a/src/views/class-tainacan-admin.php b/src/views/class-tainacan-admin.php index 395ea82d5..abbfbeb6e 100644 --- a/src/views/class-tainacan-admin.php +++ b/src/views/class-tainacan-admin.php @@ -62,7 +62,7 @@ class Admin { $this->menu_slug, __('Reports', 'tainacan'), __('Reports', 'tainacan'), - 'read', + 'manage_tainacan', 'tainacan_reports', array( &$this, 'reports_page' ) ); diff --git a/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php b/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php index 829dda3e6..c70210dca 100644 --- a/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php +++ b/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php @@ -12,8 +12,8 @@ function tainacan_blocks_initialize() { add_action('init', 'tainacan_blocks_add_plugin_settings', 90); add_action('init', 'tainacan_blocks_add_plugin_admin_settings', 90); add_action('init', 'register_tainacan_blocks_add_gutenberg_blocks'); - add_action('wp_enqueue_scripts', 'unregister_taiancan_blocks'); - add_action('admin_enqueue_scripts', 'unregister_taiancan_blocks'); + add_action('wp_enqueue_scripts', 'unregister_tainacan_blocks'); + add_action('admin_enqueue_scripts', 'unregister_tainacan_blocks'); } } @@ -33,11 +33,11 @@ function register_tainacan_blocks_add_gutenberg_blocks() { tainacan_blocks_register_tainacan_carousel_collections_list(); } -function unregister_taiancan_blocks() { +function unregister_tainacan_blocks() { global $post; if(!$post) return; - $not_allowed = apply_filters('posts-names-to-unregister-taiancan-blocks', []); + $not_allowed = apply_filters('posts-names-to-unregister-tainacan-blocks', []); $current_page = $post->post_name; if ( in_array($current_page, $not_allowed) ) { diff --git a/src/views/gutenberg-blocks/gutenberg-blocks-style.scss b/src/views/gutenberg-blocks/gutenberg-blocks-style.scss index 6b94218ad..34f53b772 100644 --- a/src/views/gutenberg-blocks/gutenberg-blocks-style.scss +++ b/src/views/gutenberg-blocks/gutenberg-blocks-style.scss @@ -189,6 +189,10 @@ @media only screen and (max-width: 768px) { max-width: 80%; } } } + .components-radio-control__option .components-radio-control__input { + min-width: 20px; + min-height: 20px; + } .components-radio-control__option .components-radio-control__input::before { border-width: 0px; } diff --git a/src/views/gutenberg-blocks/tainacan-collections/carousel-collections-list/carousel-collections-list-theme.vue b/src/views/gutenberg-blocks/tainacan-collections/carousel-collections-list/carousel-collections-list-theme.vue index 499889d91..abe2776a7 100644 --- a/src/views/gutenberg-blocks/tainacan-collections/carousel-collections-list/carousel-collections-list-theme.vue +++ b/src/views/gutenberg-blocks/tainacan-collections/carousel-collections-list/carousel-collections-list-theme.vue @@ -245,6 +245,9 @@ export default { }, created() { this.tainacanAxios = axios.create({ baseURL: this.tainacanApiRoot }); + if (tainacan_plugin && tainacan_plugin.nonce) + this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce; + this.fetchCollections(); if (!isNaN(this.maxCollectionsPerScreen)) { diff --git a/src/views/gutenberg-blocks/tainacan-facets/facets-list/facets-list-theme.vue b/src/views/gutenberg-blocks/tainacan-facets/facets-list/facets-list-theme.vue index b4c84df9d..8e1dbfc7d 100644 --- a/src/views/gutenberg-blocks/tainacan-facets/facets-list/facets-list-theme.vue +++ b/src/views/gutenberg-blocks/tainacan-facets/facets-list/facets-list-theme.vue @@ -218,6 +218,8 @@ export default { }, created() { this.tainacanAxios = axios.create({ baseURL: this.tainacanApiRoot }); + if (tainacan_plugin && tainacan_plugin.nonce) + this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce; this.offset = 0; this.fetchFacets(); }, diff --git a/src/views/gutenberg-blocks/tainacan-items/carousel-items-list/carousel-items-list-theme.vue b/src/views/gutenberg-blocks/tainacan-items/carousel-items-list/carousel-items-list-theme.vue index 3d7839579..508dae783 100644 --- a/src/views/gutenberg-blocks/tainacan-items/carousel-items-list/carousel-items-list-theme.vue +++ b/src/views/gutenberg-blocks/tainacan-items/carousel-items-list/carousel-items-list-theme.vue @@ -254,6 +254,8 @@ export default { }, created() { this.tainacanAxios = axios.create({ baseURL: this.tainacanApiRoot }); + if (tainacan_plugin && tainacan_plugin.nonce) + this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce; if (this.showCollectionHeader) this.fetchCollectionForHeader(); diff --git a/src/views/gutenberg-blocks/tainacan-items/dynamic-items-list/dynamic-items-list-theme.vue b/src/views/gutenberg-blocks/tainacan-items/dynamic-items-list/dynamic-items-list-theme.vue index 4c2463cfe..4097b99e8 100644 --- a/src/views/gutenberg-blocks/tainacan-items/dynamic-items-list/dynamic-items-list-theme.vue +++ b/src/views/gutenberg-blocks/tainacan-items/dynamic-items-list/dynamic-items-list-theme.vue @@ -325,6 +325,9 @@ export default { }, created() { this.tainacanAxios = axios.create({ baseURL: this.tainacanApiRoot }); + if (tainacan_plugin && tainacan_plugin.nonce) + this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce; + this.localOrder = this.order; if (this.showCollectionHeader) diff --git a/src/views/gutenberg-blocks/tainacan-terms/carousel-terms-list/carousel-terms-list-theme.vue b/src/views/gutenberg-blocks/tainacan-terms/carousel-terms-list/carousel-terms-list-theme.vue index aee09e2c9..aaf215a67 100644 --- a/src/views/gutenberg-blocks/tainacan-terms/carousel-terms-list/carousel-terms-list-theme.vue +++ b/src/views/gutenberg-blocks/tainacan-terms/carousel-terms-list/carousel-terms-list-theme.vue @@ -219,6 +219,9 @@ export default { }, created() { this.tainacanAxios = axios.create({ baseURL: this.tainacanApiRoot }); + if (tainacan_plugin && tainacan_plugin.nonce) + this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce; + this.fetchTerms(); if (!isNaN(this.maxTermsPerScreen)) { diff --git a/src/views/item-submission/item-submission.vue b/src/views/item-submission/item-submission.vue index 7fa43c7b2..6929d07a9 100644 --- a/src/views/item-submission/item-submission.vue +++ b/src/views/item-submission/item-submission.vue @@ -52,26 +52,34 @@ export default { @import "../../../node_modules/buefy/src/scss/components/_notices.scss"; @import "../../../node_modules/buefy/src/scss/components/_numberinput.scss"; - // Tainacan imports - @import "../admin/scss/_tainacan-form.scss"; - @import "../admin/scss/_modals.scss"; - @import "../admin/scss/_buttons.scss"; - @import "../admin/scss/_inputs.scss"; - @import "../admin/scss/_checkboxes.scss"; - @import "../admin/scss/_radios.scss"; - @import "../admin/scss/_switches.scss"; - @import "../admin/scss/_pagination.scss"; - @import "../admin/scss/_tags.scss"; - @import "../admin/scss/_notices.scss"; - @import "../admin/scss/_tabs.scss"; - @import "../admin/scss/_selects.scss"; - @import "../admin/scss/_dropdown-and-autocomplete.scss"; - @import "../admin/scss/_tooltips.scss"; - @import "../admin/scss/_control.scss"; - @import "../admin/scss/_upload.scss"; + // Block level custom variables @import "../admin/scss/_custom_variables.scss"; - .tainacan-item-submission-form { + // These have to be outside of the scoped context + @import "../admin/scss/_tooltips.scss"; + @import "../admin/scss/_notices.scss"; + @import "../admin/scss/_modals.scss"; + + // Scoped, to avoid conflicts with theme's css + .tainacan-modal, + .tainacan-item-submission-form { + + // Tainacan imports + @import "../admin/scss/_tainacan-form.scss"; + @import "../admin/scss/_modals.scss"; + @import "../admin/scss/_buttons.scss"; + @import "../admin/scss/_inputs.scss"; + @import "../admin/scss/_checkboxes.scss"; + @import "../admin/scss/_radios.scss"; + @import "../admin/scss/_switches.scss"; + @import "../admin/scss/_pagination.scss"; + @import "../admin/scss/_tags.scss"; + @import "../admin/scss/_tabs.scss"; + @import "../admin/scss/_selects.scss"; + @import "../admin/scss/_dropdown-and-autocomplete.scss"; + @import "../admin/scss/_control.scss"; + @import "../admin/scss/_upload.scss"; + .tainacan-icon { opacity: 0; // Will make it 1 once window.load is done; } diff --git a/src/views/media-component/media-component.scss b/src/views/media-component/media-component.scss index b28f3e12e..da3355301 100644 --- a/src/views/media-component/media-component.scss +++ b/src/views/media-component/media-component.scss @@ -68,7 +68,7 @@ $pswp__include-minimal-style: true !default; li.swiper-slide { height: 100%; max-width: calc(100% - var(--swiper-navigation-size, 44px) - var(--swiper-navigation-size, 44px)); - min-width: 100%; + //min-width: 100%; padding: 0 var(--swiper-navigation-size, 44px); opacity: 1.0; transition: opacity 0.2s linear; @@ -112,32 +112,61 @@ $pswp__include-minimal-style: true !default; .swiper-slide-content { width: 100%; height: 100%; - display: flex; - align-items: center; - justify-content: center; - flex-direction: column; + display: block; + text-align: center; - .tainacan-embed-container { + .tainacan-content-embed { width: 100%; height: auto; + + &.tainacan-has-aspect-ratio { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 2) / 1); /* Default to 2:1 aspect ratio. */ + margin-left: auto; + margin-right: auto; + } + &.tainacan-embed-aspect-21-9 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 21) / 9); + } + &.tainacan-embed-aspect-18-9 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 18) / 9); + } + &.tainacan-embed-aspect-16-9 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 16) / 9); + } + &.tainacan-embed-aspect-4-3 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 4) / 3); + } + &.tainacan-embed-aspect-1-1 { + max-width: var(--tainacan-media-main-carousel-height, 60vh); + } + &.tainacan-embed-aspect-3-4 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 3) / 4); + } + &.tainacan-embed-aspect-9-16 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 9) / 16); + } + &.tainacan-embed-aspect-1-2 { + max-width: calc((var(--tainacan-media-main-carousel-height, 60vh) * 1) / 2); + } } iframe { max-height: var(--tainacan-media-main-carousel-height, 60vh); - width: 100%; max-width: 100%; + margin-left: auto; + margin-right: auto; border: none; display: block; background-image: url('../images/preloader.gif'); background-repeat: no-repeat; background-position: center; } - a:first-of-type, p:first-of-type { z-index: 99; background: var(--tainacan-media-background, #ffffff); border-radius: 3px; word-wrap: break-word; + padding: 1rem 2rem; } audio { background: black; @@ -157,6 +186,10 @@ $pswp__include-minimal-style: true !default; width: auto; max-height: var(--tainacan-media-main-carousel-height, 60vh); } + .twitter-tweet { + margin-left: auto; + margin-right: auto; + } } } .tainacan-media-component__swiper-thumbs { @@ -304,34 +337,68 @@ $pswp__include-minimal-style: true !default; .attachment-without-image { width: 100%; - height: 100%; + height: calc(100% - 44px); display: flex; - align-items: center; justify-content: center; + align-items: center; + text-align: center; + padding: 44px; + margin-top: 22px; - &.tainacan-embed-container:not(.tainacan-embed-without-iframe) { - padding: 0px; - } - .tainacan-embed-container .twitter-tweet { - width: 100vw !important; + &>iframe:not(.wp-embedded-content) { + width: 90vw; + height: 90vh; + border: none; + margin: 44px; + display: block; + background-image: url('../images/preloader.gif'); + background-repeat: no-repeat; + background-position: center; } } - - iframe { - padding: 44px; - min-height: 90vh; - max-height: 90vh; - height: 100%; - width: 100%; - max-width: 100%; - margin: 0 auto; + // PDFs file that come from document instead of attachments + .pswp__zoom-wrap>iframe#iframePDF { + width: 90vw; + height: 90vh; border: none; + margin: 44px auto; display: block; background-image: url('../images/preloader.gif'); background-repeat: no-repeat; background-position: center; } + .tainacan-content-embed { + width: 100%; + height: auto; + + &.tainacan-has-aspect-ratio { + max-width: calc((90vh * 2) / 1); /* Default to 2:1 aspect ratio. */ + margin-left: auto; + margin-right: auto; + } + &.tainacan-embed-aspect-21-9 { + max-width: calc((90vh * 21) / 9); + } + &.tainacan-embed-aspect-18-9 { + max-width: calc((90vh * 18) / 9); + } + &.tainacan-embed-aspect-16-9 { + max-width: calc((90vh * 16) / 9); + } + &.tainacan-embed-aspect-4-3 { + max-width: calc((90vh * 4) / 3); + } + &.tainacan-embed-aspect-1-1 { + max-width: 90vh; + } + &.tainacan-embed-aspect-9-16 { + max-width: calc((90vh * 9) / 16); + } + &.tainacan-embed-aspect-1-2 { + max-width: calc((90vh * 1) / 2); + } + } a:first-of-type, p:first-of-type , article:first-of-type { diff --git a/src/views/reports/components/activities-block.vue b/src/views/reports/components/activities-block.vue index 53a6b49f4..01bf644e9 100644 --- a/src/views/reports/components/activities-block.vue +++ b/src/views/reports/components/activities-block.vue @@ -92,7 +92,7 @@ @@ -98,6 +244,76 @@ export default { li { margin: 0 1em; } + .value { + text-align: center; + display: inline-flex; + } + } + &.number-block--items .status-list { + .tainacan-icon-private { + color: #01295c !important; + } + .tainacan-icon-draft { + color: #25a189 !important; + } + .tainacan-icon-delete { + color: #e69810 !important; + } + } + &.number-block--items, + &.number-block--taxonomies { + .subtitle { + margin-bottom: 1.25rem; + } + .status-list { + margin: 0.25em 0 0.1em 0; + } + } +} +.terms-used-info { + border-top: 1px solid #cbcbcb; + margin-top: 6px; + margin-bottom: 0px !important; + padding: 12px; +} +.visibility-charts { + display: flex; + width: calc(100% - 26px); + margin-top: 6px; + padding: 12px; + border-top: 1px solid #cbcbcb; + + &>div { + display: inline-flex; + justify-content: center; + align-items: center; + min-height: 18px; + color: white; + font-weight: bold; + position: relative; + background-color: var(--tainacan-turquoise6, #226f7d); + transition: width 0.2s ease, background-color 0.2s ease; + + &:nth-child(3) { + background-color: #01295c; + } + &:nth-child(4) { + background-color: #25a189; + } + &:nth-child(5) { + background-color: #e69810; + } + &:nth-child(6) { + opacity: 0.35; + } + &:nth-child(7) { + opacity: 0.25; + } + + .icon { + position: absolute; + top: 20px; + } } } \ No newline at end of file diff --git a/src/views/reports/components/tainacan-reports-subheader.vue b/src/views/reports/components/tainacan-reports-subheader.vue new file mode 100644 index 000000000..ba73fdde6 --- /dev/null +++ b/src/views/reports/components/tainacan-reports-subheader.vue @@ -0,0 +1,227 @@ + + + diff --git a/src/views/reports/components/terms-per-taxonomy-block.vue b/src/views/reports/components/terms-per-taxonomy-block.vue index 8af18a241..567f4b376 100644 --- a/src/views/reports/components/terms-per-taxonomy-block.vue +++ b/src/views/reports/components/terms-per-taxonomy-block.vue @@ -7,8 +7,23 @@ :series="chartSeries" :options="chartOptions" />
+
+

+ + + +  {{ $i18n.get('taxonomies') }} +

+
+

{{ $i18n.get('info_no_taxonomy_created') }}

+
+
+
diff --git a/src/views/reports/js/reports-main.js b/src/views/reports/js/reports-main.js index cbe7b4ee1..f9ee0b446 100644 --- a/src/views/reports/js/reports-main.js +++ b/src/views/reports/js/reports-main.js @@ -15,6 +15,7 @@ import { Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development'; import ReportsPage from '../reports.vue'; +import TainacanReportsSubheader from '../components/tainacan-reports-subheader.vue'; import NumberBlock from '../components/number-block.vue'; import ItemsPerTermBlock from '../components/items-per-term-block.vue'; import ItemsPerTermCollectionBlock from '../components/items-per-term-collection-block.vue'; @@ -41,6 +42,30 @@ Apex.colors = [ '#454647' // Tainacan Dark Gray ]; +/* Sets some locale configs */ +import enLocaleConfig from 'apexcharts/dist/locales/en.json'; +import esLocaleConfig from 'apexcharts/dist/locales/es.json'; +import frLocaleConfig from 'apexcharts/dist/locales/fr.json'; +import ptBrLocaleConfig from 'apexcharts/dist/locales/pt-br.json'; + +const availableLocales = ['en', 'es', 'fr', 'pt-br']; +const browserLanguage = navigator.language.toLocaleLowerCase(); + +if (availableLocales.indexOf(browserLanguage) >= 0) { + let localeConfig = {}; + + switch(browserLanguage) { + case 'es': localeConfig = esLocaleConfig; break; + case 'fr': localeConfig = frLocaleConfig; break; + case 'pt-br': localeConfig = ptBrLocaleConfig; break; + case 'en': default: localeConfig = enLocaleConfig; break; + } + Apex.chart = { + defaultLocale: browserLanguage, + locales: [ localeConfig ] + } +} + Vue.use(I18NPlugin); Vue.use(UserCapabilitiesPlugin); Vue.use(StatusHelperPlugin); @@ -48,6 +73,7 @@ Vue.use(VTooltip); Vue.use(Snackbar); Vue.use(Modal); +Vue.component('tainacan-reports-subheader', TainacanReportsSubheader); Vue.component('number-block', NumberBlock); Vue.component('items-per-term-block', ItemsPerTermBlock); Vue.component('items-per-term-collection-block', ItemsPerTermCollectionBlock); diff --git a/src/views/reports/pages/reports-list.vue b/src/views/reports/pages/reports-list.vue index 453c91710..c84523b19 100644 --- a/src/views/reports/pages/reports-list.vue +++ b/src/views/reports/pages/reports-list.vue @@ -1,21 +1,30 @@