Compare commits

..

137 Commits

Author SHA1 Message Date
Jens Pelzetter 43a9e73d33 Trying to get internal dependencies working
Former-commit-id: be89e4f360
2020-08-29 19:00:15 +02:00
Jens Pelzetter ee4618c67b Moved AdmimUi modules to /src/main, some small improvments
Former-commit-id: 4dbaa4fb83
2020-08-29 12:40:40 +02:00
Jens Pelzetter aefa2ae0d7 Some small fixes
Former-commit-id: fd2def3309
2020-08-28 21:25:54 +02:00
Jens Pelzetter 0cff7d753a Some bugfixes
Former-commit-id: 7c22396e28
2020-08-28 20:37:09 +02:00
Jens Pelzetter 02cb4ab656 Dashboard app for ccm-admin
Former-commit-id: 680e708e37
2020-08-28 14:49:38 +02:00
Jens Pelzetter 46ea2de206 Integration of Vue.js now working
Former-commit-id: 982f4f1fd5
2020-08-27 20:48:00 +02:00
Jens Pelzetter dfe36e2614 Redirect to login from new Admin UI app
Former-commit-id: a7e02d61b1
2020-08-26 15:17:00 +02:00
Jens Pelzetter 6041e355a5 Serving HTML and resources for Admin UI
Former-commit-id: fa7a74080d
2020-08-25 20:34:58 +02:00
Jens Pelzetter 1a81dccadd Java part of the Admin UI
Former-commit-id: a0ae1d1c64
2020-08-24 21:27:40 +02:00
Jens Pelzetter 8cd8f05054 Merge branch 'master' into restapi
Former-commit-id: c8138350b6
2020-08-21 17:23:55 +02:00
Jens Pelzetter 3a6da7c807 Rename, use Error subclasses instead of throwing strings
Former-commit-id: 83de873130
2020-08-14 20:00:31 +02:00
Jens Pelzetter 035bfa3731 Use Error subclasses instead of throwing strings
Former-commit-id: 2567bd1ee2
2020-08-14 18:47:21 +02:00
Jens Pelzetter 6fec8bbd1a Use Error subclasses instead of throwing strings
Former-commit-id: d0a881ec95
2020-08-14 17:28:27 +02:00
Jens Pelzetter c4d0ec6be0 Use Error subclasses instead of throwing strings
Former-commit-id: b92356b844
2020-08-14 17:16:06 +02:00
Jens Pelzetter 4452cb071d Use Error subclasses instead of throwing strings
Former-commit-id: 70568a65ff
2020-08-14 17:06:42 +02:00
Jens Pelzetter 734ca7623d typo
Former-commit-id: 5c0b0739ac
2020-08-14 16:43:40 +02:00
Jens Pelzetter aa7ae6520f Use Error subclasses instead of throwing strings
Former-commit-id: 6510eb65cb
2020-08-14 16:42:39 +02:00
Jens Pelzetter 554391e7fd Use Error subclasses instead of throwing strings
Former-commit-id: 676156d790
2020-08-14 11:52:24 +02:00
Jens Pelzetter 7e9242c005 Use Error subclasses instead of throwing strings
Former-commit-id: 0c659aa9a2
2020-08-14 07:14:48 +02:00
Jens Pelzetter 6ecf9993c7 Use Error subtypes instead of throwing strings
Former-commit-id: 66bc3d20bb
2020-08-13 14:43:34 +02:00
Jens Pelzetter 1149a20b89 Use Error instances for throw
Former-commit-id: 36755e9361
2020-08-12 19:11:06 +02:00
Jens Pelzetter fcd50df49d Use Error instances for throw
Former-commit-id: edcc000d57
2020-08-12 19:08:40 +02:00
Jens Pelzetter 93cb4ba102 ApiClientError class
Former-commit-id: 68e4208dc1
2020-08-12 13:53:38 +02:00
Jens Pelzetter 2f53cb4b67 Use Error for throw
Former-commit-id: 6dbc592026
2020-08-12 13:46:49 +02:00
Jens Pelzetter 259aacca67 Client for themes API finished
Former-commit-id: 344f8aa370
2020-08-11 17:27:34 +02:00
Jens Pelzetter 62faaf6384 More functions for the themes API
Former-commit-id: 37b2512ef2
2020-08-11 15:43:09 +02:00
Jens Pelzetter 910b61cd81 Additional endpoint for themes API for getting file info about a file in a theme
Former-commit-id: 09f020329e
2020-08-11 15:42:39 +02:00
Jens Pelzetter cdf82f4d06 Entity for TheneFileInfo
Former-commit-id: c436331e67
2020-08-10 20:57:21 +02:00
Jens Pelzetter 2e6c97b775 Implemented client functions for some of the API endpoints for theme management
Former-commit-id: 324574f314
2020-08-10 20:56:43 +02:00
Jens Pelzetter 34303af9fc JavaDoc
Former-commit-id: 39621f5811
2020-08-09 12:46:17 +02:00
Jens Pelzetter 3a72c79cd8 Update a theme by uploading a ZIP file
Former-commit-id: 413a6ab150
2020-08-09 12:33:58 +02:00
Jens Pelzetter 99a189534b Entities used by the RESTful API for managing themes
Former-commit-id: 589ca1a2c6
2020-08-08 19:27:57 +02:00
Jens Pelzetter 600a010ee9 Fixed wrong import
Former-commit-id: 3551dd4b6d
2020-08-08 13:34:58 +02:00
Jens Pelzetter de29bb6a3a Extended RESTful API for theme management
Former-commit-id: 3ef46aaf51
2020-08-07 17:33:41 +02:00
Jens Pelzetter 30cd9bae25 Optimizations for RESTful API for managing containers
Former-commit-id: 96dae5876b
2020-08-06 16:38:13 +02:00
Jens Pelzetter 429ceeea82 Optmiziations for the RESTful API managing containers of page models
Former-commit-id: 8472cb7e45
2020-08-06 16:21:30 +02:00
Jens Pelzetter e5d05e998d Started to refactor PageModelsApi to same structure used for other endpoints
Former-commit-id: 7819bd4146
2020-08-05 17:46:55 +02:00
Jens Pelzetter 35b86a224a Added methods with limit and offset parameter to page models repo
Former-commit-id: 1c34927e92
2020-08-05 17:46:24 +02:00
Jens Pelzetter 8b0e00dca8 Typos
Former-commit-id: 65eefb9f2f
2020-08-05 16:42:14 +02:00
Jens Pelzetter ac27d5ac61 Client for RESTful API for managing application instances
Former-commit-id: 96256d60ff
2020-08-05 16:41:38 +02:00
Jens Pelzetter d30cbc5ec7 Fixed a typo in a path param
Former-commit-id: 3738ff91a1
2020-08-05 16:37:05 +02:00
Jens Pelzetter 93e9063959 Methods renamed
Former-commit-id: 6b47fe0804
2020-08-05 16:36:15 +02:00
Jens Pelzetter 2ec5507c1a Fixed a typo in the a path of an endpoint
Former-commit-id: 781633c416
2020-08-05 16:32:50 +02:00
Jens Pelzetter 78b5eb4721 First part of API client for managing application instances
Former-commit-id: 102b984b5f
2020-08-04 18:08:37 +02:00
Jens Pelzetter 37cbfa0cf2 Removed unused import
Former-commit-id: 4b3126c56a
2020-08-04 16:42:29 +02:00
Jens Pelzetter 52ca67b4e3 Entities for RESTful API for managing application instances
Former-commit-id: 360afd6bdb
2020-08-04 16:41:54 +02:00
Jens Pelzetter cd34cdc597 Client for managing sites
Former-commit-id: d5901a160b
2020-08-03 17:36:49 +02:00
Jens Pelzetter fd5b69feed Rename to fit name pattern
Former-commit-id: dccf466e4d
2020-08-03 17:36:35 +02:00
Jens Pelzetter 5ff6a49819 Client for managing users with the RESTful API
Former-commit-id: d091c31d55
2020-08-03 17:04:55 +02:00
Jens Pelzetter 958f556307 Client for RESTful API for managing roles
Former-commit-id: 280af3f6e7
2020-08-02 13:11:49 +02:00
Jens Pelzetter dc928d32c9 Client for managing groups using the RESTful API
Former-commit-id: a6c4fbe02c
2020-08-02 11:45:09 +02:00
Jens Pelzetter c4cf6e8741 API Doc
Former-commit-id: 3a3de5dac7
2020-08-02 11:45:02 +02:00
Jens Pelzetter b2b8c62389 Small enhancements, including a method to build an identififer param based on the type of identifier
Former-commit-id: e72f901119
2020-08-02 11:42:11 +02:00
Jens Pelzetter ea1750ecd8 Fixed typo in path for endpoints
Former-commit-id: bffe5ca549
2020-08-02 11:40:39 +02:00
Jens Pelzetter 5867b26997 Fixed some minor problems
Former-commit-id: d51a0d04fe
2020-07-31 18:30:15 +02:00
Jens Pelzetter eb1948d817 Code documentation
Former-commit-id: 38d76fbcda
2020-07-31 18:30:00 +02:00
Jens Pelzetter cb0d700a24 First part of API client for managing groups
Former-commit-id: c9f879df94
2020-07-31 17:23:03 +02:00
Jens Pelzetter 1c5961a75c Split entities/security.ts into smaller files
Former-commit-id: e01f10c2aa
2020-07-31 17:22:41 +02:00
Jens Pelzetter d91b01fee7 Typo
Former-commit-id: 5741a04ac5
2020-07-30 18:54:55 +02:00
Jens Pelzetter 705210a5cc Build functions for entities for RESTful security API
Former-commit-id: 88fb1fb895
2020-07-30 18:54:20 +02:00
Jens Pelzetter bc6ddd90a2 Entitites for security RESTful API
Former-commit-id: 8e1dd0ae99
2020-07-29 20:42:13 +02:00
Jens Pelzetter d8c02b8917 Typos
Former-commit-id: 4f034241a2
2020-07-29 20:42:04 +02:00
Jens Pelzetter 42fb2eab80 Fixed a typo in the path of a endpoint
Former-commit-id: d20e3b91cd
2020-07-29 18:13:14 +02:00
Jens Pelzetter 026576eeed Client for RESTful for Im/Export
Former-commit-id: 1b8f00175c
2020-07-29 18:12:56 +02:00
Jens Pelzetter c8f1e568d8 Client for RESTful for managing the configuration of LibreCCM
Former-commit-id: 9b044a7e4a
2020-07-28 20:24:43 +02:00
Jens Pelzetter cc02865318 Formatting
Former-commit-id: f63b048826
2020-07-28 20:24:33 +02:00
Jens Pelzetter 9424f35c2d Configuration API, some general improvments for API client
Former-commit-id: 0b621bf7b4
2020-07-27 21:05:38 +02:00
Jens Pelzetter 53839265b6 Entities for configuration API
Former-commit-id: 4dc4e9855d
2020-07-27 17:53:05 +02:00
Jens Pelzetter 558d075931 Removed star import
Former-commit-id: 833faafbb6
2020-07-27 17:52:48 +02:00
Jens Pelzetter ea04e3ba19 RESTful API doc generation with swagger-codegen-maven-plugin
Former-commit-id: ae5a9d80aa
2020-07-27 17:52:16 +02:00
Jens Pelzetter 816c0649b9 Client for System Information RESTful API
Former-commit-id: b565805057
2020-07-26 12:52:16 +02:00
Jens Pelzetter 7ec1355a3b Client for categories API implemented
Former-commit-id: d05a72e9af
2020-07-26 11:28:43 +02:00
Jens Pelzetter 8865a4ef8a Better paths for CategoriesApi
Former-commit-id: c96a47990f
2020-07-26 11:28:21 +02:00
Jens Pelzetter 1f81207902 Migrated to offical OpenAPI Maven plugin
Former-commit-id: 79c6c7d812
2020-07-26 10:56:01 +02:00
Jens Pelzetter 52663e5b14 Implemented some more functions for the Core RESTful API
Former-commit-id: 79af35336c
2020-07-24 20:42:49 +02:00
Jens Pelzetter aae365f4f3 Fixed some typos
Former-commit-id: 445db26f33
2020-07-24 20:42:15 +02:00
Jens Pelzetter 78d9f512f6 Clients will be put into separate dir
Former-commit-id: 06d1e5b07c
2020-07-24 17:40:33 +02:00
Jens Pelzetter 77f7a76cd6 typo
Former-commit-id: 2c98dad058
2020-07-24 17:38:02 +02:00
Jens Pelzetter 529d7d0bde updateCategory, deleteCategory
Former-commit-id: af67ac1a97
2020-07-24 17:36:46 +02:00
Jens Pelzetter 8633bf3e53 Typo
Former-commit-id: 3e33913689
2020-07-24 17:36:38 +02:00
Jens Pelzetter 703e05e33d Better error handling
Former-commit-id: 0b440d649e
2020-07-24 17:14:38 +02:00
Jens Pelzetter 3add883c25 getCategories implemented for API client
Former-commit-id: b58517802d
2020-07-23 20:45:55 +02:00
Jens Pelzetter 2542eb4968 Utility functions for checking if an record has all required properties
Former-commit-id: af3c2b3da4
2020-07-23 20:25:23 +02:00
Jens Pelzetter 1b916fa7e9 Added a ok property to ApiResponse
Former-commit-id: 58fb0937d2
2020-07-23 19:10:17 +02:00
Jens Pelzetter 901375c4cc Current state of API client
Former-commit-id: aca84af322
2020-07-22 21:25:21 +02:00
Jens Pelzetter f1adb7f0ae Fixed some bugs
Former-commit-id: 736facc691
2020-07-21 21:05:11 +02:00
Jens Pelzetter 2e298bf267 Post impl for Node based API client
Former-commit-id: d90dd3eafa
2020-07-21 16:55:57 +02:00
Jens Pelzetter 3cb28232a6 Started implemention of ApiClient using the Node.js HTTP API
Former-commit-id: 5543dbbf39
2020-07-20 21:15:30 +02:00
Jens Pelzetter 4e046647c7 Fetch based client implemented
Former-commit-id: cabdae0c9e
2020-07-13 19:19:27 +02:00
Jens Pelzetter 5e4d73b44d Some more doc
Former-commit-id: df9b53680c
2020-07-12 12:16:59 +02:00
Jens Pelzetter 82a982ebf9 Cleanup of structure, documentation
Former-commit-id: 917961a570
2020-07-12 12:04:59 +02:00
Jens Pelzetter 1fdb60b045 Current status of ccm-apiclient-commons. Trying to figure best way for zero dependencies and supporting browsers and node environments
Former-commit-id: cdde8ce67a
2020-07-11 18:14:09 +02:00
Jens Pelzetter 6366cd60f3 Started implementation of API client for ccm-core
Former-commit-id: 01444aa09e
2020-07-10 20:48:01 +02:00
Jens Pelzetter 5423933d3e No longer using npm link for internal NPM modules, instead npm install ${filePath} is used.
Former-commit-id: 097412293f
2020-07-10 20:47:09 +02:00
Jens Pelzetter 61362d9448 RESTful API for Import and Export
Former-commit-id: 9aea37c68b
2020-07-07 16:49:38 +02:00
Jens Pelzetter ebf9d0d520 CcmApplicationsApi finished
Former-commit-id: bebe653cce
2020-07-03 17:53:39 +02:00
Jens Pelzetter d6758f478f RESTful endpoint for creating applications
Former-commit-id: 14f084eef7
2020-07-02 09:41:59 +02:00
Jens Pelzetter 5978b40989 Get methods for CcmApplicationsApi
Former-commit-id: 84c125128b
2020-07-01 21:21:10 +02:00
Jens Pelzetter 8dd3a112f7 Optimizations
Former-commit-id: 8a9ec963f4
2020-06-30 21:20:49 +02:00
Jens Pelzetter 40d1c34e86 Several optimizations
Former-commit-id: 88675a786a
2020-06-30 21:05:28 +02:00
Jens Pelzetter ecd4192aed Started implementation of RESTful API for application management
Former-commit-id: 98b082ca94
2020-06-30 21:04:55 +02:00
Jens Pelzetter af609f5c10 RESTful API for managing sites
Former-commit-id: f7571263da
2020-06-29 21:16:40 +02:00
Jens Pelzetter 4cc48686d5 RESTful API for PageModels
Former-commit-id: e7e5afab5c
2020-06-28 12:50:43 +02:00
Jens Pelzetter f7721dd41b Integrated SwaggerUI for docuementing RESTful API into Maven site
Former-commit-id: 477201b7e0
2020-06-21 13:12:20 +02:00
Jens Pelzetter 5d891c2c6d Improved paths for Configuration RESTful API
Former-commit-id: 11867e6fa2
2020-06-21 10:44:00 +02:00
Jens Pelzetter 4a64d03056 @Produces, @Consumes, @RequiresProvilege, @AuthorizedRequired and @Transactional annotations for ConfigurationApi
Former-commit-id: 31aa92f6ee
2020-06-20 16:49:43 +02:00
Jens Pelzetter 5f31e4ff45 RESTful API for configuration
Former-commit-id: 98f5d3201b
2020-06-20 16:47:18 +02:00
Jens Pelzetter 43b547e044 SystemInformation API
Former-commit-id: 0b9c2e9b27
2020-06-08 20:10:46 +02:00
Jens Pelzetter 264736422f RESTful API for Categories
Former-commit-id: 3b6f069895
2020-06-07 11:15:48 +02:00
Jens Pelzetter 813ff58daa Methods for deleting categories
Former-commit-id: 16bd34b7d7
2020-06-07 08:01:23 +02:00
Jens Pelzetter 8c6f68eb2b Update methods for CategoriesApi
Former-commit-id: 0c5c70e002
2020-06-06 18:09:43 +02:00
Jens Pelzetter a549db6035 Use Objects.equals where possible
Former-commit-id: 68f5b47da6
2020-06-06 17:59:58 +02:00
Jens Pelzetter acfa6b7b5b Some methods for the CategoriesApi
Former-commit-id: 4e688e4fcf
2020-06-06 17:04:33 +02:00
Jens Pelzetter ae8e504eaa Use UriInfo and URIBuilder for generating URI for created responses
Former-commit-id: a72ec4e8d9
2020-06-06 16:53:37 +02:00
Jens Pelzetter 407384a75a RESTful API for managing Domains
Former-commit-id: 10da2f6ef6
2020-06-06 16:15:15 +02:00
Jens Pelzetter 4a4e4beb78 Improvements for RESTful API
Former-commit-id: fe6e680733
2020-06-05 20:32:27 +02:00
Jens Pelzetter 2d15639124 All method definitions for the CategoriesApi are now in place
Former-commit-id: 8b3f843531
2020-06-05 07:21:35 +02:00
Jens Pelzetter 08cebebd02 More methods definitions for CategoriesApi
Former-commit-id: 6388ca7c62
2020-06-04 20:27:02 +02:00
Jens Pelzetter 9ceb480c23 DTOs for categories api
Former-commit-id: 39a5da0c04
2020-06-04 17:54:46 +02:00
Jens Pelzetter 94704d9e4a API for Category domains (only method definitions, no implementation yet)
Former-commit-id: 8fe5c38cb9
2020-06-04 12:01:44 +02:00
Jens Pelzetter ac6d3b3d65 Renaming
Former-commit-id: a93d0a66ce
2020-06-03 20:30:30 +02:00
Jens Pelzetter 568cfe243e Prepared API for domains and categories
Former-commit-id: 7f10899d45
2020-06-03 20:20:45 +02:00
Jens Pelzetter a467bcebb7 Replace obsolete import
Former-commit-id: ecd984f560
2020-06-03 20:20:29 +02:00
Jens Pelzetter b164d6e00b Replaced obsolete import
Former-commit-id: bfb5b1a44f
2020-06-03 20:20:09 +02:00
Jens Pelzetter 97c2ed46bf Fixed imports
Former-commit-id: 3550564f6e
2020-06-03 20:19:30 +02:00
Jens Pelzetter ba001cc04b API for roles
Former-commit-id: 7d787f98bd
2020-06-03 17:56:10 +02:00
Jens Pelzetter d2b702cb11 Moved duplicated methods into separate class, more implementations for RolesAPI
Former-commit-id: 632805d9ac
2020-05-31 16:52:56 +02:00
Jens Pelzetter f4fd2bab9a Reorg and more methods for RolesApi
Former-commit-id: 8fead43ead
2020-05-29 20:30:49 +02:00
Jens Pelzetter 76f510e84d Use DTO objects for API results instead of building JSON objects
Former-commit-id: 211467eb4e
2020-05-28 21:13:23 +02:00
Jens Pelzetter 73c0a45ce7 Started implementation of RESTful API endpoints for Roles
Former-commit-id: 7d6424dcd9
2020-05-27 21:37:34 +02:00
Jens Pelzetter a954ced804 Added JSON generate methods to some entities
Former-commit-id: 1d7f88829b
2020-05-27 21:37:09 +02:00
Jens Pelzetter 1a2c3087e3 Include overall number of results and other data in entpoints for retrieving all entities
Former-commit-id: c4dee6362c
2020-05-27 21:35:49 +02:00
Jens Pelzetter 38d541c18d More RESTful API
Former-commit-id: 81232cd19a
2020-05-26 15:18:17 +02:00
Jens Pelzetter 422f37747d Removed star import
Former-commit-id: ca2e2c3f97
2020-05-25 20:30:18 +02:00
Jens Pelzetter 141ce9f5a8 Formatting
Former-commit-id: 223555f416
2020-05-25 20:29:25 +02:00
Jens Pelzetter ec09fd98e4 RESTful API for managing users completed
Former-commit-id: b89c2a7076
2020-05-25 20:25:37 +02:00
Jens Pelzetter c2c50e5899 REST API for managing users
Former-commit-id: ce2147315d
2020-05-25 19:59:04 +02:00
2604 changed files with 276771 additions and 171413 deletions

5
.gitignore vendored
View File

@ -1,17 +1,12 @@
it-pgsql-datasources.properties it-pgsql-datasources.properties
nb-configuration.xml nb-configuration.xml
nbproject
node node
node_modules node_modules
runtime runtime
target target
.cache
.classpath .classpath
.factorypath .factorypath
.parcel-cache
.project .project
.settings .settings
.tscache .tscache
*.vscode *.vscode
/ccm-core/nbproject/
/ccm-cms/nbproject/

13
Jenkinsfile vendored
View File

@ -1,33 +1,28 @@
pipeline { pipeline {
agent any agent any
tools { tools {
maven 'apache-maven-3.8.4' maven 'apache-maven-3.6.0'
} }
stages { stages {
stage('Build and Test') { stage('Build and Test') {
steps { steps {
dir('') { dir('') {
//sh 'mvn clean package verify -Prun-its-with-wildfly-h2mem -Dwildfly.propertiesFile=/srv/libreccm-wildfly.properties' sh 'mvn clean verify -Prun-its-with-wildfly-h2mem -Dwildfly.propertiesFile=/srv/libreccm-wildfly.properties'
sh 'mvn clean package'
} }
} }
} }
stage("Analyse") { stage("Analyse") {
steps { steps {
dir('') { dir('') {
sh 'mvn package pmd:pmd pmd:cpd spotbugs:spotbugs' sh 'mvn pmd:pmd pmd:cpd spotbugs:spotbugs'
} }
} }
} }
stage("Deploy") { stage("Deploy") {
environment {
DEPLOY_TOKEN = credentials('gitea_libreccm_ci_packages')
NPM_TOKEN = credentials('gitea_libreccm_ci_packages')
}
steps { steps {
dir('') { dir('') {
configFileProvider([configFile(fileId: 'libreccm-packages-deploy', variable: 'MAVEN_SETTINGS')]) { configFileProvider([configFile(fileId: 'libreccm-packages-deploy', variable: 'MAVEN_SETTINGS')]) {
sh 'mvn -U -s "$MAVEN_SETTINGS" -e package deploy' sh 'mvn -U -s "$MAVEN_SETTINGS" -e deploy'
} }
} }
} }

View File

@ -0,0 +1,11 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
};

View File

@ -0,0 +1,3 @@
dist
node_modules
target

View File

@ -0,0 +1,17 @@
LibreCCM API Client Commons
===========================
This module provides several usaable parts of building clients for
specific endpoints of the LibreCCM RESTful API.
The `entities` module provides several entities used by various endpoints
of the RESTful API of LibreCCM.
The module also provides an HTTP client specially tailored for
the RESTful API of LibreCCM. The client is provided in several implementations:
For browsers, for node.js and an isomorphic implementation. In most cases
you will want to use the isomorphic implementation.
For most use cases it is recommanded to use the specific client APIs provided
by the LibreCCM modules which provided a more high-level interface to the RESTful
API of LibreCCM.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
{
"name": "@libreccm/ccm-apiclient-commons",
"version": "7.0.0",
"main": "target/dist/ccm-apiclient-commons.js",
"types": "dist/ccm-apiclient-commons.d.ts",
"description": "Client for the RESTful API provided by ccm-core.",
"repository": {
"type": "git",
"url": "https://github.com/libreccm/libreccm/ccm-apiclient-commons"
},
"author": "Jens Pelzetter",
"license": "GPL-3.0",
"scripts": {
"build": "tsc",
"check": "eslint",
"doc": "typedoc --out target/docs src/main/typescript"
},
"dependencies": {},
"devDependencies": {
"@types/node": "^12.12.50",
"@typescript-eslint/eslint-plugin": "^3.6.0",
"@typescript-eslint/parser": "^3.6.0",
"eslint": "^7.4.0",
"typedoc": "^0.17.8",
"typescript": "^3.9.6"
},
"prettier": {
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": false
}
}

View File

@ -0,0 +1,105 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.libreccm</groupId>
<artifactId>libreccm-parent</artifactId>
<version>7.0.0-SNAPSHOT</version>
</parent>
<groupId>org.libreccm</groupId>
<artifactId>ccm-apiclient-commons</artifactId>
<version>7.0.0-SNAPSHOT</version>
<name>LibreCCM API Client Commons</name>
<description>Provides basic classes and common datatypes for RESTful API clients</description>
<url>https://www.libreccm.org/ccm-apiclient-commons</url>
<licenses>
<license>
<name>Lesser GPL 2.1</name>
<url>http://www.gnu.org/licenses/old-licenses/lgpl-2.1</url>
</license>
</licenses>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<finalName>ccm-apiclient-commons</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/typescript</directory>
</resource>
<resource>
<directory>${project.build.directory}/generated-resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<configuration>
<installDirectory>../node</installDirectory>
</configuration>
<executions>
<execution>
<id>Install node.js and NPM</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>${nodeVersion}</nodeVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
<execution>
<id>npm publish</id>
<goals>
<goal>npm</goal>
</goals>
<phase>deploy</phase>
<configuration>
<arguments>publish --userconfig ../libreccm.npmrc</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
</dependencies>
</project>

View File

@ -0,0 +1,895 @@
import * as http from "http";
/**
* The interface of a client for the LibreCcm RESTful API.
*/
export interface LibreCcmApiClient {
/**
* Performs a `GET` request for the provided endpoint.
* Implementations should throw an {@link ApiError} if an error
* occurs.
*
* @param endpoint The API endpoint to use.
* @param searchParams Optional search parameters.
*/
get(
endpoint: string,
searchParams?: Record<string, string>
): Promise<ApiResponse>;
/**
* Performs a `POST` request for the provided endpoint.
* Implementations should throw an {@link ApiError} if an error
* occurs.
*
* @param endpoint The API endpoint to use.
* @param body The request body.
* @param searchParams Optional search parameters.
*/
post(
endpoint: string,
body?: RequestBody,
searchParams?: Record<string, string>
): Promise<ApiResponse>;
/**
* Performs a `PUT` request for the provided endpoint.
* Implementations should throw an {@link ApiError} if an error
* occurs.
*
* @param endpoint The API endpoint to use.
* @param body The request body.
* @param searchParams Optional search parameters.
*/
put(
endpoint: string,
body?: RequestBody,
searchParams?: Record<string, string>
): Promise<ApiResponse>;
/**
* Performs a `DELETE` request for the provided endpoint.
* Implementations should throw an {@link ApiError} if an error
* occurs.
*
* @param endpoint The API endpoint to use.
* @param searchParams Optional search parameters.
*/
delete(
endpoint: string,
searchParams?: Record<string, string>
): Promise<ApiResponse>;
/**
* Performs a `HEAD` request for the provided endpoint.
* Implementations should throw an {@link ApiError} if an error
* occurs.
*
* @param endpoint The API endpoint to use.
*/
head(endpoint: string): Promise<ApiResponse>;
/**
* Performs a `OPTIONS` request for the provided endpoint.
* Implementations should throw an {@link ApiError} if an error
* occurs.
*
* @param endpoint The API endpoint to use.
*/
options(endpoint: string): Promise<ApiResponse>;
}
export type RequestBody =
| Record<string, unknown>
| ArrayBuffer
| string
| undefined;
/**
* The response from the API.
*/
export interface ApiResponse {
/**
* Indicates that the request was processed successfully.
*/
ok: boolean;
/**
* The HTTP status code returned by the RESTful API.
*/
status: number;
/**
* The status text returned by the RESTful API.
*/
statusText: string;
/**
* Gets the Response Body as JSON.
*/
json(): Promise<unknown>;
/**
* Gets the Response Body as ArrayBuffer.
*/
arrayBuffer(): Promise<ArrayBuffer>;
/**
* Gets the Response Body as `string`.
*/
text(): Promise<string>;
}
export class ApiError extends Error {
/**
* The HTTP status code reported by the API. `-1` if no status is available.
*/
status: number;
/**
* The status text reported by the API.
*/
statusText: string;
/**
* The HTTP method used for the failed request.
*/
method: "get" | "post" | "put" | "delete" | "head" | "options";
/**
* The URL used in the failed request.
*/
url: string;
constructor(
status: number,
statusText: string,
method: "get" | "post" | "put" | "delete" | "head" | "options",
message: string,
url: string
) {
super(message);
this.status = status;
this.statusText = statusText;
this.method = method;
this.url = url;
}
}
/**
* A helper function for building an URL. Because it might be useful for implementing
* clients for specific APIs in the exported from this module.
*
* @param base The base URL pointing the an LibreCCM installation.
* @param endpoint The endpoint to address.
* @param searchParams Optional search parameter to append to the URL.
*/
export function buildUrl(
base: string,
endpoint: string,
searchParams?: Record<string, string>
): string {
const url = new URL(base);
url.pathname = endpoint;
if (searchParams) {
const urlSearchParams: URLSearchParams = new URLSearchParams();
for (const key in searchParams) {
urlSearchParams.append(key, searchParams[key]);
}
url.search = urlSearchParams.toString();
}
return url.href;
}
export function isFetchAvailable(): boolean {
if (!fetch) {
return false;
} else {
return true;
}
}
/**
* An implementation of the {@link ApiResponse} for the Fetch-API supported
* by browsers.
*/
class FetchResponse implements ApiResponse {
readonly ok: boolean;
readonly status: number;
readonly statusText: string;
#response: Response;
constructor(response: Response) {
this.status = response.status;
this.statusText = response.statusText;
this.ok = response.ok;
this.#response = response;
}
json(): Promise<unknown> {
return this.#response.json();
}
arrayBuffer(): Promise<ArrayBuffer> {
return this.#response.arrayBuffer();
}
text(): Promise<string> {
return this.#response.text();
}
}
/**
* An implementation of the {@link LibreCcmApiClient} interface
* using the Fetch-API supported by browsers.
*/
export class ApiClientFetchImpl implements LibreCcmApiClient {
readonly #baseUrl: string;
readonly #fetchOptions: RequestInit;
/**
*
* @param baseUrl The URL of the LibreCCM installation to use.
* @param fetchOptions Basic fetch options for requests.
*/
constructor(baseUrl: string, fetchOptions: RequestInit) {
this.#baseUrl = baseUrl;
this.#fetchOptions = fetchOptions;
}
private buildFetchOptions(
method: "get" | "post" | "put" | "delete" | "head" | "options",
body?: RequestBody
): RequestInit {
const fetchOptions: RequestInit = {
...this.#fetchOptions,
};
fetchOptions.method = method;
if (body) {
if (body instanceof ArrayBuffer) {
fetchOptions.body = body;
} else if (typeof body === "string") {
fetchOptions.body = body;
} else {
fetchOptions.body = JSON.stringify(body);
}
}
return fetchOptions;
}
async get(
endpoint: string,
searchParams?: Record<string, string>
): Promise<ApiResponse> {
const url = buildUrl(this.#baseUrl, endpoint, searchParams);
try {
const response = await fetch(url, this.buildFetchOptions("get"));
if (response.ok) {
return new FetchResponse(response);
} else {
throw new ApiError(
response.status,
response.statusText,
"get",
"API responded with an error",
url
);
}
} catch (err) {
throw new ApiError(
-1,
"n/a",
"get",
"`Failed to execute get: ${err}`",
url
);
}
}
async post(
endpoint: string,
body?: RequestBody,
searchParams?: Record<string, string>
): Promise<ApiResponse> {
const url = buildUrl(this.#baseUrl, endpoint, searchParams);
try {
const response = await fetch(
url,
this.buildFetchOptions("post", body)
);
if (response.ok) {
return new FetchResponse(response);
} else {
throw new ApiError(
response.status,
response.statusText,
"get",
"API responded with an error",
url
);
}
} catch (err) {
throw new ApiError(
-1,
"n/a",
"get",
`Failed to execute get: ${err}`,
url
);
}
}
async put(
endpoint: string,
body?: RequestBody,
searchParams?: Record<string, string>
): Promise<ApiResponse> {
const url = buildUrl(this.#baseUrl, endpoint, searchParams);
try {
const response = await fetch(
url,
this.buildFetchOptions("put", body)
);
if (response.ok) {
return new FetchResponse(response);
} else {
throw new ApiError(
response.status,
response.statusText,
"get",
"API responded with an error.",
url
);
}
} catch (err) {
throw new ApiError(
-1,
"n/a",
"get",
`Failed to execute get: ${err}`,
url
);
}
}
async delete(
endpoint: string,
searchParams?: Record<string, string>
): Promise<ApiResponse> {
const url = buildUrl(this.#baseUrl, endpoint, searchParams);
try {
const response = await fetch(url, this.buildFetchOptions("delete"));
if (response.ok) {
return new FetchResponse(response);
} else {
throw new ApiError(
response.status,
response.statusText,
"get",
"API responded with an error.",
url
);
}
} catch (err) {
throw new ApiError(
-1,
"n/a",
"get",
`Failed to execute get: ${err}`,
url
);
}
}
async head(endpoint: string): Promise<ApiResponse> {
const url = buildUrl(this.#baseUrl, endpoint);
try {
const response = await fetch(url, this.buildFetchOptions("head"));
if (response.ok) {
return new FetchResponse(response);
} else {
throw new ApiError(
response.status,
response.statusText,
"get",
"API responded with an error.",
url
);
}
} catch (err) {
throw new ApiError(
-1,
"n/a",
"get",
`Failed to execute get: ${err}`,
url
);
}
}
async options(endpoint: string): Promise<ApiResponse> {
const url = buildUrl(this.#baseUrl, endpoint);
try {
const response = await fetch(
url,
this.buildFetchOptions("options")
);
if (response.ok) {
return new FetchResponse(response);
} else {
throw new ApiError(
response.status,
response.statusText,
"get",
"API responded with an error.",
url
);
}
} catch (err) {
throw new ApiError(
-1,
"n/a",
"get",
`Failed to execute get: ${err}`,
url
);
}
}
}
/**
* An implementation of the {@link ApiResponse} for the Node.js HTTP API supported
* by browsers.
*/
class NodeResponse implements ApiResponse {
readonly ok: boolean;
readonly status: number;
readonly statusText: string;
#data: Buffer | null;
constructor(
ok: boolean,
status: number,
statusText: string,
data: Buffer | null
) {
this.ok = ok;
this.status = status;
this.statusText = statusText;
this.#data = data;
}
json(): Promise<unknown> {
return new Promise((resolve, reject) => {
try {
if (this.#data) {
resolve(this.#data.toJSON());
} else {
resolve({});
}
} catch (err) {
reject(err);
}
});
}
arrayBuffer(): Promise<ArrayBuffer> {
return new Promise((resolve, reject) => {
try {
if (this.#data) {
const arrayBuf: ArrayBuffer = this.#data.buffer.slice(
this.#data.byteOffset,
this.#data.byteLength + this.#data.byteLength
);
resolve(arrayBuf);
} else {
resolve(new ArrayBuffer(0));
}
} catch (err) {
reject(err);
}
});
}
text(): Promise<string> {
return new Promise((resolve, reject) => {
try {
if (this.#data) {
resolve(this.#data.toString());
} else {
resolve("");
}
} catch (err) {
reject(err);
}
});
}
}
/**
* An implementation of the {@link LibreCcmApiClient} interface using the HTTP API
* provided by node.js.
*/
export class ApiClientNodeImpl implements LibreCcmApiClient {
readonly #baseUrl: string;
readonly #jwt: string;
constructor(baseUrl: string, jwt: string) {
this.#baseUrl = baseUrl;
this.#jwt = jwt;
}
get(
endpoint: string,
searchParams?: Record<string, string>
): Promise<ApiResponse> {
return new Promise((resolve, reject) => {
const url = buildUrl(this.#baseUrl, endpoint, searchParams);
const request: http.ClientRequest = http.request(url, {
headers: {
Authorization: this.#jwt,
},
method: "GET",
});
request.on("response", (response) => {
const status: number = response.statusCode
? response.statusCode
: -1;
const statusText: string = response.statusMessage
? response.statusMessage
: "";
const data: Array<Buffer> = [];
response.on("data", (chunk: Buffer) => {
data.push(chunk);
});
response.on("end", () => {
const buffer: Buffer = Buffer.concat(data);
const apiResponse: ApiResponse = new NodeResponse(
status === 200,
status,
statusText,
buffer
);
resolve(apiResponse);
});
});
request.on("error", (error) =>
reject(
new ApiError(
-1,
"n/a",
"get",
`Failed to do GET: ${error}`,
url
)
)
);
request.end();
});
}
post(
endpoint: string,
body?: ArrayBuffer,
searchParams?: Record<string, string>
): Promise<ApiResponse> {
return new Promise((resolve, reject) => {
const url = buildUrl(this.#baseUrl, endpoint, searchParams);
const request: http.ClientRequest = http.request(url, {
headers: {
Authorization: this.#jwt,
},
method: "POST",
});
request.on("response", (response) => {
const status: number = response.statusCode
? response.statusCode
: -1;
const statusText: string = response.statusMessage
? response.statusMessage
: "";
response.on("end", () => {
const apiResponse: ApiResponse = new NodeResponse(
status === 200 || status === 201,
status,
statusText,
null
);
resolve(apiResponse);
});
});
request.on("error", (error) =>
reject(
new ApiError(
-1,
"n/a",
"post",
`Failed to do POST: ${error}`,
url
)
)
);
if (body) {
request.write(body);
}
request.end();
});
}
put(
endpoint: string,
body?: ArrayBuffer,
searchParams?: Record<string, string>
): Promise<ApiResponse> {
return new Promise((resolve, reject) => {
const url = buildUrl(this.#baseUrl, endpoint, searchParams);
const request: http.ClientRequest = http.request(url, {
headers: {
Authorization: this.#jwt,
},
method: "PUT",
});
request.on("response", (response) => {
const status: number = response.statusCode
? response.statusCode
: -1;
const statusText: string = response.statusMessage
? response.statusMessage
: "";
response.on("end", () => {
const apiResponse: ApiResponse = new NodeResponse(
status === 200 || status === 201,
status,
statusText,
null
);
resolve(apiResponse);
});
});
request.on("error", (error) =>
reject(
new ApiError(
-1,
"n/a",
"put",
`Failed to do PUT: ${error}`,
url
)
)
);
if (body) {
request.write(body);
}
request.end();
});
}
delete(
endpoint: string,
searchParams?: Record<string, string>
): Promise<ApiResponse> {
return new Promise((resolve, reject) => {
const url = buildUrl(this.#baseUrl, endpoint, searchParams);
const request: http.ClientRequest = http.request(url, {
headers: {
Authorization: this.#jwt,
},
method: "DELETE",
});
request.on("response", (response) => {
const status: number = response.statusCode
? response.statusCode
: -1;
const statusText: string = response.statusMessage
? response.statusMessage
: "";
response.on("end", () => {
const apiResponse: ApiResponse = new NodeResponse(
status === 200 || status === 204,
status,
statusText,
null
);
resolve(apiResponse);
});
});
request.on("error", (error) =>
reject(
new ApiError(
-1,
"n/a",
"delete",
`Failed to do DELETE: ${error}`,
url
)
)
);
request.end();
});
}
head(endpoint: string): Promise<ApiResponse> {
return new Promise((resolve, reject) => {
const url = buildUrl(this.#baseUrl, endpoint);
const request: http.ClientRequest = http.request(url, {
headers: {
Authorization: this.#jwt,
},
method: "HEAD",
});
request.on("response", (response) => {
const status: number = response.statusCode
? response.statusCode
: -1;
const statusText: string = response.statusMessage
? response.statusMessage
: "";
const data: Array<Buffer> = [];
response.on("data", (chunk: Buffer) => {
data.push(chunk);
});
response.on("end", () => {
const buffer: Buffer = Buffer.concat(data);
const apiResponse: ApiResponse = new NodeResponse(
status === 200,
status,
statusText,
buffer
);
resolve(apiResponse);
});
});
request.on("error", (error) =>
reject(
new ApiError(
-1,
"n/a",
"head",
`Failed to do HEAD: ${error}`,
url
)
)
);
request.end();
});
}
options(endpoint: string): Promise<ApiResponse> {
return new Promise((resolve, reject) => {
const url = buildUrl(this.#baseUrl, endpoint);
const request: http.ClientRequest = http.request(url, {
headers: {
Authorization: this.#jwt,
},
method: "OPTIONS",
});
request.on("response", (response) => {
const status: number = response.statusCode
? response.statusCode
: -1;
const statusText: string = response.statusMessage
? response.statusMessage
: "";
const data: Array<Buffer> = [];
response.on("data", (chunk: Buffer) => {
data.push(chunk);
});
response.on("end", () => {
const buffer: Buffer = Buffer.concat(data);
const apiResponse: ApiResponse = new NodeResponse(
status === 200,
status,
statusText,
buffer
);
resolve(apiResponse);
});
});
request.on("error", (error) =>
reject(
new ApiError(
-1,
"n/a",
"options",
`Failed to do OPTIONS: ${error}`,
url
)
)
);
request.end();
});
}
}
/**
* An isomorphic implementation of the {@link LibreCcmApiClient} interface.
* Under the hood the implementation checks if the the Fetch-API is avaiable
* and used either the {@link ApiClientFetchImpl} or the {@link ApiClientNodeImpl}.
*/
export class IsomorphicClientImpl implements LibreCcmApiClient {
readonly #fetchClient: LibreCcmApiClient;
readonly #nodeClient: LibreCcmApiClient;
constructor(fetchClient: LibreCcmApiClient, nodeClient: LibreCcmApiClient) {
this.#fetchClient = fetchClient;
this.#nodeClient = nodeClient;
}
get(
endpoint: string,
searchParams?: Record<string, string>
): Promise<ApiResponse> {
if (isFetchAvailable()) {
return this.#fetchClient.get(endpoint, searchParams);
} else {
return this.#nodeClient.get(endpoint, searchParams);
}
}
post(
endpoint: string,
body: ArrayBuffer,
searchParams?: Record<string, string>
): Promise<ApiResponse> {
if (isFetchAvailable()) {
return this.#fetchClient.post(endpoint, body, searchParams);
} else {
return this.#nodeClient.post(endpoint, body, searchParams);
}
}
put(
endpoint: string,
body?: ArrayBuffer,
searchParams?: Record<string, string>
): Promise<ApiResponse> {
if (isFetchAvailable()) {
return this.#fetchClient.put(endpoint, body, searchParams);
} else {
return this.#nodeClient.put(endpoint, body, searchParams);
}
}
delete(
endpoint: string,
searchParams?: Record<string, string>
): Promise<ApiResponse> {
if (isFetchAvailable()) {
return this.#fetchClient.delete(endpoint, searchParams);
} else {
return this.#nodeClient.delete(endpoint, searchParams);
}
}
head(endpoint: string): Promise<ApiResponse> {
if (isFetchAvailable()) {
return this.#fetchClient.head(endpoint);
} else {
return this.#nodeClient.head(endpoint);
}
}
options(endpoint: string): Promise<ApiResponse> {
if (isFetchAvailable()) {
return this.#fetchClient.options(endpoint);
} else {
return this.#nodeClient.options(endpoint);
}
}
}

View File

@ -0,0 +1,189 @@
import {
LibreCcmApiClient,
ApiResponse,
ApiError,
buildUrl,
ApiClientFetchImpl,
ApiClientNodeImpl,
isFetchAvailable,
IsomorphicClientImpl,
} from "./ApiClient";
export * from "./entities";
export { LibreCcmApiClient, ApiResponse, ApiError, buildUrl };
/**
* Build an client for the LibreCCM RESTful API suitable for use in
* clientside code served by the Application Server.
*
* The base URL for accessing the LibreCCM RESTful API is automatically
* determined from the URL of the current document. The API client will
* use the credentials stored in the browser (cookies) to authenticate itself.
*/
export function buildEmbeddedApiClient(): LibreCcmApiClient {
if (!isFetchAvailable()) {
throw new Error(
"Fetch API is not available. Please use buildIsomorpicApiClient."
);
}
const baseUrl = new URL(document.documentURI);
baseUrl.hash = "";
baseUrl.password = "";
baseUrl.pathname = "";
baseUrl.search = "";
baseUrl.username = "";
return new ApiClientFetchImpl(baseUrl.href, {
credentials: "include",
mode: "same-origin",
});
}
/**
* Builds a client for the LibreCCM RESTful API suitable for running in a browser.
*
* @param baseUrl The URL of the LibreCCM installation to access, including the port.
* @param jwt The JSON Web Token to use by the client to authenticate itself.
*/
export function buildRemoteApiClient(
baseUrl: string,
jwt: string
): LibreCcmApiClient {
if (!isFetchAvailable()) {
throw new Error(
"Fetch API is not available. Please use buildIsomorpicApiClient."
);
}
return new ApiClientFetchImpl(baseUrl, {
headers: {
Authorization: jwt,
},
});
}
/**
* Builds a client for the LibreCCM RESTful API suitable for running inside a node.js
* environment.
*
* @param baseUrl The URL of the LibreCCM installation to access, including the port.
* @param jwt The JSON Web Token to use by the client to authenticate itself.
*/
export function buildNodeApiClient(
baseUrl: string,
jwt: string
): LibreCcmApiClient {
return new ApiClientNodeImpl(baseUrl, jwt);
}
/**
* Builds an isomorphic client for the LibreCCM RESTful API which will work in the
* browser and in a node.js environment. Use this function to create an API client
* for JavaScript applications which use Server-Side-Rendering.
*
* @param baseUrl The URL of the LibreCCM installation to access, including the port.
* @param jwt The JSON Web Token to use by the client to authenticate itself.
*/
export function buildIsomorpicApiClient(
baseUrl: string,
jwt: string
): LibreCcmApiClient {
const fetchClient: LibreCcmApiClient = buildRemoteApiClient(baseUrl, jwt);
const nodeClient: LibreCcmApiClient = buildNodeApiClient(baseUrl, jwt);
return new IsomorphicClientImpl(fetchClient, nodeClient);
}
/**
* An utility function for checking if an record has specific properties.
*
* @param record The record to check.
* @param properties The required properties.
*
* @return `true` if all properties are found in the record, `false` otherwise.
*/
export function hasProperties(
record: Record<string, unknown>,
properties: string[]
): boolean {
const keys = Object.keys(record);
return properties.every((property) => keys.includes(property));
}
/**
* An utility function for checking if an record has specific properties. If
* one of the properties is not found, the function will throw an error.
*
* @param record The record to check.
* @param properties The required properties.
*/
export function assertProperties(
record: Record<string, unknown>,
properties: string[]
): void {
const missing = findMissingProperties(record, properties);
if (missing.length > 0) {
throw new MissingPropertiesError(missing);
}
}
export class MissingPropertiesError extends Error {
constructor(missingProperties: string[]) {
super(`record is missing the following required properties:
${missingProperties.join(",")}`);
this.name = "MissingPropertiesError";
}
}
/**
* An utility function which checks which of the given properties the provided
* record is missing.
*
* @param record The record to check.
* @param properties The requird properties.
*
* @return An array with all missing properties.
*/
export function findMissingProperties(
record: Record<string, unknown>,
properties: string[]
): string[] {
const keys = Object.keys(record);
return properties.filter((property) => !keys.includes(property));
}
/**
* Builds an identifier parameter from the the provided parameter. If the
* parameter is a number it is converted to a string and prefixed with `ID-`.
* If the parameter matches the regex for a UUID, the identifier is prefixed
* with `UUID-`. Otherwise the identifier is returned as it is.
*
* @param identifier The identifier to process.
*/
export function buildIdentifierParam(identifier: string | number): string {
if (typeof identifier === "number") {
return `ID-${identifier}`;
} else {
const strIdentifier: string = identifier as string;
if (
strIdentifier.match(
/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/g
)
) {
return `UUID-${identifier}`;
} else {
return identifier;
}
}
}
/**
* Error which should be thrown by clients for errors of the client side.
*/
export class ApiClientError extends Error {
constructor(message: string) {
super(message);
this.name = "ApiClientError";
}
}

View File

@ -0,0 +1,32 @@
/**
* A list view contains an array of objects and some data about the list.
*/
export interface ListView<T> {
/**
* The list of objects
*/
list: T[],
/**
* The number of elements for the query.
*/
count: number,
/**
* Items per page
*/
limit: number,
/**
* The first item shown
*/
offset: number,
}
/**
* Properties of the type `LocalizedString` are used in several entities
* returned by various of the endpoints the RESTful API of LibreCCM.
* Each `LocalizedString` consists of various values with the language
* as key.
*/
export interface LocalizedString {
values: Record<string, string>
}

View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"module": "es6",
"moduleResolution": "node",
"outDir": "dist",
"declaration": true,
"sourceMap": true,
"strict": true,
"target": "es6"
},
"include": [
"src/main/typescript/**/*"
]
}

View File

@ -183,8 +183,13 @@
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version> <version>2.10.3</version>
<configuration> <configuration>
<detectLinks>false</detectLinks> <detectLinks>true</detectLinks>
<detectJavaApiLinks>false</detectJavaApiLinks> <detectJavaApiLinks>true</detectJavaApiLinks>
<links>
<link>http://docs.oracle.com/javase/7/docs/api/</link>
<link>http://docs.oracle.com/javaee/7/api/</link>
<link>http://docs.jboss.org/hibernate/orm/4.3/javadocs/</link>
</links>
<show>private</show> <show>private</show>
<docfilessubdirs>true</docfilessubdirs> <docfilessubdirs>true</docfilessubdirs>
<charset>UTF-8</charset> <charset>UTF-8</charset>
@ -195,6 +200,16 @@
<author>true</author> <author>true</author>
<keywords>true</keywords> <keywords>true</keywords>
<failOnError>false</failOnError> <failOnError>false</failOnError>
<doclet>org.jboss.apiviz.APIviz</doclet>
<docletArtifact>
<groupId>org.jboss.apiviz</groupId>
<artifactId>apiviz</artifactId>
<version>1.3.2.GA</version>
</docletArtifact>
<useStandardDocletOptions>true</useStandardDocletOptions>
<additionalparam>
-sourceclasspath ${project.build.outputDirectory}
</additionalparam>
</configuration> </configuration>
</plugin> </plugin>
@ -221,7 +236,7 @@
<configuration> <configuration>
<linkXref>true</linkXref> <linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding> <sourceEncoding>utf-8</sourceEncoding>
<targetJdk>11</targetJdk> <targetJdk>1.8</targetJdk>
<rulesets> <rulesets>
<ruleset>/rulesets/java/basic.xml</ruleset> <ruleset>/rulesets/java/basic.xml</ruleset>
<ruleset>/rulesets/java/braces.xml</ruleset> <ruleset>/rulesets/java/braces.xml</ruleset>

View File

@ -0,0 +1,204 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.libreccm</groupId>
<artifactId>ccm-bundle-devel</artifactId>
<relativePath>../ccm-bundle-devel</relativePath>
<version>7.0.0-SNAPSHOT</version>
</parent>
<groupId>org.libreccm</groupId>
<artifactId>ccm-bundle-devel-thorntail</artifactId>
<packaging>war</packaging>
<name>LibreCCM Devel Bundle for Thorntail</name>
<url>http://www.libreccm.org</url>
<distributionManagement>
<site>
<id>libreccm-site</id>
<name>LibreCCM</name>
<url>http://www.libreccm.org/project-sites/</url>
</site>
</distributionManagement>
<organization>
<name>LibreCCM Foundation</name>
</organization>
<licenses>
<license>
<name>LGPLv2 or newer</name>
<url>http://www.gnu.org/licenses/lgpl-2.0.html</url>
</license>
</licenses>
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
<!-- <dependencyManagement>
<dependencies>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>bom</artifactId>
<version>2.4.0.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>-->
<dependencies>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>cdi</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>datasources</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>ejb</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>hibernate-search</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs</artifactId>
</dependency>
<!-- <dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs-cdi</artifactId>
</dependency>-->
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs-jsonp</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jpa</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jsf</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jsonp</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>logging</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>mail</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>undertow</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5.jre7</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>requirejs</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>requirejs-domready</artifactId>
</dependency>
</dependencies>
<build>
<finalName>ccm-bundle-devel-wildfly</finalName>
<plugins>
<plugin>
<groupId>io.thorntail</groupId>
<artifactId>thorntail-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<overlays>
<overlay>
<groupId>org.libreccm</groupId>
<artifactId>ccm-editor</artifactId>
<type>jar</type>
</overlay>
<overlay>
<groupId>org.libreccm</groupId>
<artifactId>ccm-theme-foundry</artifactId>
<type>jar</type>
</overlay>
<overlay>
<groupId>org.libreccm</groupId>
<artifactId>ccm-core</artifactId>
<type>jar</type>
<includes>
<include>assets/</include>
</includes>
</overlay>
<overlay>
<groupId>org.librecms</groupId>
<artifactId>ccm-cms</artifactId>
<type>jar</type>
<includes>
<include>templates/</include>
</includes>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,215 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!--<parent>
<groupId>org.libreccm</groupId>
<artifactId>libreccm-parent</artifactId>
<version>7.0.0-SNAPSHOT</version>
</parent>-->
<parent>
<groupId>org.libreccm</groupId>
<artifactId>ccm-bundle-devel</artifactId>
<relativePath>../ccm-bundle-devel</relativePath>
<version>7.0.0-SNAPSHOT</version>
</parent>
<groupId>org.libreccm</groupId>
<artifactId>ccm-bundle-devel-wildfly-swarm</artifactId>
<packaging>war</packaging>
<name>LibreCCM Devel Bundle for Wildfly Swarm</name>
<url>http://www.libreccm.org</url>
<distributionManagement>
<site>
<id>libreccm-site</id>
<name>LibreCCM</name>
<url>http://www.libreccm.org/project-sites/</url>
</site>
</distributionManagement>
<organization>
<name>LibreCCM Foundation</name>
</organization>
<licenses>
<license>
<name>LGPLv2 or newer</name>
<url>http://www.gnu.org/licenses/lgpl-2.0.html</url>
</license>
</licenses>
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>bom-all</artifactId>
<version>2017.11.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>cdi</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>container</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>datasources</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>ejb</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>hibernate-search</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>jaxrs</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>jaxrs-cdi</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>jpa</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>jsf</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>logging</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>mail</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>undertow</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.1.4.jre7</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId>
<version>4.7.0</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>requirejs</artifactId>
<version>2.3.5</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>requirejs-domready</artifactId>
<version>2.0.1-2</version>
</dependency>
</dependencies>
<build>
<finalName>ccm-bundle-devel-wildfly</finalName>
<plugins>
<plugin>
<groupId>org.wildfly.swarm</groupId>
<artifactId>wildfly-swarm-plugin</artifactId>
<!--<configuration>
<mainClass>org.libreccm.CcmBundleDevel</mainClass>
</configuration>-->
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<overlays>
<overlay>
<groupId>org.libreccm</groupId>
<artifactId>ccm-editor</artifactId>
<type>jar</type>
</overlay>
<overlay>
<groupId>org.libreccm</groupId>
<artifactId>ccm-theme-foundry</artifactId>
<type>jar</type>
</overlay>
<overlay>
<groupId>org.libreccm</groupId>
<artifactId>ccm-core</artifactId>
<type>jar</type>
<includes>
<include>assets/</include>
<include>VAADIN/</include>
</includes>
</overlay>
<overlay>
<groupId>org.librecms</groupId>
<artifactId>ccm-cms</artifactId>
<type>jar</type>
<includes>
<include>templates/</include>
</includes>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,19 @@
package org.libreccm;
import org.wildfly.swarm.Swarm;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class CcmBundleDevel {
public static void main(final String[] args) throws Exception {
final Swarm swarm = new Swarm();
swarm.start();
}
}

View File

@ -0,0 +1,19 @@
package org.libreccm;
import org.wildfly.swarm.Swarm;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class CcmBundleDevel {
public static void main(final String[] args) throws Exception {
final Swarm swarm = new Swarm();
swarm.start();
}
}

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="warn">
<AppenderRef ref="Console"/>
</Root>
<!--<Logger name="org.hibernate"
level="info">
</Logger>
<Logger name="org.hibernate.SQL"
level="debug">
</Logger>
<Logger name="org.hibernate.type"
level="trace">
</Logger>
<Logger name="org.hibernate.type.descriptor.sql"
level="trace">
</Logger>-->
<!--<Logger name="com.arsdigita.bebop.util.Traversal"
level="debug">
</Logger>-->
<Logger name="com.arsdigita.cms.ui.assets.AssetFolderBrowserController"
level="debug">
</Logger>
<Logger name="com.arsdigita.cms.ui.folder.FolderBrowserTableModelBuilder"
level="debug">
</Logger>
<Logger name="com.arsdigita.ui.admin.AdminServlet"
level="debug">
</Logger>
<Logger name="com.arsdigita.ui.admin.configuration.ConfigurationTable"
level="debug">
</Logger>
<Logger name="com.arsdigita.ui.admin.usersgroupsroles.UsersTable"
level="debug">
</Logger>
<Logger name="com.arsdigita.cms.ui.assets.AssetPane"
level="debug">
</Logger>
<Logger name="com.arsdigita.ui.login.UserLoginForm"
level="debug">
</Logger>
<Logger name="com.arsdigita.packaging.Config"
level="debug">
</Logger>
<Logger name="com.arsdigita.templating.PatternStylesheetResolver"
level="info">
</Logger>
<Logger name="com.arsdigita.templating.SimpleURIResolver"
level="warn">
</Logger>
<Logger name="com.arsdigita.web.CCMDispatcherServlet"
level="debug">
</Logger>
<Logger name="org.libreccm.core.AbstractEntityRepository"
level="debug">
</Logger>
<Logger name="org.libreccm.modules.CcmIntegrator"
level="debug">
</Logger>
<Logger name="org.libreccm.pagemodel.PageModelManager"
level="debug">
</Logger>
<Logger name="org.libreccm.security.OneTimeAuthTokenCleaner"
level="debug">
</Logger>
<Logger name="org.libreccm.security.PermissionManager"
level="debug">
</Logger>
<Logger name="org.libreccm.security.Shiro"
level="debug">
</Logger>
<Logger name="org.libreccm.ui.admin.usersgroupsroles.RolesController"
level="debug">
</Logger>
<Logger name="org.librecms.contentsection.AssetRepository"
level="debug">
</Logger>
<Logger name="org.librecms.contentsection.ContentSectionSetup"
level="debug">
</Logger>
<Logger name="org.librecms.contentsection.ContentSectionServlet"
level="debug">
</Logger>
<Logger name="org.librecms.contentsection.rs.Images"
level="debug">
</Logger>
<Logger name="com.arsdigita.web.DefaultApplicationFileResolver"
level="debug">
</Logger>
</Loggers>
</Configuration>

View File

@ -0,0 +1,5 @@
swarm:
deployment:
ccm-bundle-devel-wildfly.war:
jaxrs:
application-path: /jaxrs

View File

@ -0,0 +1,17 @@
[main]
filterChainResolver = org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver
passwordMatcher = org.apache.shiro.authc.credential.PasswordMatcher
passwordService = org.apache.shiro.authc.credential.DefaultPasswordService
passwordMatcher.passwordService = $passwordService
ccmRealm = org.libreccm.security.CcmShiroRealm
ccmRealm.credentialsMatcher = $passwordMatcher
securityManager.realms = $ccmRealm
securityManager.rememberMeManager.cipherKey = p5h/Aphy0gfV+XThbEPqSG4iQNh2fTNH9ZEkSBAt/Ok=
cacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
securityManager.cacheManager = $cacheManager

View File

@ -0,0 +1,65 @@
# -*- text -*-
# This file locates stylesheets, if you are using the
# "PatternStylesheetResolver". Please read the Javadoc for that file for
# the full story.
# Currently the "resource" part is actually "short-circuited", see
# Templating#transformURL(url). As long as we store and synchronize all theme
# files in each server's local file system, we use the direct file apprach to
# avoid unnecessary http request and traffic between client (user) and server!
# Additionally all modules are installed into one webapp context, so the
# webapp tag is redundant, but sort of required by some part of the code.
# Theme with single entry point (e.g Mandalay) managed by themedirector
#http://::host::/resource/::webapp::/themes/::themedir::/::theme::/start.xsl
http://::host::/::webapp::/themes/::themedir::/::theme::/start.xsl
# Theme with single entry point (e.g Mandalay) unmanaged default
#http://::host::/resource/::webapp::/themes/mandalay/start.xsl
#http://::host::/::webapp::/themes/mandalay/start.xsl
# Theme with single entry point (e.g Mandalay) unmanaged default
#http://::host::/resource/::webapp::/themes/mandalay/start.xsl
http://::host::/::webapp::/themes/libreccm-default/start.xsl
# ==============================================================================
# The following is for multi-entry themes, not used in ScientificCMS
# ==============================================================================
# Output type is for things such as text/javascript
# NOT used by ScientificCMS, uses Mandalay only!
#http://::host::/resource/::webapp::/themes/heirloom/apps/::application::/xsl/::url::-::outputtype::-::locale::.xsl
#http://::host::/resource/::webapp::/themes/heirloom/apps/::application::/xsl/::url::-::outputtype::.xsl
# Grabs custom item xsl for CMS
# NOT used by ScientificCMS, uses Mandalay only!
#http://::host::/themes/servlet/content-item/index.xsl?oid=::item_template_oid::&delegated=::item_delegated_url::
# Theme, with optional locale & prefix
# NOT used by ScientificCMS, uses Mandalay only!
#http://::host::/resource/::webapp::/themes/::themedir::/::theme::/::application::-::url::-::prefix::-::locale::.xsl
#http://::host::/resource/::webapp::/themes/::themedir::/::theme::/::application::-::url::-::prefix::.xsl
# Theme, with optional locale
# NOT used by ScientificCMS, uses Mandalay only!
#http://::host::/resource/::webapp::/themes/::themedir::/::theme::/::application::-::url::-::locale::.xsl
#http://::host::/resource/::webapp::/themes/::themedir::/::theme::/::application::-::url::.xsl
# APLAWS generic default, with locale and prefix
# XXX change ROOT -> ccm-ldn-aplaws
# http://::host::/resource/ROOT/themes/static/aplaws-generic/::application::-::url::-::prefix::-::locale::.xsl
# http://::host::/resource/ROOT/themes/static/aplaws-generic/::application::-::url::-::prefix::.xsl
# APLAWS generic default, with locale
# XXX change ROOT -> ccm-ldn-aplaws
# http://::host::/resource/ROOT/themes/static/aplaws-generic/::application::-::url::-::locale::.xsl
# http://::host::/resource/ROOT/themes/static/aplaws-generic/::application::-::url::.xsl
# Global default, from application's own web app
# NOT used by ScientificCMS
#http://::host::/resource/::webapp::/themes/heirloom/apps/::application::/xsl/::url::-::locale::.xsl
#http://::host::/resource/::webapp::/themes/heirloom/apps/::application::/xsl/::url::.xsl

View File

@ -0,0 +1,3 @@
version = 7.0.0-SNAPSHOT
appname = LibreCCM
apphomepage = http://www.libreccm.org

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all">
</beans>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
author: Jens Pelzetter
-->
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="LibreCCM" transaction-type="JTA">
<!--
Enforce JPA provider
Not really necessary here because we don't use any Hibernate
specific features, but makes it easier to manage to database
creation scripts.
-->
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/LibreCCM</jta-data-source>
<!--<jta-data-source>java:/comp/env/jdbc/libreccm/db</jta-data-source>-->
<jar-file>lib/ccm-core-7.0.0-SNAPSHOT.jar</jar-file>
<jar-file>lib/ccm-cms-7.0.0-SNAPSHOT.jar</jar-file>
<jar-file>lib/ccm-shortcuts-7.0.0-SNAPSHOT.jar</jar-file>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="validate" />
<property name="hibernate.connection.autocommit" value="false" />
<property name="hibernate.id.new_generator_mappings" value="true" />
<property name="wildfly.jpa.hibernate.search.module"
value="org.hibernate.search.orm:main" />
<!--<property name="hibernate.show_sql" value="true" />
<property name="format_sql" value="true" />
<property name="use_sql_comments" value="true" />-->
<!--
Properties for Hibernate Envers
We are using the ValidityAuditStrategy here because it is faster
when querying data than the DefaultStrategy
-->
<property name="org.hibernate.envers.audit_strategy"
value="org.hibernate.envers.strategy.ValidityAuditStrategy"/>
</properties>
</persistence-unit>
</persistence>

View File

@ -0,0 +1 @@
waf.config.packages=ccm-core

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>LibreCCM Devel Bundle for Wildfly</display-name>
<context-param>
<param-name>ccm.develmode</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>ccm.distribution</param-name>
<param-value>libreccm</param-value>
</context-param>
<!-- No JSESSIONID!!! -->
<session-config>
<tracking-mode>COOKIE</tracking-mode>
<!--<tracking-mode>URL</tracking-mode>-->
</session-config>
<filter>
<filter-name>ShiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ShiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
</listener>
<!-- JAX-RS -->
<!--<servlet>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/content-sections/*</url-pattern>
</servlet-mapping>-->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<servlet>
<servlet-name>vaadin-servlet</servlet-name>
<servlet-class>com.vaadin.cdi.server.VaadinCDIServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>vaadin-servlet</servlet-name>
<url-pattern>/vaadin/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>vaadin-servlet</servlet-name>
<url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>
</web-app>

View File

@ -0,0 +1,72 @@
requirejs(["./ccm-editor",
"./ccm-cms-editor",
"../webjars/requirejs-domready/2.0.1/domReady!"],
function(editor, cmseditor, doc) {
editor.addEditor(".editor-textarea", {
"commandGroups": [
{
"name": "blocks",
"title": "Format blocks",
"commands": [
editor.FormatBlockCommand
]
},
{
"name": "format-text",
"title": "Format text",
"commands": [
editor.MakeBoldCommand,
editor.MakeItalicCommand,
editor.MakeUnderlineCommand,
editor.StrikeThroughCommand,
editor.SubscriptCommand,
editor.SuperscriptCommand,
editor.RemoveFormatCommand,
editor.InsertExternalLinkCommand,
cmseditor.InsertInternalLinkCommand,
cmseditor.InsertMediaAssetCommand
]
},
{
"name": "insert-list",
"title": "Insert list",
"commands": [
editor.InsertUnorderedListCommand,
editor.InsertOrderedListCommand
]
},
{
"name": "html",
"title": "HTML",
"commands": [editor.ToggleHtmlCommand]
}
],
"settings": {
"ccm-editor-css.path": "/libreccm/ccm-editor/ccm-editor.css",
"font-awesome.path": "/libreccm/webjars/font-awesome/4.7.0/css/font-awesome.min.css",
"formatBlock.blocks": [
{
"element": "h3",
"title": "Heading 3"
},
{
"element": "h4",
"title": "Heading 4"
},
{
"element": "h5",
"title": "Heading 5"
},
{
"element": "h6",
"title": "Heading 6"
},
{
"element": "p",
"title": "Paragraph"
}
]
}
});
});

View File

@ -1,3 +1,2 @@
datasource.properties datasource.properties
runtime.properties
wildfly.properties wildfly.properties

View File

@ -1,3 +0,0 @@
libreccm.datasource.connectionUrl=jdbc:postgresql://localhost:5432/ccm-devel
libreccm.datasource.username=ccm
libreccm.datasource.password=ccm47web

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scene Scope="Project" version="2">
<Scope Scope="Faces Configuration Only"/>
<Scope Scope="Project"/>
<Scope Scope="All Faces Configurations"/>
</Scene>

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,11 @@
"build": "webpack" "build": "webpack"
}, },
"dependencies": { "dependencies": {
"@librecms/ccm-cms-pagemodelseditor": "file:../ccm-cms-pagemodelseditor",
"tinymce": "^4.8.2"
}, },
"devDependencies": { "devDependencies": {
"@types/tinymce": "^4.5.16",
"@types/webpack-env": "^1.13.6", "@types/webpack-env": "^1.13.6",
"file-loader": "^1.1.11", "file-loader": "^1.1.11",
"ts-loader": "^4.4.2", "ts-loader": "^4.4.2",

View File

@ -24,12 +24,6 @@
<url>http://www.libreccm.org/modules/web/wildfly</url> <url>http://www.libreccm.org/modules/web/wildfly</url>
<dependencies> <dependencies>
<dependency>
<groupId>org.libreccm</groupId>
<artifactId>ccm-wildfly</artifactId>
<version>7.0.0-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>org.webjars</groupId> <groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId> <artifactId>font-awesome</artifactId>
@ -55,7 +49,7 @@
<artifactId>ccm-cms-js</artifactId> <artifactId>ccm-cms-js</artifactId>
<version>7.0.0-SNAPSHOT</version> <version>7.0.0-SNAPSHOT</version>
</dependency> --> </dependency> -->
<!-- <dependency> <dependency>
<groupId>org.librecms</groupId> <groupId>org.librecms</groupId>
<artifactId>ccm-cms-pagemodelseditor</artifactId> <artifactId>ccm-cms-pagemodelseditor</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
@ -64,7 +58,7 @@
<groupId>org.librecms</groupId> <groupId>org.librecms</groupId>
<artifactId>ccm-cms-tinymce</artifactId> <artifactId>ccm-cms-tinymce</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
</dependency>--> </dependency>
<!-- <dependency> <!-- <dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
@ -80,9 +74,9 @@
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
</resource> </resource>
<!--<resource> <resource>
<directory>${project.build.directory}/generated-resources</directory> <directory>${project.build.directory}/generated-resources</directory>
</resource>--> </resource>
</resources> </resources>
<plugins> <plugins>
@ -90,15 +84,15 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration> <configuration>
<source>11</source> <source>1.8</source>
<target>11</target> <target>1.8</target>
<optimize>true</optimize> <optimize>true</optimize>
<debug>true</debug> <debug>true</debug>
<encoding>${project.build.sourceEncoding}</encoding> <encoding>${project.build.sourceEncoding}</encoding>
</configuration> </configuration>
</plugin> </plugin>
<!-- <plugin> <plugin>
<groupId>com.github.eirslett</groupId> <groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId> <artifactId>frontend-maven-plugin</artifactId>
@ -113,10 +107,10 @@
<goal>install-node-and-npm</goal> <goal>install-node-and-npm</goal>
</goals> </goals>
<configuration> <configuration>
<nodeVersion>v16.14.2</nodeVersion> <nodeVersion>${nodeVersion}</nodeVersion>
</configuration> </configuration>
</execution> </execution>
<execution> <!-- <execution>
<id>npm link @libreccm/ccm-pagemodelseditor</id> <id>npm link @libreccm/ccm-pagemodelseditor</id>
<goals> <goals>
<goal>npm</goal> <goal>npm</goal>
@ -124,7 +118,7 @@
<configuration> <configuration>
<arguments>link @libreccm/ccm-pagemodelseditor</arguments> <arguments>link @libreccm/ccm-pagemodelseditor</arguments>
</configuration> </configuration>
</execution> </execution> -->
<execution> <execution>
<id>npm link @librecms/ccm-cms-pagemodelseditor</id> <id>npm link @librecms/ccm-cms-pagemodelseditor</id>
<goals> <goals>
@ -134,7 +128,7 @@
<arguments>link @librecms/ccm-cms-pagemodelseditor</arguments> <arguments>link @librecms/ccm-cms-pagemodelseditor</arguments>
</configuration> </configuration>
</execution> </execution>
<execution> <!-- <execution>
<id>npm link @librecms/ccm-cms-tinymce</id> <id>npm link @librecms/ccm-cms-tinymce</id>
<goals> <goals>
<goal>npm</goal> <goal>npm</goal>
@ -142,8 +136,8 @@
<configuration> <configuration>
<arguments>link @librecms/ccm-cms-tinymce</arguments> <arguments>link @librecms/ccm-cms-tinymce</arguments>
</configuration> </configuration>
</execution> </execution>-->
<execution> <!--<execution>
<id>npm link @librecms/ccm-cms-js</id> <id>npm link @librecms/ccm-cms-js</id>
<goals> <goals>
<goal>npm</goal> <goal>npm</goal>
@ -151,7 +145,7 @@
<configuration> <configuration>
<arguments>link @librecms/ccm-cms-js</arguments> <arguments>link @librecms/ccm-cms-js</arguments>
</configuration> </configuration>
</execution> </execution>-->
<execution> <execution>
<id>npm install</id> <id>npm install</id>
<goals> <goals>
@ -168,7 +162,7 @@
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
</plugin>--> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -179,9 +173,9 @@
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
</resource> </resource>
<!--<resource> <resource>
<directory>${project.build.directory}/generated-resources</directory> <directory>${project.build.directory}/generated-resources</directory>
</resource>--> </resource>
</webResources> </webResources>
<overlays> <overlays>
@ -190,11 +184,11 @@
<artifactId>ccm-editor</artifactId> <artifactId>ccm-editor</artifactId>
<type>jar</type> <type>jar</type>
</overlay> </overlay>
<!-- <overlay> <overlay>
<groupId>org.libreccm</groupId> <groupId>org.libreccm</groupId>
<artifactId>ccm-pagemodelseditor</artifactId> <artifactId>ccm-pagemodelseditor</artifactId>
<type>jar</type> <type>jar</type>
</overlay>--> </overlay>
<overlay> <overlay>
<groupId>org.libreccm</groupId> <groupId>org.libreccm</groupId>
<artifactId>ccm-theme-foundry</artifactId> <artifactId>ccm-theme-foundry</artifactId>
@ -206,62 +200,7 @@
<type>jar</type> <type>jar</type>
<includes> <includes>
<include>assets/</include> <include>assets/</include>
</includes> <include>_admin/</include>
</overlay>
<overlay>
<groupId>org.libreccm</groupId>
<artifactId>ccm-core</artifactId>
<type>jar</type>
<includes>
<include>themes/</include>
</includes>
</overlay>
<overlay>
<groupId>org.libreccm</groupId>
<artifactId>ccm-core</artifactId>
<type>jar</type>
<includes>
<include>WEB-INF/</include>
</includes>
</overlay>
<!-- <overlay>
<groupId>org.libreccm</groupId>
<artifactId>ccm-shortcuts</artifactId>
<type>jar</type>
<includes>
<include>WEB-INF/</include>
</includes>
</overlay>-->
<overlay>
<groupId>org.libreccm</groupId>
<artifactId>ccm-core</artifactId>
<type>jar</type>
<includes>
<include>resources/</include>
</includes>
</overlay>
<overlay>
<groupId>org.librecms</groupId>
<artifactId>ccm-cms</artifactId>
<type>jar</type>
<includes>
<include>WEB-INF/</include>
</includes>
</overlay>
<overlay>
<groupId>org.librecms</groupId>
<artifactId>ccm-cms</artifactId>
<type>jar</type>
<includes>
<include>assets/</include>
</includes>
</overlay>
<overlay>
<groupId>org.librecms</groupId>
<artifactId>ccm-cms</artifactId>
<type>jar</type>
<includes>
<include>icons/</include>
</includes> </includes>
</overlay> </overlay>
<overlay> <overlay>
@ -272,22 +211,14 @@
<include>templates/</include> <include>templates/</include>
</includes> </includes>
</overlay> </overlay>
<!-- <overlay> <overlay>
<groupId>org.librecms</groupId> <groupId>org.librecms</groupId>
<artifactId>ccm-cms-tinymce</artifactId> <artifactId>ccm-cms-tinymce</artifactId>
<type>jar</type> <type>jar</type>
<includes> <includes>
<include>scripts/</include> <include>scripts/</include>
</includes> </includes>
</overlay>--> </overlay>
<!-- <overlay>
<groupId>org.librecms</groupId>
<artifactId>ccm-cms-default-theme</artifactId>
<type>jar</type>
<includes>
<include>themes/librecms/scripts/</include>
</includes>
</overlay> -->
</overlays> </overlays>
</configuration> </configuration>
</plugin> </plugin>
@ -308,27 +239,6 @@
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<executions>
<execution>
<id>read-runtime-properties</id>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/runtime.example.properties</file>
<file>${project.basedir}/runtime.properties</file>
</files>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.wildfly.plugins</groupId> <groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId> <artifactId>wildfly-maven-plugin</artifactId>
@ -341,58 +251,6 @@
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-jar-maven-plugin</artifactId>
<configuration>
<jvmArguments>
<arg>-agentlib:jdwp=transport=dt_socket,server=y,suspend=${libreccm.debug.suspend},address=${libreccm.debug.port}</arg>
</jvmArguments>
<arguments>
-Dorg.wildfly.datasources.postgresql.database=${libreccm.database.name}
-Dorg.wildfly.datasources.postgresql.host=${libreccm.database.host}
-Dorg.wildfly.datasources.postgresql.jndi-name=java:/comp/env/jdbc/libreccm/db
-Dorg.wildfly.datasources.postgresql.password=${libreccm.database.password}
-Dorg.wildfly.datasources.postgresql.port=${libreccm.database.port}
-Dorg.wildfly.datasources.postgresql.user-name=${libreccm.database.user}
</arguments>
<feature-packs>
<feature-pack>
<location>wildfly@maven(org.jboss.universe:community-universe)#24.0.1.Final</location>
</feature-pack>
<feature-pack>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-datasources-galleon-pack</artifactId>
<version>2.0.2.Final</version>
</feature-pack>
</feature-packs>
<layers>
<layer>cdi</layer>
<layer>datasources</layer>
<layer>ejb</layer>
<layer>jaxrs</layer>
<layer>jpa</layer>
<layer>jsf</layer>
<layer>jsonp</layer>
<layer>logging</layer>
<layer>mail</layer>
<layer>management</layer>
<layer>postgresql-datasource</layer>
</layers>
<!-- <excluded-layers>
<layer>deployment-scanner</layer>
</excluded-layers>-->
<skip>false</skip>
</configuration>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -1,7 +0,0 @@
libreccm.debug.suspend=n
libreccm.database.host=localhost
libreccm.database.port=5432
libreccm.database.name=ccm-devel
libreccm.database.user=ccm
libreccm.database.password=ccm47web

View File

@ -1,10 +0,0 @@
libreccm.http.port=8080
libreccm.https.port=8180
libreccm.debug.port=8787
libreccm.debug.suspend=n
libreccm.database.host=localhost
libreccm.database.port=5432
libreccm.database.name=libreccm-devel
libreccm.database.user=libreccm
libreccm.database.password=libreccm

View File

@ -80,7 +80,10 @@
<Logger name="org.libreccm.security.Shiro" <Logger name="org.libreccm.security.Shiro"
level="debug"> level="debug">
</Logger> </Logger>
<Logger name="org.libreccm.ui.admin.usersgroupsroles.RolesController" <Logger name="org.libreccm.theming.xslt.CcmUriResolver"
level="debug">
</Logger>
<Logger name="org.libreccm.ui.admin.usersgroupsroles.RolesController"
level="debug"> level="debug">
</Logger> </Logger>
<Logger name="org.librecms.contentsection.AssetRepository" <Logger name="org.librecms.contentsection.AssetRepository"
@ -98,16 +101,9 @@
<Logger name="com.arsdigita.web.DefaultApplicationFileResolver" <Logger name="com.arsdigita.web.DefaultApplicationFileResolver"
level="debug"> level="debug">
</Logger> </Logger>
<Logger name = "org.libreccm.ui.admin.AdminApplication"
level="debug">
</Logger> <Logger name="org.libreccm.ui.admin.AdminUi"
<Logger name="org.libreccm.ui.admin.applications.ApplicationsPage"
level="debug">
</Logger>
<Logger name="org.librecms.ui.ContentSectionController"
level="debug">
</Logger>
<Logger name="org.libreccm.categorization.CategoryManager"
level="debug"> level="debug">
</Logger> </Logger>
</Loggers> </Loggers>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

View File

@ -1,2 +0,0 @@
example.setting=Properties from the Freemarker theme.

View File

@ -1,73 +0,0 @@
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
header {
padding: 1em 2em;
}
header img {
display: block;
margin-left: auto;
margin-right: auto;
width: 20vw;
max-width: 1020px;
max-height: 566px;
}
main {
max-width: 55em;
margin-left: auto;
margin-right: auto;
padding: 2em 1em;
}
main h1 {
text-align: center;
}
main form.login {
display: flex;
align-items: center;
flex-direction: column;
margin-top: 1em;
}
main form.login .form-row {
display: flex;
align-items: flex-start;
flex-direction: column;
margin-bottom: 0.5em;
}
main form.login button[type=submit] {
display: block;
margin-top: 0.75em;
margin-left: auto;
margin-right: auto;
padding: 0.25em;
}
footer {
background-color: #71ac52;
color: #fff;
padding: 3em 1em;
width: 100vw;
}
footer p {
text-align: center;
}

View File

@ -1,62 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>LibreCCM Devel Theme</title>
</head>
<body>
<h1>LibreCCM Devel</h1>
<h2>Site Info</h2>
<dl>
<dt>host</dt>
<dd>${CmsPagesSiteInfoModel.host}</dd>
<dt>domain</dt>
<dd>${CmsPagesSiteInfoModel.domain}</dd>
<dt>name</dt>
<dd>${CmsPagesSiteInfoModel.name}</dd>
<dt>Current category</dt>
<dd>${CmsPagesCategoryModel.category.name}</dd>
</dl>
<h2>Category Tree</h2>
<ul>
<!--<#list CmsPagesCategoryModel.categoryTree.subCategories as category>
<@categoryTreeNode category />
</#list>-->
<@categoryTreeNode CmsPagesCategoryModel.categoryTree />
</ul>
<h2>(Index) Item</h2>
<#if (CmsPagesCategoryModel.category.hasIndexItem)>
<dl>
<dt>Name</dt>
<dd>${CmsPagesCategorizedItemModel.name}</dd>
<dt>Title</dt>
<dd>${CmsPagesCategorizedItemModel.title}</dd>
<dt>Description</dt>
<dd>${CmsPagesCategorizedItemModel.description}</dd>
</dl>
<#else>
<p>No (Index) Item</p>
</#if>
<h2>Item List</h2>
<ul>
<#list CmsPagesItemListModel.items as item>
<li>
<b>${item.title} (${item.name})</b>
${item.description}
</li>
</#list>
</ul>
</body>
</html>
<#macro categoryTreeNode category>
<li>
${category.name}
<#if (category.subCategories?size > 0)>
<ul>
<#list category.subCategories as subCategory>
<@categoryTreeNode subCategory />
</#list>
</ul>
</#if>
</li>
</#macro>

View File

@ -1,19 +0,0 @@
<footer>
<ul>
<li>
<a href="/impressum">
<!--Impressum-->
${localize("footer.impressum")}
</a>
</li>
<li>
<a href="/privacy">
<!--Privacy-->
${localize("footer.privacy")}
</a>
</li>
<li>
<code>imported</code>
</li>
</ul>
</footer>

View File

@ -1,35 +0,0 @@
<#import "../main.html.ftl" as main>
<@main.ccm_main>
<h1>${LoginMessages['login.title']}</h1>
<#if (loginFailed)>
<div class="alert-error">
${LoginMessages['login.errors.failed']}
</div>
</#if>
<form action="${mvc.uri('LoginController#processLogin')}"
class="login"
method="post">
<div class="form-row">
<label for="login">${LoginMessages['login.screenname.label']}</label>
<input id="login" name="login" required="true" type="text" />
</div>
<div class="form-row">
<label for="password">
${LoginMessages['login.password.label']}
</label>
<input id="password"
name="password"
required="true"
type="password" />
</div>
<input type="hidden"
name="returnUrl"
value="${returnUrl}" />
<button type="submit">
${LoginMessages['login.submit']}
</button>
</form>
</@main.ccm_main>

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Category page</title>
<link rel="stylesheet" href="${getContextPath()}/theming/ccm/style.css" />
</head>
<body>
<main>
<h1>${LoginMessages['login.password_recovered.title']}</h1>
<p>${LoginMessages['login.password_recovered.message']}</p>
</main>
<#include "footer.html.ftl">
</body>
</html>

View File

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Category page</title>
<link rel="stylesheet" href="${getContextPath()}/theming/ccm/style.css" />
</head>
<body>
<main>
<h1>${LoginMessages['login.recover_password.title']}</h1>
<# if (failedToSendRecoverMessage)>
<div class="alert-error">
${LoginMessages['login.errors.failedToSendRecoverMessage']}
</div>
</#if>
<form action="${mvc.url('LoginController#recoverPassword')}"
method="post">
<label for="email">${LoginMessages['login.email.label']}</label>
<input id="email" name="email" required="true" type="text" />
<button type="submit">
${LoginMessages['login.recover_password.submit']}
</button>
</form>
</main>
<#include "footer.html.ftl">
</body>
</html>

View File

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Category page</title>
<link rel="stylesheet" href="${themeUrl}/style.css" />
</head>
<body>
<main>
<h1>Logout successful</h1>
<p>Logout successful</p>
</main>
</body>
</html>

View File

@ -1,25 +0,0 @@
<#macro ccm_main scripts=[]>
<html>
<head>
<title>Category page</title>
<link rel="stylesheet" href="${themeUrl}/styles/style.css" />
<#list scripts as script>
<script src="${themeUrl}/${script}" />
</#list>
</head>
<body>
<header>
<a href="https://www.libreccm.org">
<img alt="LibreCCM Logo"
src="${themeUrl}/images/libreccm.png" />
</a>
</header>
<main>
<#nested>
</main>
<footer>
<p>LibreCCM basic theme. The customize create your own theme.</p>
</footer>
</body>
</html>
</#macro>

View File

@ -1,5 +0,0 @@
label.critical=Critical
label.error=Error
label.ok=OK
label.warning=Warning

View File

@ -1,3 +0,0 @@
footer.impressum=Impressum
footer.privacy=Privacy

View File

@ -1,95 +0,0 @@
{
"files": [
{
"name": "images",
"isDirectory": true,
"files": [
{
"name": "libreccm.png",
"isDirectory": false,
"mimeType": "image/png"
}
]
},
{
"name": "settings.properties",
"isDirectory": false,
"mimeType": "text/plain"
},
{
"name": "styles",
"isDirectory": true,
"files": [
{
"name": "style.css",
"isDirectory": false,
"mimeType": "text/css"
}
]
},
{
"name": "templates",
"isDirectory": true,
"files": [
{
"name": "login",
"isDirectory": true,
"files": [
{
"name": "login-form.html.ftl",
"isDirectory": false,
"mimeType": "text/plain"
},
{
"name": "login-password-recovered.html.ftl",
"isDirectory": false,
"mimeType": "text/plain"
}, {
"name": "login-recover-password.html.ftl",
"isDirectory": false,
"mimeType": "text/plain"
}
]
},
{
"name": "logout",
"isDirectory": true,
"files": [
{
"name": "loggedout.html.ftl",
"isDirectory": false,
"mimeText": "text/plain"
}
]
}
]
},
{
"name": "texts",
"isDirectory": true,
"files": [
{
"name": "labels.properties",
"isDirectory": false,
"mimeType": "text/plain"
}
]
},
{
"name": "theme-bundle.properties",
"isDirectory": false,
"mimeType": "text/plain"
},
{
"name": "theme-index.json",
"isDirectory": false,
"mimeType": "application/json"
},
{
"name": "theme.json",
"isDirectory": false,
"mimeType": "application/json"
}
]
}

View File

@ -1,144 +0,0 @@
{
"name": "librecms-devel",
"type": "freemarker",
"default-template": "templates/default.html.ftl",
"mvc-templates": {
"default": {
"description": {
"values": {
"value": [
{
"lang": "en",
"value": "Default Template"
}
]
}
},
"name": "Default Template",
"path": "templates/default.html.ftl",
"title": {
"values": {
"value": [
{
"lang": "en",
"value": "Default Template"
}
]
}
}
},
"login-form": {
"description": {
"values": {
"value": [
{
"lang": "en",
"value": "Login Form"
}
]
}
},
"name": "Login Form",
"path": "templates/login/login-form.html.ftl",
"title": {
"values": {
"value": [
{
"lang": "en",
"value": "Login Form"
}
]
}
}
},
"login-recover-password": {
"description": {
"values": {
"value": [
{
"lang": "en",
"value": "Recover lost passwords"
}
]
}
},
"name": "login-recover-password",
"path": "templates/login/login-recover-password.html.ftl",
"title": {
"values": {
"value": [
{
"lang": "en",
"value": "Recover password"
}
]
}
}
},
"login-password-recovered": {
"description": {
"values": {
"value": [
{
"lang": "en",
"value": "Password recovered"
}
]
}
},
"name": "login-password-recovered",
"path": "templates/login/login-password-recovered.html.ftl",
"title": {
"values": {
"value": [
{
"lang": "en",
"value": "Password recovered"
}
]
}
}
},
"loggedout": {
"description": {
"values": {
"value": [
{
"lang": "en",
"value": "Logout successful"
}
]
}
},
"name": "loggedout",
"path": "templates/logout/loggedout.html.ftl",
"title": {
"values": {
"value": [
{
"lang": "en",
"value": "Logout succesful"
}
]
}
}
}
},
"views": {
"default": {
"default": "default",
"@default": "default"
},
"login": {
"loginForm": "login-form",
"passwordRecovered": "login-password-recovered",
"recoverPassword": "login-recover-password"
},
"logout": {
"loggedout": "loggedout"
}
}
}

View File

@ -25,6 +25,7 @@
<jar-file>lib/ccm-cms-7.0.0-SNAPSHOT.jar</jar-file> <jar-file>lib/ccm-cms-7.0.0-SNAPSHOT.jar</jar-file>
<jar-file>lib/ccm-shortcuts-7.0.0-SNAPSHOT.jar</jar-file> <jar-file>lib/ccm-shortcuts-7.0.0-SNAPSHOT.jar</jar-file>
<properties> <properties>
<!-- Properties for Hibernate --> <!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="validate" /> <property name="hibernate.hbm2ddl.auto" value="validate" />
@ -33,7 +34,7 @@
<property name="wildfly.jpa.hibernate.search.module" <property name="wildfly.jpa.hibernate.search.module"
value="org.hibernate.search.orm:main" /> value="org.hibernate.search.orm:main" />
<!-- <property name="hibernate.show_sql" value="true" /> <!--<property name="hibernate.show_sql" value="true" />
<property name="format_sql" value="true" /> <property name="format_sql" value="true" />
<property name="use_sql_comments" value="true" />--> <property name="use_sql_comments" value="true" />-->

View File

@ -4,7 +4,4 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"> http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<resource-handler>org.libreccm.mvc.facelets.CcmViewResourceHandler</resource-handler>
</application>
</faces-config> </faces-config>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" ?> <?xml version="1.0" ?>
<jboss-web> <jboss-web>
<context-root>/libreccm</context-root> <context-root>/libreccm</context-root>
<default-encoding>UTF-8</default-encoding>
</jboss-web> </jboss-web>

View File

@ -15,10 +15,6 @@
<param-name>ccm.distribution</param-name> <param-name>ccm.distribution</param-name>
<param-value>libreccm</param-value> <param-value>libreccm</param-value>
</context-param> </context-param>
<context-param>
<param-name>resteasy.resources</param-name>
<param-value>org.jboss.resteasy.plugins.stats.RegistryStatsResource</param-value>
</context-param>
<!-- No JSESSIONID!!! --> <!-- No JSESSIONID!!! -->
<session-config> <session-config>
@ -69,12 +65,8 @@
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name> <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value> <param-value>true</param-value>
</context-param> </context-param>
<context-param>
<param-name>PARAMETER_ENCODING</param-name>
<param-value>UTF-8</param-value>
</context-param>
<!-- <servlet> <!-- <servlet>
<servlet-name>vaadin-servlet</servlet-name> <servlet-name>vaadin-servlet</servlet-name>
<servlet-class>com.vaadin.cdi.server.VaadinCDIServlet</servlet-class> <servlet-class>com.vaadin.cdi.server.VaadinCDIServlet</servlet-class>
</servlet> </servlet>

View File

@ -5,7 +5,7 @@ module.exports = {
devtool: "source-map", devtool: "source-map",
entry: { entry: {
// "ccm-cms-pagemodelseditor": "./src/main/typescript/ccm-cms-pagemodelseditor.ts", "ccm-cms-pagemodelseditor": "./src/main/typescript/ccm-cms-pagemodelseditor.ts",
// "ccm-cms-tinymce-loader": "./src/main/typescript/tinymce/ccm-cms-tinymce-loader.ts", // "ccm-cms-tinymce-loader": "./src/main/typescript/tinymce/ccm-cms-tinymce-loader.ts",
}, },

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -39,35 +38,38 @@
<artifactId>ccm-theme-foundry</artifactId> <artifactId>ccm-theme-foundry</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.librecms</groupId> <groupId>org.librecms</groupId>
<artifactId>ccm-theme-ftllibs-devel</artifactId> <artifactId>ccm-theme-ftllibs-devel</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.librecms</groupId> <groupId>net.sf.saxon</groupId>
<artifactId>ccm-cms-default-theme</artifactId> <artifactId>Saxon-HE</artifactId>
<version>${project.parent.version}</version>
</dependency> </dependency>
<!-- CCM modules --> <!-- CCM modules -->
<!-- <dependency> <dependency>
<groupId>org.libreccm</groupId> <groupId>org.libreccm</groupId>
<artifactId>ccm-shortcuts</artifactId> <artifactId>ccm-shortcuts</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
</dependency>--> </dependency>
<dependency> <dependency>
<groupId>org.librecms</groupId> <groupId>org.librecms</groupId>
<artifactId>ccm-cms</artifactId> <artifactId>ccm-cms</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
</dependency> </dependency>
<!-- CCM Modules end --> <!-- CCM Modules end -->
<!-- Dependencies for log4j 2 including adapter for the log4j 1.2 API --> <!-- Dependencies for log4j 2 including adapter for the log4j 1.2 API -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId> <artifactId>log4j-api</artifactId>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -113,8 +113,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version> <version>3.3</version>
<configuration> <configuration>
<source>11</source> <source>1.7</source>
<target>11</target> <target>1.7</target>
<optimize>true</optimize> <optimize>true</optimize>
<debug>true</debug> <debug>true</debug>
<encoding>${project.build.sourceEncoding}</encoding> <encoding>${project.build.sourceEncoding}</encoding>
@ -191,8 +191,13 @@
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version> <version>2.10.3</version>
<configuration> <configuration>
<detectLinks>false</detectLinks> <detectLinks>true</detectLinks>
<detectJavaApiLinks>false</detectJavaApiLinks> <detectJavaApiLinks>true</detectJavaApiLinks>
<links>
<link>http://docs.oracle.com/javase/7/docs/api/</link>
<link>http://docs.oracle.com/javaee/7/api/</link>
<link>http://docs.jboss.org/hibernate/orm/4.3/javadocs/</link>
</links>
<show>private</show> <show>private</show>
<docfilessubdirs>true</docfilessubdirs> <docfilessubdirs>true</docfilessubdirs>
<charset>UTF-8</charset> <charset>UTF-8</charset>
@ -203,6 +208,16 @@
<author>true</author> <author>true</author>
<keywords>true</keywords> <keywords>true</keywords>
<failOnError>false</failOnError> <failOnError>false</failOnError>
<doclet>org.jboss.apiviz.APIviz</doclet>
<docletArtifact>
<groupId>org.jboss.apiviz</groupId>
<artifactId>apiviz</artifactId>
<version>1.3.2.GA</version>
</docletArtifact>
<useStandardDocletOptions>true</useStandardDocletOptions>
<additionalparam>
-sourceclasspath ${project.build.outputDirectory}
</additionalparam>
</configuration> </configuration>
</plugin> </plugin>
@ -229,7 +244,7 @@
<configuration> <configuration>
<linkXref>true</linkXref> <linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding> <sourceEncoding>utf-8</sourceEncoding>
<targetJdk>11</targetJdk> <targetJdk>1.8</targetJdk>
<rulesets> <rulesets>
<ruleset>/rulesets/java/basic.xml</ruleset> <ruleset>/rulesets/java/basic.xml</ruleset>
<ruleset>/rulesets/java/braces.xml</ruleset> <ruleset>/rulesets/java/braces.xml</ruleset>

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +0,0 @@
{
"name": "@librecms/default-theme",
"version": "7.0.0",
"scripts": {
"build": "npm-run-all build:*",
"build:mkdir": "shx mkdir -p target/generated-resources/themes/librecms",
"build:theme": "shx cp -r src/main/resources/themes/librecms/* target/generated-resources/themes/librecms",
"build:icons": "shx cp node_modules/bootstrap-icons/bootstrap-icons.svg target/generated-resources/themes/librecms/images/",
"build:js": "webpack",
"build:css": "npm-run-all build:css:*",
"build:css:librecms": "sass src/main/scss/librecms.scss target/generated-resources/themes/librecms/styles/librecms.css",
"build:index": "theme-index-builder target/generated-resources/themes/librecms"
},
"author": "Jens Pelzetter",
"license": "LGPL-3.0-or-later",
"devDependencies": {
"@types/bootstrap": "^5.1.8",
"npm-run-all": "^4.1.5",
"sass": "^1.48.0",
"shx": "^0.3.4",
"ts-loader": "^9.2.6",
"typescript": "^4.5.4",
"webpack": "^5.66.0",
"webpack-cli": "^4.9.1"
},
"dependencies": {
"bootstrap": "^5.1.3",
"bootstrap-icons": "^1.7.2"
}
}

View File

@ -1,113 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'Z</maven.build.timestamp.format>
</properties>
<parent>
<groupId>org.libreccm</groupId>
<artifactId>libreccm-parent</artifactId>
<version>7.0.0-SNAPSHOT</version>
</parent>
<groupId>org.librecms</groupId>
<artifactId>ccm-cms-default-theme</artifactId>
<version>7.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>LibreCMS Default Theme</name>
<licenses>
<license>
<name>Lesser GPL 2.1</name>
<url>http://www.gnu.org/licenses/old-licenses/lgpl-2.1</url>
</license>
</licenses>
<dependencies>
<dependency>
<groupId>org.libreccm</groupId>
<artifactId>ccm-static-theme-index-builder</artifactId>
<version>7.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>ccm-cms-default-theme</finalName>
<resources>
<!-- <resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/typescript</directory>
</resource> -->
<resource>
<directory>${project.build.directory}/generated-resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<configuration>
<installDirectory>../node</installDirectory>
</configuration>
<executions>
<execution>
<id>Install node.js and NPM</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v16.14.2</nodeVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
</execution>
<execution>
<id>npm link @libreccm/ccm-static-theme-index-builder</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>link @libreccm/ccm-static-theme-index-builder</arguments>
</configuration>
</execution>
<execution>
<id>build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
<execution>
<id>npm link</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>link</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1 +0,0 @@
import "bootstrap";

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 175 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 180 KiB

View File

@ -1,63 +0,0 @@
<#macro "org.librecms.assets.AudioAsset" asset>
<figure>
<audio controls
src="/content-sections/${asset.contentSection}/audiomedia${asset.assetPath}"
width="240"></audio>
<figcaption>${asset.description}</figcaption>
</figure>
</#macro>
<#macro "org.librecms.assets.ExternalAudioAsset" asset>
<figure>
<audio controls src="${asset.url}" width="240"></audio>
<figcaption>${asset.description}</figcaption>
</figure>
</#macro>
<#macro "org.librecms.assets.ExternalVideoAsset" asset>
<figure>
<video controls src="${asset.url}" width="240"></video>
<figcaption>${asset.description}</figcaption>
</figure>
</#macro>
<#macro "org.librecms.assets.FileAsset" asset>
<h3><a href="/content-sections/${asset.contentSection}/files${asset.assetPath}">${asset.title}</a></h3>
<p>${asset.description}</p>
<small>${asset.mimeType} ${asset.size} Bytes</small>
</#macro>
<#macro "org.librecms.assets.Image" asset>
<figure>
<img src="/content-sections/${asset.contentSection}/images${asset.assetPath}"
width="240" />
<figcaption>${asset.description}</figcaption>
</figure>
</#macro>
<#macro "org.librecms.assets.RelatedLink" asset>
<#if asset.externalLink>
<div>
<a href="${asset.targetUrl}">${asset.title}</a>
<svg class="bi"
fill="current-color"
height="1em"
width="1em">
<use xlink:href="${themeUrl}/images/bootstrap-icons.svg#globe" />
</svg>
<span class="visually-hidden">External link</span>
</div>
<#else>
<a href="${asset.targetItemPath}">${asset.title}</a>
</#if>
</#macro>
<#macro "org.librecms.assets.VideoAsset" asset>
<figure>
<video controls
src="/content-sections/${asset.contentSection}/videos${asset.assetPath}"
width="240"></video>
<figcaption>${asset.description}</figcaption>
</figure>
</#macro>

View File

@ -1,51 +0,0 @@
<#import "./main.html.ftl" as main>
<#import "./assets.html.ftl" as assets>
<@main.librecms>
<div class="container">
<div class="row align-items-start justify-content-center">
<div class="col-lg-8">
<#if CmsPagesContentItemTypeModel.itemClass != "">
<#assign itemTemplate = .getOptionalTemplate("./contentitems/${CmsPagesContentItemTypeModel.itemClass}.html.ftl")>
<#if itemTemplate.exists>
<#import "./contentitems/${CmsPagesContentItemTypeModel.itemClass}.html.ftl" as contentitem>
<#else>
<#import "./contentitems/default.html.ftl" as contentitem>
</#if>
<@contentitem.details />
</#if>
</div>
<div class="col-lg-4">
<#list CmsPagesCategorizedItemModel.attachmentLists as attachmentList>
<h2>${attachmentList.title}</h2>
<p class="item-description">${attachmentList.description}</p>
<#list attachmentList.attachments>
<ul class="list-group">
<#items as attachment>
<li class="list-group-item">
<@.vars["assets"][attachment.asset.type] attachment.asset />
</li>
</#items>
</ul>
</#list>
</#list>
</div>
</div>
<#list CmsPagesItemListModel.getItems()>
<div class="row align-items-start">
<div class="col-12">
<ul class="list-group">
<#items as item>
<li class="list-group-item">
<h2>
<a href="/pages/${CmsPagesCategoryModel.category.path}${item.name}.${negotiatedLocale}.html${CmsPagesPageUrlModel.queryString}">${item.title}</a>
</h2>
<p class="item-description">${item.description}</p>
</li>
</#items>
</ul>
</div>
</div>
</div>
</#list>
</@main.librecms>

View File

@ -1,7 +0,0 @@
<#macro details>
<h1>${CmsPagesCategorizedItemModel.title}</h1>
<p class="item-description">${CmsPagesCategorizedItemModel.description}</p>
<div class="alert alert-warning">
No template for ${CmsPagesContentItemTypeModel.itemClass} available
</div>
</#macro>

View File

@ -1,17 +0,0 @@
<#import "../assets.html.ftl" as assets>
<#macro details>
<h1>${CmsPagesCategorizedItemModel.title}</h1>
<p class="item-description">${CmsPagesCategorizedItemModel.description}</p>
<div class="float-end">
<#list CmsPagesCategorizedItemModel.mediaLists as mediaList>
<#list mediaList.attachments as media>
<@.vars["assets"][media.asset.type] media.asset />
</#list>
</#list>
</div>
<div>
${CmsPagesArticleModel.text}
</div>
</#macro>

View File

@ -1,25 +0,0 @@
<#macro details>
<div class="d-flex">
<h1>
${CmsPagesCategorizedItemModel.title}
<span class="badge bg-secondary rounded-pill">
${CmsPagesEventModel.getStartDateTime('yyyy-MM-dd')}
<#if CmsPagesEventModel.getEndDateTime()??>
- ${CmsPagesEventModel.getEndDateTime('yyyy-MM-dd')}
</#if>
</span>
</h1>
</div>
<p class="item-description">${CmsPagesCategorizedItemModel.description}</p>
<div>
${CmsPagesEventModel.text}
</div>
<#if CmsPagesEventModel.location??>
<h2>Location</h2>
<div>
${CmsPagesEventModel.location}
</div>
</#if>
</#macro>

View File

@ -1,61 +0,0 @@
<#macro details>
<h1>${CmsPagesCategorizedItemModel.title}</h1>
<p class="item-description">${CmsPagesCategorizedItemModel.description}</p>
<h2>${CmsPagesMultiPartArticleModel.currentSectionTitle}</h2>
<div>
<nav>
<ul class="flex-column float-end nav">
<#list CmsPagesMultiPartArticleModel.sectionTitles as section>
<li class="nav-item">
<#if section?index == CmsPagesMultiPartArticleModel.currentSection>
<a aria-current="page"
class="active nav-link"
href="${CmsPagesMultiPartArticleModel.sectionLinks[section?index]}">
${section}
</a>
<#else>
<a class="nav-link"
href="${CmsPagesMultiPartArticleModel.sectionLinks[section?index]}">
${section}
</a>
</#if>
</li>
</#list>
</ul>
</nav>
${CmsPagesMultiPartArticleModel.currentSectionText}
<nav>
<ul class="pagination">
<#if CmsPagesMultiPartArticleModel.prevSectionLink != "">
<li class="list-item">
<a class="page-link"
href="${CmsPagesMultiPartArticleModel.prevSectionLink}">
<svg class="bi"
fill="current-color"
height="1em"
width="1em">
<use xlink:href="${themeUrl}/images/bootstrap-icons.svg#caret-left-fill" />
</svg>
<span class="visually-hidden">Previous</span>
</a>
</li>
</#if>
<#if CmsPagesMultiPartArticleModel.nextSectionLink != "">
<li class="list-item">
<a class="page-link"
href="${CmsPagesMultiPartArticleModel.nextSectionLink}">
<svg class="bi"
fill="current-color"
height="1em"
width="1em">
<use xlink:href="${themeUrl}/images/bootstrap-icons.svg#caret-right-fill" />
</svg>
<span class="visually-hidden">Next</span>
</a>
</li>
</#if>
</ul>
</nav>
</div>
</#macro>

View File

@ -1,15 +0,0 @@
<#macro details>
<div class="d-flex">
<h1>
${CmsPagesCategorizedItemModel.title}
<span class="badge bg-secondary rounded-pill">
${CmsPagesNewsModel.getReleaseDate('yyyy-MM-dd')}
</span>
</h1>
</div>
<p class="item-description">${CmsPagesCategorizedItemModel.description}</p>
<div>
${CmsPagesNewsModel.text}
</div>
</#macro>

View File

@ -1,21 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<link href="${themeUrl}/styles/librecms.css" rel="stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Default Template</title>
</head>
<body>
<div class="container">
<p>This theme works.</p>
<dl>
<dt>application</dt>
<dd>${application}</dd>
<dt>themeUrl</dt>
<dd>${themeUrl}</dd>
<dt>view</dt>
<dd>${view!""}</dd>
</dl>
</div>
</body>
</html>

View File

@ -1,48 +0,0 @@
<#import "./main.html.ftl" as main>
<#-- <#import "./contentitems/${CmsPagesContentItemTypeModel.itemClass}.html.ftl" as contentitem> -->
<@main.librecms>
<div class="container">
<div class="row align-items-start justify-content-center">
<div class="col-lg-8">
<#if CmsPagesContentItemTypeModel.itemClass != "">
<#assign itemTemplate = .getOptionalTemplate("./contentitems/${CmsPagesContentItemTypeModel.itemClass}.html.ftl")>
<#if itemTemplate.exists>
<#import "./contentitems/${CmsPagesContentItemTypeModel.itemClass}.html.ftl" as contentitem>
<#else>
<#import "./contentitems/default.html.ftl" as contentitem>
</#if>
<@contentitem.details />
</#if>
</div>
<div class="col-lg-4">
<!-- Attachments -->
<h2>Notes</h2>
<ul class="list-group mb-4">
<li class="list-group-item">
<p>
A side note with some text
</p>
<p>
Occaecat sit eu ipsum irure. Enim consectetur aute anim proident sint dolor sint ea ex eu adipisicing et. Veniam laborum mollit velit incididunt aliquip do esse officia eu ea nostrud nulla.
</p>
</li>
</ul>
<h2>More information</h2>
<p>
Consequat occaecat eu ullamco amet id tempor.
</p>
<ul class="list-group mb-4">
<li class="list-group-item">
<p>Anim ex ut reprehenderit in enim id proident duis pariatur est anim do.</p>
<a href="https://example.com">A related link</a>
</li>
<li class="list-group-item">
<p>Quis minim deserunt incididunt ea voluptate laboris fugiat elit nulla.</p>
<a href="https://example.com">Some download link</a>
</li>
</ul>
</div>
</div>
</div>
</@main.librecms>

View File

@ -1,173 +0,0 @@
<#import "./main.html.ftl" as main>
<@main.librecms>
<div class="container">
<div class="row align-items-center">
<div class="col">
<div class="bg-light mb-4 rounded-3">
<div class="container-fluid py-5">
<#if CmsPagesCategorizedItemModel.itemAvailable>
<h1 class="display-5 fw-bold">
${CmsPagesCategorizedItemModel.title}
</h1>
<p>
${CmsPagesCategorizedItemModel.description}
</p>
<a class="btn btn-primary btn-lg"
href="#">
Find out more
</a>
<#else>
<h1 class="display-5 fw-bold">
LibreCMS
</h1>
<p>
No index item has been defined.
</p>
<a class="btn btn-primary btn-lg"
href="https://www.libreccm.org">
Find out more
</a>
</#if>
</div>
</div>
<#-- <#if CmsPagesCategorizedItemModel.itemAvailable>
Category has an index item
<#else>
Category has no index item
</#if>
<h2>Index page</h2>
<p>This theme works.</p>
<dl>
<dt>application</dt>
<dd>${application}</dd>
<dt>themeUrl</dt>
<dd>${themeUrl}</dd>
<dt>view</dt>
<dd>${view!""}</dd>
</dl>
<h2>From <code>ArticleModel</code></h2>
<dl>
<dt>Title</dt>
<dd>${CmsPagesArticleModel.title}</dd>
<dt>Description</dt>
<dd>${CmsPagesArticleModel.description}</dd>
<dt>Text</dt>
<dd>${CmsPagesArticleModel.text}</dd>
</dl>
</div> -->
</div>
<div class="row align-items-start justify-content-center">
<#list CmsPagesItemListModel.getItems("newslist")>
<div class="col">
<h2>News</h2>
<ul class="list-group">
<#items as news>
<li class="list-group-item">
<h3 class="d-flex w-100 justify-content-between">
<div>
<a href="/pages${CmsPagesCategoryModel.category.path}${news.name}.${negotiatedLocale}.html${CmsPagesPageUrlModel.queryString}">${news.title}</a>
</div>
<#-- <div>${news.getReleaseDate('yyyy-MM-dd')}</div> -->
<div>${news.getReleaseDate('dd. MMM yyyy')}</div>
</h3>
<p class="item-description">${news.description}</p>
</li>
</#items>
</ul>
</div>
</#list>
<#list CmsPagesItemListModel.getItems("eventlist")>
<div class="col">
<h2>Upcoming events</h2>
<ul class="list-group">
<#items as event>
<li class="list-group-item">
<h3 class="d-flex w-100 justify-content-between">
<div>
<a href="/pages${CmsPagesCategoryModel.category.path}${event.name}.${negotiatedLocale}.html${CmsPagesPageUrlModel.queryString}">${event.title}</a>
</div>
<div>${event.getStartDate('dd. MMM yyyy HH:mm')}</div>
</h3>
<p class="item-description">${event.description}</p>
</li>
</#items>
</ul>
</div>
</#list>
</div>
<#-- <h2>Item List</h2>
<p>Item List size: ${CmsPagesItemListModel.listSize}</p>
<dl>
<dt>Item List size:</dt>
<dd>${CmsPagesItemListModel.listSize}</dd>
<dt>Page size</dt>
<dd>${CmsPagesItemListModel.pageSize}</dd>
<dt>Page</dt>
<dd>${CmsPagesItemListModel.page}</dd>
<dt>Offset</dt>
<dd>${CmsPagesItemListModel.offset}</dd>
</dl>
<ul>
<#list CmsPagesItemListModel.items as item>
<li>
<dl>
<dt>UUID</dt>
<dd>${item.uuid}</dd>
<dt>displayName</dt>
<dd>${item.displayName}</dd>
<dt>Name</dt>
<dd>${item.name}</dd>
<dt>Title</dt>
<dd>${item.title}</dd>
<dt>description</dt>
<dd>${item.description}</dd>
<dt>Type</dt>
<dd>${item.type}</dd>
</dl>
</li>
</#list>
</ul>
</div>
<h2>News List</h2>
<p>News List size: ${CmsPagesItemListModel.getListSize("newslist")}</p>
<dl>
<dt>Item List size:</dt>
<dd>${CmsPagesItemListModel.getListSize("newslist")}</dd>
<dt>Page size</dt>
<dd>${CmsPagesItemListModel.getPageSize("newslist")}</dd>
<dt>Page</dt>
<dd>${CmsPagesItemListModel.getPage("newslist")}</dd>
<dt>Offset</dt>
<dd>${CmsPagesItemListModel.getOffset("newslist")}</dd>
</dl>
<ul>
<#list CmsPagesItemListModel.getItems("newslist") as item>
<li>
<dl>
<dt>UUID</dt>
<dd>${item.uuid}</dd>
<dt>displayName</dt>
<dd>${item.displayName}</dd>
<dt>Name</dt>
<dd>${item.name}</dd>
<dt>Title</dt>
<dd>${item.title}</dd>
<dt>description</dt>
<dd>${item.description}</dd>
<dt>Type</dt>
<dd>${item.type}</dd>
</dl>
</li>
</#list>
</ul>
</div> -->
</@main.librecms>

View File

@ -1,50 +0,0 @@
<#macro librecms scripts=[]>
<!DOCTYPE html>
<html>
<head>
<link href="${themeUrl}/styles/librecms.css" rel="stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Default Template</title>
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg navbar-expand navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand"
href="/pages">
<img class="theme-logo img-fluid"
src="${themeUrl}/images/librecms.svg" />
</a>
<button aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
class="navbar-toggler"
data-bs-toggle="collapse"
data-bs-target="#navbar-items"
type="button">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse"
id="navbar-items">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<#list CmsPagesCategoryModel.categoryTree.subCategories as category>
<li ${category.selected?then("aria-selected=\"page\"","")}
class="nav-item ${category.selected?then( "active","")}">
<a class="nav-link"
href="/pages${category.categoryPath}/index.${negotiatedLocale}.html${CmsPagesPageUrlModel.queryString}">
${category.title}
</a>
</li>
</#list>
</ul>
</div>
</div>
</nav>
</header>
<main>
<#nested>
</main>
<script src="${themeUrl}/scripts/librecms.js"></script>
</body>
</html>
</#macro>

View File

@ -1,121 +0,0 @@
{
"name": "librecms",
"type": "freemarker",
"master-theme": null,
"title": {
"values": {
"value": [
{
"lang": "en",
"value": "LibreCMS Default Theme"
},
{
"lang": "de",
"value": "LibreCMS Standard Theme"
}
]
}
},
"description": {
"values": {
"value": [
{
"lang": "en",
"value": "The LibreCMS default theme"
},
{
"lang": "de",
"value": "Das LibreCMS Standard Theme"
}
]
}
},
"mvc-templates": {
"category-page": {
"description": {
"values": {
"value": [
{
"lang": "en",
"value": "Template for category pages."
}
]
}
},
"name": "Category Page Template",
"path": "templates/category-page.html.ftl",
"title": {
"values": {
"value": [
{
"lang": "en",
"value": "Category Page Template"
}
]
}
}
},
"default": {
"description": {
"values": {
"value": [
{
"lang": "en",
"value": "Default Template used if no other template fits."
}
]
}
},
"name": "Default Template",
"path": "templates/default.html.ftl",
"title": {
"values": {
"value": [
{
"lang": "en",
"value": "Default Template"
}
]
}
}
},
"index-page": {
"description": {
"values": {
"value": [
{
"lang": "en",
"value": "Template for the index page of a site."
}
]
}
},
"name": "index-page",
"path": "templates/index-page.html.ftl",
"title": {
"values": {
"value": [
{
"lang": "en",
"value": "Index Page"
}
]
}
}
}
},
"views": {
"default": {
"default": "default",
"@default": "default"
},
"pages": {
"category-page": "category-page",
"index": "index-page",
"default": "default",
"@default": "default"
}
}
}

View File

@ -1,15 +0,0 @@
$primary: #0A9793;
a.navbar-brand {
max-width: 15%;
}
.imgbox-button {
background-color: transparent;
border: none;
padding: 0;
}
.item-description {
white-space: pre-wrap;
}

View File

@ -1,2 +0,0 @@
@import "custom";
@import "../../../node_modules/bootstrap/scss/bootstrap"

View File

@ -1 +0,0 @@
import "bootstrap";

View File

@ -1,14 +0,0 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": true,
"lib": ["DOM", "ES2016"],
"module": "commonjs",
"moduleResolution": "node",
"outDir": "scripts",
"sourceMap": true,
"strict": true,
"target": "ES6"
},
"include": ["src/main/typescript/**/*"]
}

View File

@ -1,25 +0,0 @@
module.exports = {
mode: "development",
devtool: "source-map",
optimization: {
chunkIds: false
},
entry: {
librecms: "./src/main/typescript/librecms.ts"
},
output: {
filename: "[name].js",
path: __dirname + "/target/generated-resources/themes/librecms/scripts"
},
resolve: {
extensions: [".tsx", ".ts", ".js", ".jsx"],
},
module: {
rules: [
// all files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'
{ test: /\.tsx?$/, use: ["ts-loader"], exclude: /node_modules/ },
],
}
}

View File

@ -75,16 +75,16 @@
<goal>install-node-and-npm</goal> <goal>install-node-and-npm</goal>
</goals> </goals>
<configuration> <configuration>
<nodeVersion>v16.14.2</nodeVersion> <nodeVersion>${nodeVersion}</nodeVersion>
</configuration> </configuration>
</execution> </execution>
<execution> <execution>
<id>npm link @libreccm/ccm-pagemodelseditor</id> <id>install ccm-pagemodelseditor</id>
<goals> <goals>
<goal>npm</goal> <goal>npm</goal>
</goals> </goals>
<configuration> <configuration>
<arguments>link @libreccm/ccm-pagemodelseditor</arguments> <arguments>install ../ccm-pagemodelseditor</arguments>
</configuration> </configuration>
</execution> </execution>
<execution> <execution>
@ -93,16 +93,6 @@
<goal>npm</goal> <goal>npm</goal>
</goals> </goals>
</execution> </execution>
<!-- Sync Maven module version and NPM module version -->
<execution>
<id>npm version</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>version --allow-same-version=true ${project.version}</arguments>
</configuration>
</execution>
<execution> <execution>
<id>build</id> <id>build</id>
<goals> <goals>
@ -112,15 +102,6 @@
<arguments>run build</arguments> <arguments>run build</arguments>
</configuration> </configuration>
</execution> </execution>
<execution>
<id>npm link</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>link</arguments>
</configuration>
</execution>
</executions> </executions>
</plugin> </plugin>

View File

@ -5,7 +5,7 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@libreccm/ccm-pagemodelseditor": { "@libreccm/ccm-pagemodelseditor": {
"version": "7.0.0", "version": "file:../ccm-pagemodelseditor",
"requires": { "requires": {
"react": "^16.4.2", "react": "^16.4.2",
"react-dom": "^16.4.2", "react-dom": "^16.4.2",

View File

@ -15,7 +15,7 @@
"tslint": "tslint --project ." "tslint": "tslint --project ."
}, },
"dependencies": { "dependencies": {
"@libreccm/ccm-pagemodelseditor": "7.0.0", "@libreccm/ccm-pagemodelseditor": "file:../ccm-pagemodelseditor",
"react": "^16.4.2", "react": "^16.4.2",
"react-dom": "^16.4.2" "react-dom": "^16.4.2"
}, },

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -8,7 +7,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<timestamp>${maven.build.timestamp}</timestamp> <timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'Z</maven.build.timestamp.format> <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'Z</maven.build.timestamp.format>
<buildNumber></buildNumber>
</properties> </properties>
<parent> <parent>
@ -59,71 +57,6 @@
<plugins> <plugins>
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-remote-resources-plugin</artifactId> <version>1.5</version> <configuration> <resourceBundles>
<resourceBundle>org.libreccm:ccm-pagemodelseditor:${project.version}</resourceBundle> </resourceBundles> </configuration> <executions> <execution> <goals> <goal>process</goal> </goals> </execution> </executions> </plugin> -->
<!--<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>npm install</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm link @libreccm/ccm-pagemodelseditor</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>link</argument>
<argument>@libreccm/ccm-pagemodelseditor</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm run build</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm link</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>link</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>-->
<plugin> <plugin>
<groupId>com.github.eirslett</groupId> <groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId> <artifactId>frontend-maven-plugin</artifactId>
@ -139,16 +72,16 @@
<goal>install-node-and-npm</goal> <goal>install-node-and-npm</goal>
</goals> </goals>
<configuration> <configuration>
<nodeVersion>v16.14.2</nodeVersion> <nodeVersion>${nodeVersion}</nodeVersion>
</configuration> </configuration>
</execution> </execution>
<execution> <execution>
<id>npm link @libreccm/ccm-pagemodelseditor</id> <id>install ccm-pagemodelseditor</id>
<goals> <goals>
<goal>npm</goal> <goal>npm</goal>
</goals> </goals>
<configuration> <configuration>
<arguments>link @libreccm/ccm-pagemodelseditor</arguments> <arguments>install ../ccm-pagemodelseditor</arguments>
</configuration> </configuration>
</execution> </execution>
<execution> <execution>
@ -157,16 +90,6 @@
<goal>npm</goal> <goal>npm</goal>
</goals> </goals>
</execution> </execution>
<!-- Sync Maven module version and NPM module version -->
<execution>
<id>npm version</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>version --allow-same-version=true ${project.version}${buildNumber}</arguments>
</configuration>
</execution>
<execution> <execution>
<id>build</id> <id>build</id>
<goals> <goals>
@ -176,15 +99,6 @@
<arguments>run build</arguments> <arguments>run build</arguments>
</configuration> </configuration>
</execution> </execution>
<execution>
<id>npm link</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>link</arguments>
</configuration>
</execution>
<execution> <execution>
<id>npm publish</id> <id>npm publish</id>
@ -195,7 +109,7 @@
<phase>deploy</phase> <phase>deploy</phase>
<configuration> <configuration>
<arguments>publish -userconfig ../libreccm.npmrc</arguments> <arguments>publish --userconfig ../libreccm.npmrc</arguments>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
@ -203,18 +117,4 @@
</plugins> </plugins>
</build> </build>
<profiles>
<profile>
<id>with-buildnumber</id>
<activation>
<property>
<name>env.BUILD_NUMBER</name>
</property>
</activation>
<properties>
<buildNumber>.${env.BUILD_NUMBER}</buildNumber>
</properties>
</profile>
</profiles>
</project> </project>

View File

@ -74,12 +74,6 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- Dependencies for log4j 2 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
@ -144,8 +138,8 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration> <configuration>
<source>11</source> <source>1.8</source>
<target>11</target> <target>1.8</target>
<optimize>true</optimize> <optimize>true</optimize>
<debug>true</debug> <debug>true</debug>
<encoding>${project.build.sourceEncoding}</encoding> <encoding>${project.build.sourceEncoding}</encoding>
@ -221,8 +215,13 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<configuration> <configuration>
<detectLinks>false</detectLinks> <detectLinks>true</detectLinks>
<detectJavaApiLinks>false</detectJavaApiLinks> <detectJavaApiLinks>true</detectJavaApiLinks>
<links>
<link>http://docs.oracle.com/javase/7/docs/api/</link>
<link>http://docs.oracle.com/javaee/7/api/</link>
<link>http://docs.jboss.org/hibernate/orm/4.3/javadocs/</link>
</links>
<show>private</show> <show>private</show>
<docfilessubdirs>true</docfilessubdirs> <docfilessubdirs>true</docfilessubdirs>
<charset>UTF-8</charset> <charset>UTF-8</charset>
@ -233,6 +232,14 @@
<author>true</author> <author>true</author>
<keywords>true</keywords> <keywords>true</keywords>
<failOnError>false</failOnError> <failOnError>false</failOnError>
<doclet>org.jboss.apiviz.APIviz</doclet>
<docletArtifact>
<groupId>org.jboss.apiviz</groupId>
<artifactId>apiviz</artifactId>
<version>1.3.2.GA</version>
</docletArtifact>
<useStandardDocletOptions>true</useStandardDocletOptions>
<additionalparam>-sourceclasspath ${project.build.outputDirectory}</additionalparam>
</configuration> </configuration>
</plugin> </plugin>
@ -255,7 +262,7 @@
<configuration> <configuration>
<linkXref>true</linkXref> <linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding> <sourceEncoding>utf-8</sourceEncoding>
<targetJdk>11</targetJdk> <targetJdk>1.8</targetJdk>
<!-- <rulesets> <!-- <rulesets>
<ruleset>/rulesets/java/basic.xml</ruleset> <ruleset>/rulesets/java/basic.xml</ruleset>
<ruleset>/rulesets/java/braces.xml</ruleset> <ruleset>/rulesets/java/braces.xml</ruleset>

View File

@ -0,0 +1,117 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import org.librecms.assets.Person;
import org.librecms.contentsection.AssetRepository;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.profilesite.ProfileSiteItem;
import java.util.Locale;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
class ProfileSiteItemController {
public static final String OWNER = "owner";
public static final String POSITION = "position";
public static final String INTERSETS = "interests";
public static final String MISC = "misc";
@Inject
private AssetRepository assetRepository;
@Inject
private ContentItemRepository itemRepository;
@Transactional(Transactional.TxType.REQUIRED)
public void setOwner(final long profileSiteItemId, final long ownerId) {
final ProfileSiteItem profileSiteItem = itemRepository
.findById(profileSiteItemId, ProfileSiteItem.class)
.orElseThrow(
() -> new IllegalArgumentException(
String.format(
"No ProfileSiteItem with ID %d found.",
profileSiteItemId
)
)
);
final Person owner = assetRepository
.findById(ownerId, Person.class)
.orElseThrow(
() -> new IllegalArgumentException(
String.format(
"No Person with ID %d found.", ownerId
)
)
);
profileSiteItem.setOwner(owner);
itemRepository.save(profileSiteItem);
}
public void setPosition(
final long profileSiteItemId, final String position, final Locale locale
) {
final ProfileSiteItem profileSiteItem = itemRepository
.findById(profileSiteItemId, ProfileSiteItem.class)
.orElseThrow(
() -> new IllegalArgumentException(
String.format(
"No ProfileSiteItem with ID %d found.",
profileSiteItemId
)
)
);
profileSiteItem.getPosition().addValue(locale, position);
}
public void setInterests(
final long profileSiteItemId,
final String interests,
final Locale locale
) {
final ProfileSiteItem profileSiteItem = itemRepository
.findById(profileSiteItemId, ProfileSiteItem.class)
.orElseThrow(
() -> new IllegalArgumentException(
String.format(
"No ProfileSiteItem with ID %d found.",
profileSiteItemId
)
)
);
profileSiteItem.getInterests().addValue(locale, interests);
}
public void setMisc(
final long profileSiteItemId, final String misc, final Locale locale
) {
final ProfileSiteItem profileSiteItem = itemRepository
.findById(profileSiteItemId, ProfileSiteItem.class)
.orElseThrow(
() -> new IllegalArgumentException(
String.format(
"No ProfileSiteItem with ID %d found.",
profileSiteItemId
)
)
);
profileSiteItem.getMisc().addValue(locale, misc);
}
}

View File

@ -0,0 +1,80 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.assets.AssetSearchWidget;
import com.arsdigita.cms.ui.authoring.CreationSelector;
import com.arsdigita.cms.ui.authoring.PageCreateForm;
import com.arsdigita.globalization.GlobalizedMessage;
import org.librecms.assets.Person;
import org.librecms.contentsection.ContentItemInitializer;
import org.librecms.profilesite.ProfileSiteConstants;
import org.librecms.profilesite.ProfileSiteItem;
import java.util.Locale;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ProfileSiteItemCreate extends PageCreateForm {
private final static String OWNER_SEARCH = "owner";
private AssetSearchWidget ownerSearch;
public ProfileSiteItemCreate(
final ItemSelectionModel itemModel,
final CreationSelector creationSelector,
final StringParameter selectedLanguageParam
) {
super(itemModel, creationSelector, selectedLanguageParam);
}
@Override
public void addWidgets() {
ownerSearch = new AssetSearchWidget(OWNER_SEARCH, Person.class);
ownerSearch.setLabel(
new GlobalizedMessage(
"profile_site.owner.label", ProfileSiteConstants.BUNDLE
)
);
add(ownerSearch);
}
@Override
public void validate(final FormSectionEvent event)
throws FormProcessException {
super.validate(event);
final FormData formData = event.getFormData();
if (!formData.containsKey(OWNER_SEARCH)
|| formData.get(OWNER_SEARCH) == null) {
formData.addError(
new GlobalizedMessage(
"profile_site.owner.not_selected",
ProfileSiteConstants.BUNDLE
)
);
}
}
@Override
protected ContentItemInitializer<ProfileSiteItem> getItemInitializer(
final FormData formData, final PageState state
) {
return (item) -> item.setOwner((Person) formData.get(OWNER_SEARCH));
}
}

View File

@ -0,0 +1,108 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormInitListener;
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
import com.arsdigita.globalization.GlobalizedMessage;
import org.libreccm.cdi.utils.CdiUtil;
import org.librecms.profilesite.ProfileSiteConstants;
import org.librecms.profilesite.ProfileSiteItem;
import java.util.Locale;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ProfileSiteItemInterestsForm
extends BasicItemForm
implements FormProcessListener, FormInitListener {
private final StringParameter selectedLangParam;
public ProfileSiteItemInterestsForm(
final ItemSelectionModel itemModel,
final StringParameter selectedLangParam
) {
super("ProfileSiteItemEditInterests", itemModel, selectedLangParam);
this.selectedLangParam = selectedLangParam;
}
@Override
public void addWidgets() {
add(
new Label(
new GlobalizedMessage(
"profile_site_item.ui.interests",
ProfileSiteConstants.BUNDLE
)
)
);
final ParameterModel interestsParam = new StringParameter(
ProfileSiteItemController.POSITION);
final TextArea interests = new TextArea(interestsParam);
interests.setCols(80);
interests.setRows(8);
add(interests);
}
@Override
public void init(final FormSectionEvent event) throws FormProcessException {
final PageState state = event.getPageState();
final FormData data = event.getFormData();
final ProfileSiteItem profile
= (ProfileSiteItem) getItemSelectionModel()
.getSelectedItem(state);
data.put(ProfileSiteItemController.POSITION, profile.getInterests());
setVisible(state, true);
}
@Override
public void process(final FormSectionEvent event)
throws FormProcessException {
final PageState state = event.getPageState();
final FormData data = event.getFormData();
final ProfileSiteItem profile
= (ProfileSiteItem) getItemSelectionModel()
.getSelectedItem(state);
if ((profile != null)
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
final ProfileSiteItemController controller = CdiUtil
.createCdiUtil()
.findBean(ProfileSiteItemController.class);
final Locale selectedLocale = SelectedLanguageUtil.selectedLocale(
state, selectedLangParam
);
controller.setInterests(
profile.getObjectId(),
(String) data.get(ProfileSiteItemController.POSITION),
selectedLocale
);
}
init(event);
}
}

View File

@ -0,0 +1,81 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
import org.librecms.profilesite.ProfileSiteConstants;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ProfileSiteItemInterestsStep extends SimpleEditStep {
private String EDIT_POSITION_SHEET_NAME = "editInterests";
public ProfileSiteItemInterestsStep(
final ItemSelectionModel itemModel,
final AuthoringKitWizard parent,
final StringParameter selectedLangParam
) {
this(itemModel, parent, selectedLangParam, null);
}
public ProfileSiteItemInterestsStep(
final ItemSelectionModel itemModel,
final AuthoringKitWizard parent,
final StringParameter selectedLangParam,
final String prefix
) {
super(itemModel, parent, selectedLangParam, prefix);
final BasicItemForm editInterestsForm = new ProfileSiteItemInterestsForm(
itemModel, selectedLangParam
);
add(
EDIT_POSITION_SHEET_NAME,
new GlobalizedMessage(
"profile_site_site.ui.interests.edit",
ProfileSiteConstants.BUNDLE
),
new WorkflowLockedComponentAccess(parent, itemModel),
editInterestsForm.getSaveCancelSection().getCancelButton()
);
setDisplayComponent(getProfileSiteItemInterestsSheet(
itemModel, selectedLangParam)
);
}
public static final Component getProfileSiteItemInterestsSheet(
final ItemSelectionModel itemModel,
final StringParameter selectedLangParam
) {
final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
itemModel, false, selectedLangParam
);
sheet.add(
new GlobalizedMessage(
"profile_site_item.ui.interests",
ProfileSiteConstants.BUNDLE
),
ProfileSiteItemController.POSITION
);
return sheet;
}
}

View File

@ -0,0 +1,108 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormInitListener;
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
import com.arsdigita.globalization.GlobalizedMessage;
import org.libreccm.cdi.utils.CdiUtil;
import org.librecms.profilesite.ProfileSiteConstants;
import org.librecms.profilesite.ProfileSiteItem;
import java.util.Locale;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ProfileSiteItemMiscForm
extends BasicItemForm
implements FormProcessListener, FormInitListener {
private final StringParameter selectedLangParam;
public ProfileSiteItemMiscForm(
final ItemSelectionModel itemModel,
final StringParameter selectedLangParam
) {
super("ProfileSiteItemEditMisc", itemModel, selectedLangParam);
this.selectedLangParam = selectedLangParam;
}
@Override
public void addWidgets() {
add(
new Label(
new GlobalizedMessage(
"profile_site_item.ui.misc",
ProfileSiteConstants.BUNDLE
)
)
);
final ParameterModel miscParam = new StringParameter(
ProfileSiteItemController.POSITION);
final TextArea misc = new TextArea(miscParam);
misc.setCols(80);
misc.setRows(8);
add(misc);
}
@Override
public void init(final FormSectionEvent event) throws FormProcessException {
final PageState state = event.getPageState();
final FormData data = event.getFormData();
final ProfileSiteItem profile
= (ProfileSiteItem) getItemSelectionModel()
.getSelectedItem(state);
data.put(ProfileSiteItemController.POSITION, profile.getMisc());
setVisible(state, true);
}
@Override
public void process(final FormSectionEvent event)
throws FormProcessException {
final PageState state = event.getPageState();
final FormData data = event.getFormData();
final ProfileSiteItem profile
= (ProfileSiteItem) getItemSelectionModel()
.getSelectedItem(state);
if ((profile != null)
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
final ProfileSiteItemController controller = CdiUtil
.createCdiUtil()
.findBean(ProfileSiteItemController.class);
final Locale selectedLocale = SelectedLanguageUtil.selectedLocale(
state, selectedLangParam
);
controller.setMisc(
profile.getObjectId(),
(String) data.get(ProfileSiteItemController.POSITION),
selectedLocale
);
}
init(event);
}
}

View File

@ -0,0 +1,81 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
import org.librecms.profilesite.ProfileSiteConstants;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ProfileSiteItemMiscStep extends SimpleEditStep {
private String EDIT_POSITION_SHEET_NAME = "editMisc";
public ProfileSiteItemMiscStep(
final ItemSelectionModel itemModel,
final AuthoringKitWizard parent,
final StringParameter selectedLangParam
) {
this(itemModel, parent, selectedLangParam, null);
}
public ProfileSiteItemMiscStep(
final ItemSelectionModel itemModel,
final AuthoringKitWizard parent,
final StringParameter selectedLangParam,
final String prefix
) {
super(itemModel, parent, selectedLangParam, prefix);
final BasicItemForm editMiscForm = new ProfileSiteItemMiscForm(
itemModel, selectedLangParam
);
add(
EDIT_POSITION_SHEET_NAME,
new GlobalizedMessage(
"profile_site_site.ui.misc.edit",
ProfileSiteConstants.BUNDLE
),
new WorkflowLockedComponentAccess(parent, itemModel),
editMiscForm.getSaveCancelSection().getCancelButton()
);
setDisplayComponent(getProfileSiteItemMiscSheet(
itemModel, selectedLangParam)
);
}
public static final Component getProfileSiteItemMiscSheet(
final ItemSelectionModel itemModel,
final StringParameter selectedLangParam
) {
final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
itemModel, false, selectedLangParam
);
sheet.add(
new GlobalizedMessage(
"profile_site_item.ui.misc",
ProfileSiteConstants.BUNDLE
),
ProfileSiteItemController.POSITION
);
return sheet;
}
}

View File

@ -0,0 +1,108 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormInitListener;
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
import com.arsdigita.globalization.GlobalizedMessage;
import org.libreccm.cdi.utils.CdiUtil;
import org.librecms.profilesite.ProfileSiteConstants;
import org.librecms.profilesite.ProfileSiteItem;
import java.util.Locale;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ProfileSiteItemPositionForm
extends BasicItemForm
implements FormProcessListener, FormInitListener {
private final StringParameter selectedLangParam;
public ProfileSiteItemPositionForm(
final ItemSelectionModel itemModel,
final StringParameter selectedLangParam
) {
super("ProfileSiteItemEditPosition", itemModel, selectedLangParam);
this.selectedLangParam = selectedLangParam;
}
@Override
public void addWidgets() {
add(
new Label(
new GlobalizedMessage(
"profile_site_item.ui.position",
ProfileSiteConstants.BUNDLE
)
)
);
final ParameterModel positionParam = new StringParameter(
ProfileSiteItemController.POSITION);
final TextArea position = new TextArea(positionParam);
position.setCols(80);
position.setRows(8);
add(position);
}
@Override
public void init(final FormSectionEvent event) throws FormProcessException {
final PageState state = event.getPageState();
final FormData data = event.getFormData();
final ProfileSiteItem profile
= (ProfileSiteItem) getItemSelectionModel()
.getSelectedItem(state);
data.put(ProfileSiteItemController.POSITION, profile.getPosition());
setVisible(state, true);
}
@Override
public void process(final FormSectionEvent event)
throws FormProcessException {
final PageState state = event.getPageState();
final FormData data = event.getFormData();
final ProfileSiteItem profile
= (ProfileSiteItem) getItemSelectionModel()
.getSelectedItem(state);
if ((profile != null)
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
final ProfileSiteItemController controller = CdiUtil
.createCdiUtil()
.findBean(ProfileSiteItemController.class);
final Locale selectedLocale = SelectedLanguageUtil.selectedLocale(
state, selectedLangParam
);
controller.setPosition(
profile.getObjectId(),
(String) data.get(ProfileSiteItemController.POSITION),
selectedLocale
);
}
init(event);
}
}

View File

@ -0,0 +1,81 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
import org.librecms.profilesite.ProfileSiteConstants;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ProfileSiteItemPositionStep extends SimpleEditStep {
private String EDIT_POSITION_SHEET_NAME = "editPosition";
public ProfileSiteItemPositionStep(
final ItemSelectionModel itemModel,
final AuthoringKitWizard parent,
final StringParameter selectedLangParam
) {
this(itemModel, parent, selectedLangParam, null);
}
public ProfileSiteItemPositionStep(
final ItemSelectionModel itemModel,
final AuthoringKitWizard parent,
final StringParameter selectedLangParam,
final String prefix
) {
super(itemModel, parent, selectedLangParam, prefix);
final BasicItemForm editPositionForm = new ProfileSiteItemPositionForm(
itemModel, selectedLangParam
);
add(
EDIT_POSITION_SHEET_NAME,
new GlobalizedMessage(
"profile_site_site.ui.position.edit",
ProfileSiteConstants.BUNDLE
),
new WorkflowLockedComponentAccess(parent, itemModel),
editPositionForm.getSaveCancelSection().getCancelButton()
);
setDisplayComponent(getProfileSiteItemPositionSheet(
itemModel, selectedLangParam)
);
}
public static final Component getProfileSiteItemPositionSheet(
final ItemSelectionModel itemModel,
final StringParameter selectedLangParam
) {
final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
itemModel, false, selectedLangParam
);
sheet.add(
new GlobalizedMessage(
"profile_site_item.ui.position",
ProfileSiteConstants.BUNDLE
),
ProfileSiteItemController.POSITION
);
return sheet;
}
}

View File

@ -0,0 +1,116 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SegmentedPanel;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
import org.librecms.assets.Person;
import org.librecms.profilesite.ProfileSiteConstants;
import org.librecms.profilesite.ProfileSiteItem;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ProfileSiteItemPropertiesStep extends SimpleEditStep {
public static final String EDIT_SHEET_NAME = "editProfileSiteItem";
public ProfileSiteItemPropertiesStep(
final ItemSelectionModel itemModel,
final AuthoringKitWizard parent,
final StringParameter selectedLangParam
) {
super(itemModel, parent, selectedLangParam);
setDefaultEditKey(EDIT_SHEET_NAME);
final SimpleEditStep basicProperties = new SimpleEditStep(
itemModel, parent, selectedLangParam, EDIT_SHEET_NAME
);
final BasicPageForm editBasicSheet = new ProfileSiteItemPropertyForm(
itemModel, this, selectedLangParam
);
basicProperties.add(
EDIT_SHEET_NAME,
new GlobalizedMessage(
ProfileSiteConstants.BUNDLE,
"profile_site.ui.edit_basic_properties"
),
new WorkflowLockedComponentAccess(editBasicSheet, itemModel),
editBasicSheet.getSaveCancelSection().getCancelButton()
);
basicProperties.setDisplayComponent(
getProfileSiteItemPropertiesSheet(itemModel, selectedLangParam)
);
final SegmentedPanel segmentedPanel = new SegmentedPanel();
segmentedPanel.addSegment(
new Label(
new GlobalizedMessage(
ProfileSiteConstants.BUNDLE,
"profile_site.ui.basic_properties"
)
),
basicProperties
);
setDisplayComponent(segmentedPanel);
}
public static Component getProfileSiteItemPropertiesSheet(
final ItemSelectionModel itemModel,
final StringParameter selectedLangParam
) {
final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
itemModel, false, selectedLangParam
);
sheet.add(
new GlobalizedMessage(
ProfileSiteConstants.BUNDLE, "profile_site.ui.OWNER"
),
ProfileSiteItemController.OWNER,
new OwnerFormatter()
);
return sheet;
}
private static class OwnerFormatter
implements DomainObjectPropertySheet.AttributeFormatter {
@Override
public String format(
final Object obj, final String attribute, final PageState state
) {
final ProfileSiteItem profileSiteItem = (ProfileSiteItem) obj;
final Person owner = profileSiteItem.getOwner();
if (owner == null) {
return "";
} else {
return owner.getDisplayName();
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More