fix-contentsectionsetup-workflow-uuid #2
|
|
@ -1,4 +1,11 @@
|
|||
nb-configuration.xml
|
||||
node
|
||||
node_modules
|
||||
runtime
|
||||
target
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.tscache
|
||||
*.vscode
|
||||
|
|
|
|||
|
|
@ -0,0 +1,85 @@
|
|||
# LibreCCM/LibreCMS Installation
|
||||
|
||||
## WildFly
|
||||
|
||||
### Preparation (optional)
|
||||
|
||||
These steps are optional and can be skipped if you have already a WildFly server
|
||||
up and running or if you already installed the PostgreSQL JDBC driver in your
|
||||
WildFly instance.
|
||||
|
||||
#### WildFly installation
|
||||
|
||||
Download WildFly and extract the archive. For more informations about setting
|
||||
wildfly please refer to the WildFly documentation
|
||||
|
||||
#### Install the PostgreSQL JDBC driver
|
||||
|
||||
1. Download the PostgreSQL JDBC driver from
|
||||
https://jdbc.postgresql.org/download.html
|
||||
2. Go to the home directory of your WildFly installation and to
|
||||
`modules/system/layers/base`
|
||||
3. Create a new directory `org/postgresql/main`
|
||||
4. Create a `module.xml` file in the `org/postgresql/main` directory with the
|
||||
following content:
|
||||
|
||||
```
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module xmlns="urn:jboss:module:1.1" name="org.postgresql">
|
||||
<resources>
|
||||
<resource-root path="postgresql-42.2.10.jar"/>
|
||||
</resources>
|
||||
<dependencies>
|
||||
<module name="javax.api"/>
|
||||
<module name="javax.transaction.api"/>
|
||||
</dependencies>
|
||||
</module>
|
||||
```
|
||||
|
||||
Change the name of the JAR file to the correct name!
|
||||
|
||||
5. Start the JBOSS CLI tool: `bin/jboss-cli.sh` or `bin/jboss-cli.bat`. Enable
|
||||
the new module:
|
||||
|
||||
```
|
||||
[standalone@localhost:9990 /] /subsystem=datasources/jdbc-driver=postgresql:add(
|
||||
driver-name=postgresql,
|
||||
driver-module-name=org.postgresql,
|
||||
driver-class-name=org.postgresql.Driver
|
||||
)
|
||||
```
|
||||
|
||||
Note: The above command can be in one line.
|
||||
|
||||
### Installing LibreCCM/LibreCMS
|
||||
|
||||
#### Database
|
||||
|
||||
1. Create a new database user
|
||||
2. Create a new database in your PostgreSQL server owned by the user created
|
||||
in the previous step.
|
||||
|
||||
#### Create a datasource
|
||||
|
||||
1. Start the JBOSS CLI tool: `bin/jboss-cli.sh` or `bin/jboss-cli.bat`.
|
||||
2. Add new datasource:
|
||||
```
|
||||
[standalone@localhost:9990 /] data-source add --name=librecms --driver-name=postgresql --jndi-name=java:/comp/env/jdbc/libreccm/db --connection-url=jdbc:postgresql://localhost:5432/librecm --user-name=libreccm --password=libreccm
|
||||
```
|
||||
|
||||
Replace the name of the datasource, the connection URL,
|
||||
the user name and the password with the correct values for your environment.
|
||||
|
||||
|
||||
#### Deploy LibreCCM/LibreCMS
|
||||
|
||||
Simpley copy the the WAR file from one of the bundle modules to to the
|
||||
directory `standalone/deployments` of your WildFly installation.
|
||||
|
||||
## Thorntail
|
||||
|
||||
ToDo
|
||||
|
||||
## TomEE
|
||||
|
||||
ToDo
|
||||
|
|
@ -24,6 +24,15 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
stage("Deploy") {
|
||||
steps {
|
||||
dir('') {
|
||||
configFileProvider([configFile(fileId: 'libreccm-packages-deploy', variable: 'MAVEN_SETTINGS')]) {
|
||||
sh 'mvn -U -s "$MAVEN_SETTINGS" -e deploy'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
success {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -5,7 +5,7 @@
|
|||
"build": "webpack"
|
||||
},
|
||||
"dependencies": {
|
||||
"ccm-cms-pagemodelseditor": "7.0.0",
|
||||
"@librecms/ccm-cms-pagemodelseditor": "7.0.0",
|
||||
"tinymce": "^4.8.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -104,39 +104,39 @@
|
|||
</configuration>
|
||||
</execution>
|
||||
<!-- <execution>
|
||||
<id>npm link ccm-pagemodelseditor</id>
|
||||
<id>npm link @libreccm/ccm-pagemodelseditor</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>link ccm-pagemodelseditor</arguments>
|
||||
<arguments>link @libreccm/ccm-pagemodelseditor</arguments>
|
||||
</configuration>
|
||||
</execution> -->
|
||||
<execution>
|
||||
<id>npm link ccm-cms-pagemodelseditor</id>
|
||||
<id>npm link @librecms/ccm-cms-pagemodelseditor</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>link ccm-cms-pagemodelseditor</arguments>
|
||||
<arguments>link @librecms/ccm-cms-pagemodelseditor</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<!-- <execution>
|
||||
<id>npm link ccm-cms-tinymce</id>
|
||||
<id>npm link @librecms/ccm-cms-tinymce</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>link ccm-cms-tinymce</arguments>
|
||||
<arguments>link @librecms/ccm-cms-tinymce</arguments>
|
||||
</configuration>
|
||||
</execution>-->
|
||||
<!--<execution>
|
||||
<id>npm link ccm-cms-js</id>
|
||||
<id>npm link @librecms/ccm-cms-js</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>link ccm-cms-js</arguments>
|
||||
<arguments>link @librecms/ccm-cms-js</arguments>
|
||||
</configuration>
|
||||
</execution>-->
|
||||
<execution>
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
import "ccm-cms-pagemodelseditor";
|
||||
import "@librecms/ccm-cms-pagemodelseditor";
|
||||
|
|
|
|||
|
|
@ -38,6 +38,11 @@
|
|||
<artifactId>ccm-theme-foundry</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.librecms</groupId>
|
||||
<artifactId>ccm-theme-ftllibs-devel</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sf.saxon</groupId>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "ccm-cms-js",
|
||||
"name": "@librecms/ccm-cms-js",
|
||||
"version": "7.0.0",
|
||||
"description": "JavaScript for the ccm-cms-module",
|
||||
"repository": {
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
"tslint": "tslint --project ."
|
||||
},
|
||||
"dependencies": {
|
||||
"ccm-pagemodelseditor": "7.0.0",
|
||||
"@libreccm/ccm-pagemodelseditor": "7.0.0",
|
||||
"react": "^16.4.2",
|
||||
"react-dom": "^16.4.2",
|
||||
"react-redux": "^5.0.7",
|
||||
|
|
|
|||
|
|
@ -79,12 +79,12 @@
|
|||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm link ccm-pagemodelseditor</id>
|
||||
<id>npm link @libreccm/ccm-pagemodelseditor</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>link ccm-pagemodelseditor</arguments>
|
||||
<arguments>link @libreccm/ccm-pagemodelseditor</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
|
|
|
|||
|
|
@ -1,125 +1,10 @@
|
|||
{
|
||||
"name": "ccm-cms-pagemodelseditor",
|
||||
"name": "@librecms/ccm-cms-pagemodelseditor",
|
||||
"version": "7.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "10.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.7.1.tgz",
|
||||
"integrity": "sha512-EGoI4ylB/lPOaqXqtzAyL8HcgOuCtH2hkEaLmkueOYufsTFWBn4VCvlCDC2HW8Q+9iF+QVC3sxjDKQYjHQeZ9w==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/prop-types": {
|
||||
"version": "15.5.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.5.5.tgz",
|
||||
"integrity": "sha512-mOrlCEdwX3seT3n0AXNt4KNPAZZxcsABUHwBgFXOt+nvFUXkxCAO6UBJHPrDxWEa2KDMil86355fjo8jbZ+K0Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/react": "16.4.11"
|
||||
}
|
||||
},
|
||||
"@types/react": {
|
||||
"version": "16.4.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.4.11.tgz",
|
||||
"integrity": "sha512-1DQnmwO8u8N3ucvRX2ZLDEjQ2VctkAvL/rpbm2ev4uaZA0z4ysU+I0tk+K8ZLblC6p7MCgFyF+cQlSNIPUHzeQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/prop-types": "15.5.5",
|
||||
"csstype": "2.5.6"
|
||||
}
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"version": "16.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.0.7.tgz",
|
||||
"integrity": "sha512-vaq4vMaJOaNgFff1t3LnHYr6vRa09vRspMkmLdXtFZmO1fwDI2snP+dpOkwrtlU8UC8qsqemCu4RmVM2OLq/fA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "10.7.1",
|
||||
"@types/react": "16.4.11"
|
||||
}
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
||||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
|
||||
"dev": true
|
||||
},
|
||||
"argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"sprintf-js": "1.0.3"
|
||||
}
|
||||
},
|
||||
"asap": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
|
||||
"integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY="
|
||||
},
|
||||
"babel-code-frame": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
|
||||
"integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "1.1.3",
|
||||
"esutils": "2.0.2",
|
||||
"js-tokens": "3.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
||||
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "2.2.1",
|
||||
"escape-string-regexp": "1.0.5",
|
||||
"has-ansi": "2.0.0",
|
||||
"strip-ansi": "3.0.1",
|
||||
"supports-color": "2.0.0"
|
||||
}
|
||||
},
|
||||
"js-tokens": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
|
||||
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"builtin-modules": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
|
||||
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
|
||||
"dev": true
|
||||
},
|
||||
"ccm-pagemodelseditor": {
|
||||
"@libreccm/ccm-pagemodelseditor": {
|
||||
"version": "7.0.0",
|
||||
"requires": {
|
||||
"react": "16.4.2",
|
||||
|
|
@ -604,6 +489,121 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "10.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.7.1.tgz",
|
||||
"integrity": "sha512-EGoI4ylB/lPOaqXqtzAyL8HcgOuCtH2hkEaLmkueOYufsTFWBn4VCvlCDC2HW8Q+9iF+QVC3sxjDKQYjHQeZ9w==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/prop-types": {
|
||||
"version": "15.5.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.5.5.tgz",
|
||||
"integrity": "sha512-mOrlCEdwX3seT3n0AXNt4KNPAZZxcsABUHwBgFXOt+nvFUXkxCAO6UBJHPrDxWEa2KDMil86355fjo8jbZ+K0Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/react": "16.4.11"
|
||||
}
|
||||
},
|
||||
"@types/react": {
|
||||
"version": "16.4.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.4.11.tgz",
|
||||
"integrity": "sha512-1DQnmwO8u8N3ucvRX2ZLDEjQ2VctkAvL/rpbm2ev4uaZA0z4ysU+I0tk+K8ZLblC6p7MCgFyF+cQlSNIPUHzeQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/prop-types": "15.5.5",
|
||||
"csstype": "2.5.6"
|
||||
}
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"version": "16.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.0.7.tgz",
|
||||
"integrity": "sha512-vaq4vMaJOaNgFff1t3LnHYr6vRa09vRspMkmLdXtFZmO1fwDI2snP+dpOkwrtlU8UC8qsqemCu4RmVM2OLq/fA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "10.7.1",
|
||||
"@types/react": "16.4.11"
|
||||
}
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
||||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
|
||||
"dev": true
|
||||
},
|
||||
"argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"sprintf-js": "1.0.3"
|
||||
}
|
||||
},
|
||||
"asap": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
|
||||
"integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY="
|
||||
},
|
||||
"babel-code-frame": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
|
||||
"integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "1.1.3",
|
||||
"esutils": "2.0.2",
|
||||
"js-tokens": "3.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
||||
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "2.2.1",
|
||||
"escape-string-regexp": "1.0.5",
|
||||
"has-ansi": "2.0.0",
|
||||
"strip-ansi": "3.0.1",
|
||||
"supports-color": "2.0.0"
|
||||
}
|
||||
},
|
||||
"js-tokens": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
|
||||
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"builtin-modules": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
|
||||
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "ccm-cms-pagemodelseditor",
|
||||
"name": "@librecms/ccm-cms-pagemodelseditor",
|
||||
"version": "7.0.0",
|
||||
"description": "Adds editor components for PageModels components provided by ccm-cms",
|
||||
"repository": {
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
"tslint": "tslint --project ."
|
||||
},
|
||||
"dependencies": {
|
||||
"ccm-pagemodelseditor": "7.0.0",
|
||||
"@libreccm/ccm-pagemodelseditor": "7.0.0",
|
||||
"react": "^16.4.2",
|
||||
"react-dom": "^16.4.2"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@
|
|||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm link ccm-pagemodelseditor</id>
|
||||
<id>npm link @libreccm/ccm-pagemodelseditor</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>link</argument>
|
||||
<argument>ccm-pagemodelseditor</argument>
|
||||
<argument>@libreccm/ccm-pagemodelseditor</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
@ -141,12 +141,12 @@
|
|||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm link ccm-pagemodelseditor</id>
|
||||
<id>npm link @libreccm/ccm-pagemodelseditor</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>link ccm-pagemodelseditor</arguments>
|
||||
<arguments>link @libreccm/ccm-pagemodelseditor</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
|
|
@ -173,6 +173,19 @@
|
|||
<arguments>link</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>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import {
|
|||
ComponentModelEditorProps,
|
||||
EditorComponents,
|
||||
PageModelEditor,
|
||||
} from "ccm-pagemodelseditor";
|
||||
} from "@libreccm/ccm-pagemodelseditor";
|
||||
|
||||
class CategoryTreeComponentPropertiesList
|
||||
extends React.Component<
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "ccm-cms-tinymce",
|
||||
"name": "@librecms/ccm-cms-tinymce",
|
||||
"version": "7.0.0",
|
||||
"description": "Extensions for TinyMCE specific for ccm-cms",
|
||||
"repository": {
|
||||
|
|
|
|||
|
|
@ -129,15 +129,15 @@ public class MultiPartArticleEditForm extends MultiPartArticleForm
|
|||
.selectedLocale(state, selectedLanguageParam);
|
||||
|
||||
final String newName = (String) data.get(MultiPartArticleForm.NAME);
|
||||
final String oldName = article.getName().getValue(selectedLocale);
|
||||
final MultiPartArticleFormController controller = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(MultiPartArticleFormController.class);
|
||||
final String oldName = controller.getName(article, selectedLocale);
|
||||
|
||||
final boolean valid;
|
||||
if (newName.equalsIgnoreCase(oldName)) {
|
||||
valid = true;
|
||||
} else {
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final MultiPartArticleFormController controller = cdiUtil
|
||||
.findBean(MultiPartArticleFormController.class);
|
||||
final Optional<Folder> folder = controller.getArticleFolder(article);
|
||||
if (folder.isPresent()) {
|
||||
valid = validateNameUniqueness(folder.get(), event);
|
||||
|
|
|
|||
|
|
@ -233,14 +233,17 @@ public abstract class MultiPartArticleForm
|
|||
|
||||
final Locale selectedLocale = SelectedLanguageUtil
|
||||
.selectedLocale(state, selectedLanguageParam);
|
||||
final MultiPartArticleFormController controller = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(MultiPartArticleFormController.class);
|
||||
|
||||
if (article != null) {
|
||||
data.put(NAME, article.getName().getValue(selectedLocale));
|
||||
data.put(TITLE, article.getTitle().getValue(selectedLocale));
|
||||
data.put(NAME, controller.getName(article, selectedLocale));
|
||||
data.put(TITLE, controller.getTitle(article, selectedLocale));
|
||||
if (!CMSConfig.getConfig().isHideLaunchDate()) {
|
||||
data.put(LAUNCH_DATE, article.getLaunchDate());
|
||||
}
|
||||
data.put(SUMMARY, article.getSummary().getValue(selectedLocale));
|
||||
data.put(SUMMARY, controller.getSummary(article, selectedLocale));
|
||||
}
|
||||
|
||||
return article;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ import org.librecms.contentsection.ContentItemRepository;
|
|||
import org.librecms.contentsection.Folder;
|
||||
import org.librecms.contenttypes.MultiPartArticle;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
|
@ -46,8 +48,9 @@ public class MultiPartArticleFormController {
|
|||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected Optional<Folder> getArticleFolder(final MultiPartArticle article) {
|
||||
|
||||
final Optional<ContentItem> mpa = itemRepo
|
||||
.findById(article.getObjectId());
|
||||
final Optional<ContentItem> mpa = itemRepo.findById(
|
||||
article.getObjectId()
|
||||
);
|
||||
|
||||
if (mpa.isPresent()) {
|
||||
return itemManager.getItemFolder(mpa.get());
|
||||
|
|
@ -56,4 +59,62 @@ public class MultiPartArticleFormController {
|
|||
}
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getName(
|
||||
final MultiPartArticle fromMpa, final Locale forLocale
|
||||
) {
|
||||
Objects.requireNonNull(fromMpa);
|
||||
Objects.requireNonNull(forLocale);
|
||||
final MultiPartArticle mpa = itemRepo
|
||||
.findById(fromMpa.getObjectId(), MultiPartArticle.class)
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No MultiPartArticle with ID %d available",
|
||||
fromMpa.getObjectId()
|
||||
)
|
||||
)
|
||||
);
|
||||
return mpa.getName().getValue(forLocale);
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getTitle(
|
||||
final MultiPartArticle fromMpa, final Locale forLocale
|
||||
) {
|
||||
Objects.requireNonNull(fromMpa);
|
||||
Objects.requireNonNull(forLocale);
|
||||
final MultiPartArticle mpa = itemRepo
|
||||
.findById(fromMpa.getObjectId(), MultiPartArticle.class)
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No MultiPartArticle with ID %d available",
|
||||
fromMpa.getObjectId()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return mpa.getTitle().getValue(forLocale);
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getSummary(
|
||||
final MultiPartArticle fromMpa, final Locale forLocale
|
||||
) {
|
||||
Objects.requireNonNull(fromMpa);
|
||||
Objects.requireNonNull(forLocale);
|
||||
final MultiPartArticle mpa = itemRepo
|
||||
.findById(fromMpa.getObjectId(), MultiPartArticle.class)
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No MultiPartArticle with ID %d available",
|
||||
fromMpa.getObjectId()
|
||||
)
|
||||
)
|
||||
);
|
||||
return mpa.getSummary().getValue(forLocale);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ import org.librecms.contenttypes.MultiPartArticleSectionManager;
|
|||
import org.librecms.contenttypes.MultiPartArticleSectionRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
|
@ -138,4 +140,70 @@ class MultiPartArticleSectionStepController {
|
|||
sectionManager.moveSectionAfter(theArticle, section, after);
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getSectionTitle(
|
||||
final MultiPartArticleSection ofSection, final Locale forLocale
|
||||
) {
|
||||
Objects.requireNonNull(ofSection);
|
||||
Objects.requireNonNull(forLocale);
|
||||
|
||||
final MultiPartArticleSection section = sectionRepo
|
||||
.findById(ofSection.getSectionId())
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No section with ID %d available.", ofSection
|
||||
.getSectionId()
|
||||
)
|
||||
)
|
||||
);
|
||||
return section.getTitle().getValue(forLocale);
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getSectionText(
|
||||
final MultiPartArticleSection ofSection, final Locale forLocale
|
||||
) {
|
||||
Objects.requireNonNull(ofSection);
|
||||
Objects.requireNonNull(forLocale);
|
||||
|
||||
final MultiPartArticleSection section = sectionRepo
|
||||
.findById(ofSection.getSectionId())
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No section with ID %d available.", ofSection
|
||||
.getSectionId()
|
||||
)
|
||||
)
|
||||
);
|
||||
return section.getText().getValue(forLocale);
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public void updateSection(
|
||||
final MultiPartArticleSection section,
|
||||
final String title,
|
||||
final String text,
|
||||
final boolean pageBreak,
|
||||
final Locale locale
|
||||
) {
|
||||
Objects.requireNonNull(section);
|
||||
Objects.requireNonNull(locale);
|
||||
|
||||
final MultiPartArticleSection update = sectionRepo
|
||||
.findById(section.getSectionId())
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No section with ID %d available.",
|
||||
section.getSectionId()
|
||||
)
|
||||
)
|
||||
);
|
||||
update.getTitle().addValue(locale, title);
|
||||
update.getText().addValue(locale, title);
|
||||
update.setPageBreak(pageBreak);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,11 +158,16 @@ public class MultiPartArticleSectionsStep extends ResettableContainer {
|
|||
final Locale selectedLocale = SelectedLanguageUtil
|
||||
.selectedLocale(state, selectedLanguageParam);
|
||||
|
||||
final MultiPartArticleSectionStepController controller = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(MultiPartArticleSectionStepController.class);
|
||||
|
||||
final Object[] parameterObj = {
|
||||
controller.getSectionTitle(
|
||||
moveSectionModel
|
||||
.getSelectedSection(state)
|
||||
.getTitle()
|
||||
.getValue(selectedLocale)
|
||||
.getSelectedSection(state),
|
||||
selectedLocale
|
||||
)
|
||||
};
|
||||
|
||||
target.setLabel(new GlobalizedMessage(
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import com.arsdigita.globalization.GlobalizedMessage;
|
|||
|
||||
import org.librecms.contenttypes.MultiPartArticle;
|
||||
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
|
|
@ -110,9 +109,14 @@ public class SectionDeleteForm extends Form
|
|||
final Locale selectedLocale = SelectedLanguageUtil
|
||||
.selectedLocale(state, selectedLanguageParam);
|
||||
|
||||
final MultiPartArticleSectionStepController controller = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(MultiPartArticleSectionStepController.class);
|
||||
|
||||
sectionNameLabel.setLabel(
|
||||
section.getTitle().getValue(selectedLocale),
|
||||
state);
|
||||
controller.getSectionTitle(section, selectedLocale),
|
||||
state
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -198,12 +198,19 @@ public class SectionEditForm extends Form {
|
|||
|
||||
final Locale selectedLocale = SelectedLanguageUtil
|
||||
.selectedLocale(state, selectedLanguageParam);
|
||||
final MultiPartArticleSectionStepController controller = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(MultiPartArticleSectionStepController.class);
|
||||
|
||||
final MultiPartArticleSection section = selectedSectionModel
|
||||
.getSelectedSection(state);
|
||||
|
||||
data.put(TITLE, section.getTitle().getValue(selectedLocale));
|
||||
data.put(TEXT, section.getText().getValue(selectedLocale));
|
||||
data.put(
|
||||
TITLE, controller.getSectionTitle(section, selectedLocale)
|
||||
);
|
||||
data.put(
|
||||
TEXT, controller.getSectionText(section, selectedLocale)
|
||||
);
|
||||
|
||||
if (section.isPageBreak()) {
|
||||
data.put(PAGE_BREAK, new Object[]{"true"});
|
||||
|
|
@ -281,9 +288,8 @@ public class SectionEditForm extends Form {
|
|||
section = selectedSectionModel.getSelectedSection(state);
|
||||
}
|
||||
|
||||
section.getTitle().addValue(selectedLocale,
|
||||
(String) data.get(TITLE));
|
||||
|
||||
// section.getTitle().addValue(selectedLocale,
|
||||
// (String) data.get(TITLE));
|
||||
final Object[] pageBreakVal = (Object[]) data.get(PAGE_BREAK);
|
||||
final boolean pageBreak;
|
||||
if (pageBreakVal == null
|
||||
|
|
@ -293,7 +299,7 @@ public class SectionEditForm extends Form {
|
|||
} else {
|
||||
pageBreak = true;
|
||||
}
|
||||
section.setPageBreak(pageBreak);
|
||||
// section.setPageBreak(pageBreak);
|
||||
|
||||
final String text;
|
||||
if (data.get(TEXT) == null) {
|
||||
|
|
@ -301,12 +307,24 @@ public class SectionEditForm extends Form {
|
|||
} else {
|
||||
text = (String) data.get(TEXT);
|
||||
}
|
||||
// section.getText().addValue(selectedLocale, text);
|
||||
|
||||
// sectionRepo.save(section);
|
||||
if (selectedSectionModel.getSelectedKey(state) == null) {
|
||||
section.getTitle().addValue(selectedLocale,
|
||||
(String) data.get(TITLE));
|
||||
section.setPageBreak(pageBreak);
|
||||
section.getText().addValue(selectedLocale, text);
|
||||
|
||||
sectionRepo.save(section);
|
||||
|
||||
if (selectedSectionModel.getSelectedKey(state) == null) {
|
||||
controller.addSection(article, section);
|
||||
} else {
|
||||
controller.updateSection(
|
||||
section,
|
||||
(String) data.get(TITLE),
|
||||
text,
|
||||
pageBreak,
|
||||
selectedLocale
|
||||
);
|
||||
}
|
||||
|
||||
if (sectionsStep != null) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import org.librecms.contenttypes.MultiPartArticleSection;
|
|||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
class SectionTableModel implements TableModel {
|
||||
|
||||
|
|
@ -110,12 +111,19 @@ class SectionTableModel implements TableModel {
|
|||
return null;
|
||||
}
|
||||
|
||||
final MultiPartArticleSectionStepController controller = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(MultiPartArticleSectionStepController.class);
|
||||
|
||||
switch (columnIndex) {
|
||||
case SectionTable.COL_INDEX_TITLE:
|
||||
return currentSection
|
||||
.getTitle()
|
||||
.getValue(SelectedLanguageUtil
|
||||
.selectedLocale(pageState, selectedLanguageParam));
|
||||
return controller.getSectionTitle(
|
||||
currentSection,
|
||||
SelectedLanguageUtil.selectedLocale(
|
||||
pageState, selectedLanguageParam
|
||||
)
|
||||
)
|
||||
;
|
||||
case SectionTable.COL_PAGE_BREAK:
|
||||
if (currentSection.isPageBreak()) {
|
||||
return new Label(
|
||||
|
|
|
|||
|
|
@ -18,8 +18,11 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui.authoring.news;
|
||||
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
import org.librecms.contentsection.ContentSectionRepository;
|
||||
|
||||
|
|
@ -32,13 +35,18 @@ import javax.inject.Inject;
|
|||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.TypedQuery;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.libreccm.security.PermissionChecker;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.security.RoleRepository;
|
||||
import org.libreccm.security.Shiro;
|
||||
import org.libreccm.security.User;
|
||||
import org.librecms.contentsection.ContentItemRepository;
|
||||
import org.librecms.contentsection.ContentType;
|
||||
import org.librecms.contentsection.ContentTypeRepository;
|
||||
import org.librecms.contenttypes.News;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Controller class for the {@link NewItemForm}.
|
||||
|
|
@ -111,4 +119,6 @@ class NewItemFormController {
|
|||
return query.getResultList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.ui.authoring.news;
|
||||
|
||||
import org.librecms.contentsection.ContentItemRepository;
|
||||
import org.librecms.contenttypes.News;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class NewsController {
|
||||
|
||||
@Inject
|
||||
private ContentItemRepository itemRepo;
|
||||
|
||||
@Transactional
|
||||
protected String getDescription(
|
||||
final News fromNews, final Locale forLocale
|
||||
) {
|
||||
Objects.requireNonNull(fromNews);
|
||||
final News news = itemRepo
|
||||
.findById(fromNews.getObjectId(), News.class)
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No News with ID %d available.", fromNews.getObjectId()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return news.getDescription().getValue(forLocale);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
protected String getText(final News fromNews, final Locale forLocale) {
|
||||
Objects.requireNonNull(fromNews);
|
||||
final News news = itemRepo
|
||||
.findById(fromNews.getObjectId(), News.class)
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No News with ID %d available",
|
||||
fromNews.getObjectId()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return news.getText().getValue(forLocale);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
protected void updateText(
|
||||
final News ofNews,
|
||||
final Locale forLocale,
|
||||
final String text
|
||||
) {
|
||||
Objects.requireNonNull(ofNews);
|
||||
final News news = itemRepo
|
||||
.findById(ofNews.getObjectId(), News.class)
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No News with ID %d available",
|
||||
ofNews.getObjectId()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
news.getText().addValue(forLocale, text);
|
||||
itemRepo.save(news);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
protected void update(
|
||||
final News news,
|
||||
final Date releaseDate,
|
||||
final Locale locale,
|
||||
final String description
|
||||
) {
|
||||
Objects.requireNonNull(news);
|
||||
final News update = itemRepo
|
||||
.findById(news.getObjectId(), News.class)
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No News with ID %d available",
|
||||
news.getObjectId()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
update.setReleaseDate(releaseDate);
|
||||
update.getDescription().addValue(locale, description);
|
||||
itemRepo.save(update);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -36,7 +36,6 @@ import org.librecms.contenttypes.News;
|
|||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
|
|
@ -45,6 +44,7 @@ import org.librecms.contentsection.ContentItemRepository;
|
|||
import org.librecms.contenttypes.NewsConfig;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
|
@ -181,7 +181,10 @@ public class NewsPropertyForm extends BasicPageForm
|
|||
|
||||
releaseDateSelector.addYear(releaseDate);
|
||||
data.put(NEWS_DATE, releaseDate);
|
||||
data.put(LEAD, item.getDescription().getValue(selectedLocale));
|
||||
final NewsController controller = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(NewsController.class);
|
||||
data.put(LEAD, controller.getDescription(item, selectedLocale));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -218,21 +221,15 @@ public class NewsPropertyForm extends BasicPageForm
|
|||
.getSaveButton()
|
||||
.isSelected(event.getPageState())) {
|
||||
|
||||
final NewsController controller = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(NewsController.class);
|
||||
|
||||
final Date releaseDate = (java.util.Date) data.get(NEWS_DATE);
|
||||
final String description = (String) data.get(LEAD);
|
||||
final Locale selectedLocale = SelectedLanguageUtil
|
||||
.selectedLocale(state, selectedLanguageParam);
|
||||
|
||||
item.setReleaseDate((java.util.Date) data.get(NEWS_DATE));
|
||||
item
|
||||
.getDescription()
|
||||
.addValue(
|
||||
selectedLocale,
|
||||
(String) data.get(LEAD));
|
||||
|
||||
final ContentItemRepository itemRepo = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(ContentItemRepository.class);
|
||||
|
||||
itemRepo.save(item);
|
||||
controller.update(item, releaseDate, selectedLocale, description);
|
||||
}
|
||||
if (propertiesStep != null) {
|
||||
propertiesStep.maybeForwardToNextStep(event.getPageState());
|
||||
|
|
|
|||
|
|
@ -83,10 +83,13 @@ public class NewsTextBody extends TextBody {
|
|||
|
||||
final News news = getSelectedNews(state);
|
||||
|
||||
return news
|
||||
.getText()
|
||||
.getValue(SelectedLanguageUtil
|
||||
.selectedLocale(state, selectedLanguageParam));
|
||||
final NewsController controller = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(NewsController.class);
|
||||
return controller.getText(
|
||||
news,
|
||||
SelectedLanguageUtil.selectedLocale(state, selectedLanguageParam)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -97,11 +100,10 @@ public class NewsTextBody extends TextBody {
|
|||
final Locale selectedLocale = SelectedLanguageUtil
|
||||
.selectedLocale(state, selectedLanguageParam);
|
||||
|
||||
news.getText().addValue(selectedLocale, text);
|
||||
final ContentItemRepository itemRepo = CdiUtil
|
||||
final NewsController controller = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(ContentItemRepository.class);
|
||||
itemRepo.save(news);
|
||||
.findBean(NewsController.class);
|
||||
controller.updateText(news, selectedLocale, text);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,12 +35,12 @@ class FolderEditForm extends FolderBaseForm {
|
|||
|
||||
private static Logger LOGGER = LogManager.getLogger(FolderEditForm.class);
|
||||
|
||||
private final FolderRequestLocal m_folder;
|
||||
private final FolderRequestLocal folderRequestLocal;
|
||||
|
||||
public FolderEditForm(final FolderRequestLocal folder) {
|
||||
super("folder-edit");
|
||||
|
||||
m_folder = folder;
|
||||
folderRequestLocal = folder;
|
||||
|
||||
// XXX need to do name uniqueness valdation on m_fragment here
|
||||
// as well.
|
||||
|
|
@ -68,7 +68,7 @@ class FolderEditForm extends FolderBaseForm {
|
|||
public final void init(final FormSectionEvent e) {
|
||||
final PageState state = e.getPageState();
|
||||
|
||||
final Category folder = m_folder.getFolder(state);
|
||||
final Category folder = folderRequestLocal.getFolder(state);
|
||||
|
||||
m_title.setValue(state, folder.getDisplayName());
|
||||
m_fragment.setValue(state, folder.getName());
|
||||
|
|
@ -80,7 +80,7 @@ class FolderEditForm extends FolderBaseForm {
|
|||
throws FormProcessException {
|
||||
final PageState state = e.getPageState();
|
||||
|
||||
final Category folder = m_folder.getFolder(state);
|
||||
final Category folder = folderRequestLocal.getFolder(state);
|
||||
|
||||
folder.setDisplayName((String) m_title.getValue(state));
|
||||
folder.setName((String) m_fragment.getValue(state));
|
||||
|
|
|
|||
|
|
@ -63,12 +63,10 @@ public class FolderEditorForm extends FolderForm {
|
|||
final Folder folder = getCurrentFolder(state);
|
||||
data.put(NAME, folder.getName());
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
||||
ConfigurationManager.class);
|
||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
KernelConfig.class);
|
||||
data.put(TITLE,
|
||||
folder.getTitle().getValue(kernelConfig.getDefaultLocale()));
|
||||
final FolderEditorFormController controller = cdiUtil.findBean(
|
||||
FolderEditorFormController.class
|
||||
);
|
||||
data.put(TITLE, controller.getFolderTitle(folder));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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.ui.folder;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
import org.librecms.contentsection.Folder;
|
||||
import org.librecms.contentsection.FolderRepository;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
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
|
||||
public class FolderEditorFormController {
|
||||
|
||||
@Inject
|
||||
private ConfigurationManager confManager;
|
||||
|
||||
@Inject
|
||||
private FolderRepository folderRepository;
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getFolderTitle(final Folder ofFolder) {
|
||||
final Folder folder = folderRepository
|
||||
.findById(Objects.requireNonNull(ofFolder).getObjectId())
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format("No folder with ID %d available.",
|
||||
ofFolder.getObjectId())
|
||||
)
|
||||
);
|
||||
|
||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
KernelConfig.class
|
||||
);
|
||||
return folder.getTitle().getValue(kernelConfig.getDefaultLocale());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,9 +18,12 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui.lifecycle;
|
||||
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.toolbox.ui.Property;
|
||||
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
import org.librecms.CmsConstants;
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
import org.librecms.contentsection.ContentSectionManager;
|
||||
import org.librecms.contentsection.ContentSectionRepository;
|
||||
|
|
@ -30,9 +33,12 @@ import org.librecms.lifecycle.PhaseDefinition;
|
|||
import org.librecms.lifecycle.PhaseDefinititionRepository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
|
|
@ -72,7 +78,73 @@ class LifecycleAdminPaneController {
|
|||
section.getObjectId())));
|
||||
|
||||
return new ArrayList<>(contentSection.getLifecycleDefinitions());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<Map<String, String>> listLifecyclesForContentSection(
|
||||
final ContentSection section
|
||||
) {
|
||||
return getLifecyclesForContentSection(section)
|
||||
.stream()
|
||||
.map(this::buildLifecycleListItem)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Map<String, String> buildLifecycleListItem(
|
||||
final LifecycleDefinition lifecycleDefinition) {
|
||||
final Map<String, String> item = new HashMap<>();
|
||||
item.put(
|
||||
LifecycleListModelBuilder.LIFECYCLE_DEF_ID,
|
||||
Long.toString(lifecycleDefinition.getDefinitionId())
|
||||
);
|
||||
item.put(
|
||||
LifecycleListModelBuilder.LIFECYCLE_DEF_LABEL,
|
||||
lifecycleDefinition
|
||||
.getLabel()
|
||||
.getValue(KernelConfig.getConfig().getDefaultLocale())
|
||||
);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<Property> getLifecycleProperties(
|
||||
final LifecycleDefinition ofLifecycleDefinition
|
||||
) {
|
||||
final LifecycleDefinition definition = lifecycleDefRepo
|
||||
.findById(ofLifecycleDefinition.getDefinitionId())
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No LifecycleDefinition with ID %d found.",
|
||||
ofLifecycleDefinition.getDefinitionId()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
final KernelConfig kernelConfig = confManager
|
||||
.findConfiguration(KernelConfig.class);
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
|
||||
final List<Property> properties = new ArrayList<>();
|
||||
properties.add(
|
||||
new Property(
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.lifecycle.name",
|
||||
CmsConstants.CMS_BUNDLE
|
||||
),
|
||||
definition.getLabel().getValue(defaultLocale)
|
||||
)
|
||||
);
|
||||
properties.add(
|
||||
new Property(
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.lifecycle.description",
|
||||
CmsConstants.CMS_BUNDLE
|
||||
),
|
||||
definition.getDescription().getValue(defaultLocale)
|
||||
)
|
||||
);
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -290,7 +362,46 @@ class LifecycleAdminPaneController {
|
|||
phaseDefinition.setDefaultDuration(duration);
|
||||
|
||||
phaseDefRepo.save(phaseDefinition);
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getLifecycleDefinitionName(
|
||||
final LifecycleDefinition ofCycle
|
||||
) {
|
||||
final LifecycleDefinition cycle = lifecycleDefRepo.findById(
|
||||
Objects.requireNonNull(ofCycle).getDefinitionId()
|
||||
).orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No LifecycleDefinition with ID %d available",
|
||||
ofCycle.getDefinitionId()
|
||||
)
|
||||
)
|
||||
);
|
||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
KernelConfig.class
|
||||
);
|
||||
return cycle.getLabel().getValue(kernelConfig.getDefaultLocale());
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getLifecycleDefinitionDescription(
|
||||
final LifecycleDefinition ofCycle
|
||||
) {
|
||||
final LifecycleDefinition cycle = lifecycleDefRepo.findById(
|
||||
Objects.requireNonNull(ofCycle).getDefinitionId()
|
||||
).orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No LifecycleDefinition with ID %d available",
|
||||
ofCycle.getDefinitionId()
|
||||
)
|
||||
)
|
||||
);
|
||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
KernelConfig.class
|
||||
);
|
||||
return cycle.getDescription().getValue(kernelConfig.getDefaultLocale());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,8 +59,17 @@ class LifecycleEditForm extends BaseLifecycleForm {
|
|||
final LifecycleDefinition cycle = selectedDefinition
|
||||
.getLifecycleDefinition(state);
|
||||
|
||||
getLifecycleName().setValue(state, cycle.getLabel());
|
||||
getLifecycleDescription().setValue(state, cycle.getDescription());
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final LifecycleAdminPaneController controller = cdiUtil.findBean(
|
||||
LifecycleAdminPaneController.class
|
||||
);
|
||||
|
||||
getLifecycleName().setValue(
|
||||
state, controller.getLifecycleDefinitionName(cycle)
|
||||
);
|
||||
getLifecycleDescription().setValue(
|
||||
state, controller.getLifecycleDefinitionDescription(cycle)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,9 +61,11 @@ import java.util.Locale;
|
|||
class LifecycleItemPane extends BaseItemPane {
|
||||
|
||||
private final LifecycleDefinitionRequestLocal selectedLifecycle;
|
||||
|
||||
private final PhaseRequestLocal selectedPhase;
|
||||
|
||||
private final Container detailPane;
|
||||
|
||||
private final Table phasesTable;
|
||||
|
||||
public LifecycleItemPane(
|
||||
|
|
@ -144,23 +146,27 @@ class LifecycleItemPane extends BaseItemPane {
|
|||
final PageState state) {
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
||||
ConfigurationManager.class);
|
||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
KernelConfig.class);
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
// final ConfigurationManager confManager = cdiUtil.findBean(
|
||||
// ConfigurationManager.class);
|
||||
// final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
// KernelConfig.class);
|
||||
// final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
|
||||
final LifecycleAdminPaneController controller = cdiUtil
|
||||
.findBean(LifecycleAdminPaneController.class);
|
||||
|
||||
final java.util.List<Property> props = super.properties(state);
|
||||
final LifecycleDefinition cycle = selectedLifecycle
|
||||
.getLifecycleDefinition(state);
|
||||
|
||||
props.add(new Property(
|
||||
gz("cms.ui.lifecycle.name"),
|
||||
cycle.getLabel().getValue(defaultLocale)));
|
||||
props.add(new Property(
|
||||
gz("cms.ui.lifecycle.description"),
|
||||
cycle.getDescription().getValue(defaultLocale)));
|
||||
props.addAll(controller.getLifecycleProperties(cycle));
|
||||
|
||||
// props.add(new Property(
|
||||
// gz("cms.ui.lifecycle.name"),
|
||||
// cycle.getLabel().getValue(defaultLocale)));
|
||||
// props.add(new Property(
|
||||
// gz("cms.ui.lifecycle.description"),
|
||||
// cycle.getDescription().getValue(defaultLocale)));
|
||||
return props;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import org.librecms.lifecycle.LifecycleDefinition;
|
|||
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Loads all the current lifecycles from the database so that they may be
|
||||
|
|
@ -50,6 +51,10 @@ import java.util.Locale;
|
|||
public final class LifecycleListModelBuilder extends LockableImpl
|
||||
implements ListModelBuilder {
|
||||
|
||||
protected static final String LIFECYCLE_DEF_ID = "lifecycleDefId";
|
||||
|
||||
protected static final String LIFECYCLE_DEF_LABEL = "lifecycleDefLabel";
|
||||
|
||||
@Override
|
||||
public final ListModel makeModel(final com.arsdigita.bebop.List list,
|
||||
final PageState state) {
|
||||
|
|
@ -57,19 +62,19 @@ public final class LifecycleListModelBuilder extends LockableImpl
|
|||
final LifecycleAdminPaneController controller = cdiUtil
|
||||
.findBean(LifecycleAdminPaneController.class);
|
||||
final ContentSection section = CMS.getContext().getContentSection();
|
||||
return new Model(controller.getLifecyclesForContentSection(section));
|
||||
return new Model(controller.listLifecyclesForContentSection(section));
|
||||
}
|
||||
|
||||
private class Model implements ListModel {
|
||||
|
||||
private final Iterator<LifecycleDefinition> iterator;
|
||||
private LifecycleDefinition currentLifecycleDef;
|
||||
private final Locale defaultLocale;
|
||||
private final Iterator<Map<String, String>> iterator;
|
||||
|
||||
public Model(final List<LifecycleDefinition> lifecycles) {
|
||||
private Map<String, String> currentLifecycleDef;
|
||||
|
||||
public Model(final List<Map<String, String>> lifecycles) {
|
||||
iterator = lifecycles.iterator();
|
||||
defaultLocale = KernelConfig.getConfig().getDefaultLocale();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean next() throws NoSuchElementException {
|
||||
if (iterator.hasNext()) {
|
||||
|
|
@ -82,12 +87,12 @@ public final class LifecycleListModelBuilder extends LockableImpl
|
|||
|
||||
@Override
|
||||
public Object getElement() {
|
||||
return currentLifecycleDef.getLabel().getValue(defaultLocale);
|
||||
return currentLifecycleDef.get(LIFECYCLE_DEF_LABEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return Long.toString(currentLifecycleDef.getDefinitionId());
|
||||
return currentLifecycleDef.get(LIFECYCLE_DEF_ID);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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.ui.pages;
|
||||
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
import org.libreccm.pagemodel.PageModel;
|
||||
import org.libreccm.pagemodel.PageModelRepository;
|
||||
import org.librecms.pages.Pages;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
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 PageModelAdminPageController {
|
||||
|
||||
@Inject
|
||||
private GlobalizationHelper globalizationHelper;
|
||||
|
||||
@Inject
|
||||
private PageModelRepository pageModelRepository;
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected List<PageModelData> findDraftPageModelsByApplication(
|
||||
final Pages pages
|
||||
) {
|
||||
final List<PageModel> pageModels = pageModelRepository
|
||||
.findDraftByApplication(pages);
|
||||
return pageModels.stream().map(this::buildPageModelData).collect(
|
||||
Collectors.toList()
|
||||
);
|
||||
}
|
||||
|
||||
private PageModelData buildPageModelData(final PageModel fromPageModel) {
|
||||
final PageModelData result = new PageModelData();
|
||||
result.setPageModelId(fromPageModel.getPageModelId());
|
||||
result.setTitle(globalizationHelper.getValueFromLocalizedString(
|
||||
fromPageModel.getTitle()));
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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.ui.pages;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
class PageModelData {
|
||||
|
||||
private long pageModelId;
|
||||
|
||||
private String title;
|
||||
|
||||
public long getPageModelId() {
|
||||
return pageModelId;
|
||||
}
|
||||
|
||||
public void setPageModelId(long pageModelId) {
|
||||
this.pageModelId = pageModelId;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -50,7 +50,6 @@ import org.libreccm.categorization.Category;
|
|||
import org.libreccm.categorization.CategoryRepository;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.core.UnexpectedErrorException;
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
import org.libreccm.pagemodel.PageModel;
|
||||
import org.libreccm.pagemodel.PageModelRepository;
|
||||
import org.librecms.CmsConstants;
|
||||
|
|
@ -62,6 +61,7 @@ import java.util.List;
|
|||
import java.util.Optional;
|
||||
import java.util.TooManyListenersException;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
|
|
@ -69,19 +69,27 @@ import java.util.TooManyListenersException;
|
|||
public class PagesAdminPage extends CMSApplicationPage {
|
||||
|
||||
private static final String INDEX_PAGE_MODEL_SELECT = "indexPageModelSelect";
|
||||
|
||||
private static final String ITEM_PAGE_MODEL_SELECT = "itemPageModelSelect";
|
||||
|
||||
private static final String INHERIT_PAGEMODEL = "--inherit--";
|
||||
|
||||
private final ParameterSingleSelectionModel<String> selectedCategory;
|
||||
|
||||
private final Tree categoryTree;
|
||||
|
||||
private final Label nothingSelectedLabel;
|
||||
|
||||
private final Form pageModelForm;
|
||||
|
||||
private final SingleSelect indexPageModelSelect;
|
||||
|
||||
private final SingleSelect itemPageModelSelect;
|
||||
|
||||
private final SaveCancelSection saveCancelSection;
|
||||
|
||||
private Pages pagesInstance;
|
||||
|
||||
private PagesContextBar pagesContextBar;
|
||||
|
||||
public PagesAdminPage() {
|
||||
|
|
@ -261,22 +269,38 @@ public class PagesAdminPage extends CMSApplicationPage {
|
|||
"cms.ui.pages.assigned_page_model.inherit",
|
||||
CmsConstants.CMS_BUNDLE))));
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final PageModelRepository pageModelRepo = cdiUtil
|
||||
.findBean(PageModelRepository.class);
|
||||
final List<PageModel> pageModels = pageModelRepo
|
||||
.findDraftByApplication(pagesInstance);
|
||||
final GlobalizationHelper globalizationHelper = cdiUtil
|
||||
.findBean(GlobalizationHelper.class);
|
||||
|
||||
for (final PageModel pageModel : pageModels) {
|
||||
target.addOption(new Option(
|
||||
// final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
// final PageModelRepository pageModelRepo = cdiUtil.findBean(
|
||||
// PageModelRepository.class
|
||||
// );
|
||||
// final List<PageModel> pageModels = pageModelRepo
|
||||
// .findDraftByApplication(pagesInstance);
|
||||
// final GlobalizationHelper globalizationHelper = cdiUtil
|
||||
// .findBean(GlobalizationHelper.class);
|
||||
// for (final PageModel pageModel : pageModels) {
|
||||
// target.addOption(
|
||||
// new Option(
|
||||
// Long.toString(pageModel.getPageModelId()),
|
||||
// new Text(
|
||||
// globalizationHelper.getValueFromLocalizedString(
|
||||
// pageModel.getTitle()
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
final PageModelAdminPageController controller = CdiUtil.createCdiUtil()
|
||||
.findBean(PageModelAdminPageController.class);
|
||||
final List<PageModelData> pageModels = controller
|
||||
.findDraftPageModelsByApplication(pagesInstance);
|
||||
for (final PageModelData pageModel : pageModels) {
|
||||
target.addOption(
|
||||
new Option(
|
||||
Long.toString(pageModel.getPageModelId()),
|
||||
new Text(globalizationHelper.getValueFromLocalizedString(
|
||||
pageModel
|
||||
.getTitle()))));
|
||||
new Text(pageModel.getTitle())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void categoryTreeStateChanged(final ChangeEvent event) {
|
||||
|
|
|
|||
|
|
@ -35,16 +35,12 @@ import com.arsdigita.cms.ui.BaseItemPane;
|
|||
import com.arsdigita.cms.ui.PartySearchForm;
|
||||
import com.arsdigita.cms.ui.VisibilityComponent;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.toolbox.ui.ActionGroup;
|
||||
import com.arsdigita.toolbox.ui.Property;
|
||||
import com.arsdigita.toolbox.ui.PropertyList;
|
||||
import com.arsdigita.toolbox.ui.Section;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
import org.libreccm.security.Party;
|
||||
import org.libreccm.security.PartyRepository;
|
||||
import org.libreccm.security.PermissionChecker;
|
||||
|
|
@ -129,40 +125,53 @@ class BaseRoleItemPane extends BaseItemPane {
|
|||
|
||||
@Override
|
||||
protected final java.util.List<Property> properties(
|
||||
final PageState state) {
|
||||
final PageState state
|
||||
) {
|
||||
|
||||
final java.util.List<Property> properties = super.properties(
|
||||
state);
|
||||
state
|
||||
);
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final ConfigurationManager manager = cdiUtil.findBean(
|
||||
ConfigurationManager.class);
|
||||
final KernelConfig config = manager.findConfiguration(
|
||||
KernelConfig.class);
|
||||
final RoleAdminPaneController controller = cdiUtil
|
||||
.findBean(RoleAdminPaneController.class);
|
||||
|
||||
final Role role = roleRequestLocal.getRole(state);
|
||||
|
||||
properties.add(new Property(lz("cms.ui.role.name"),
|
||||
role.getName()));
|
||||
// Right now just loads the default locale description.
|
||||
properties.add(new Property(
|
||||
lz("cms.ui.role.description"),
|
||||
role.getDescription().getValue(config.getDefaultLocale())));
|
||||
properties.add(
|
||||
new Property(lz("cms.ui.role.name"), role.getName())
|
||||
);
|
||||
|
||||
// Since Permissions don't seem to have a "pretty" form, the granted privilege is used.
|
||||
final RoleAdminPaneController controller = cdiUtil.findBean(
|
||||
RoleAdminPaneController.class);
|
||||
// Right now just loads the default locale description.
|
||||
properties.add(
|
||||
new Property(
|
||||
lz("cms.ui.role.description"),
|
||||
controller.getRoleDescription(role)
|
||||
)
|
||||
);
|
||||
|
||||
// Since Permissions don't seem to have a "pretty" form, the
|
||||
// granted privilege is used.
|
||||
final String permissions = controller
|
||||
.generateGrantedPermissionsString(
|
||||
role,
|
||||
CMS.getContext().getContentSection());
|
||||
CMS.getContext().getContentSection()
|
||||
);
|
||||
|
||||
if (permissions.length() > 0) {
|
||||
properties.add(new Property(lz("cms.ui.role.privileges"),
|
||||
permissions));
|
||||
properties.add(
|
||||
new Property(
|
||||
lz("cms.ui.role.privileges"),
|
||||
permissions
|
||||
)
|
||||
);
|
||||
} else {
|
||||
properties.add(new Property(lz("cms.ui.role.privileges"),
|
||||
lz("cms.ui.role.privilege.none")));
|
||||
properties.add(
|
||||
new Property(
|
||||
lz("cms.ui.role.privileges"),
|
||||
lz("cms.ui.role.privilege.none")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return properties;
|
||||
|
|
@ -192,7 +201,9 @@ class BaseRoleItemPane extends BaseItemPane {
|
|||
private class MemberTable extends Table {
|
||||
|
||||
private static final int COL_NAME = 0;
|
||||
|
||||
private static final int COL_EMAIL = 1;
|
||||
|
||||
private static final int COL_REMOVE = 2;
|
||||
|
||||
MemberTable() {
|
||||
|
|
|
|||
|
|
@ -88,6 +88,22 @@ class RoleAdminPaneController {
|
|||
return new ArrayList<>(contentSection.getRoles());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public String getRoleDescription(final Role ofRole) {
|
||||
final Role role = roleRepo
|
||||
.findById(ofRole.getRoleId())
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No role with ID %d found.", ofRole.getRoleId()
|
||||
)
|
||||
)
|
||||
);
|
||||
final KernelConfig config = confManager
|
||||
.findConfiguration(KernelConfig.class);
|
||||
return role.getDescription().getValue(config.getDefaultLocale());
|
||||
}
|
||||
|
||||
public String[] getGrantedPrivileges(final Role role,
|
||||
final ContentSection section) {
|
||||
final List<Permission> sectionPermissions = permissionManager
|
||||
|
|
@ -217,10 +233,10 @@ class RoleAdminPaneController {
|
|||
KernelConfig.class);
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
|
||||
role.setName(roleName);
|
||||
role.getDescription().addValue(defaultLocale, roleDescription);
|
||||
roleToSave.setName(roleName);
|
||||
roleToSave.getDescription().addValue(defaultLocale, roleDescription);
|
||||
|
||||
roleRepo.save(role);
|
||||
roleRepo.save(roleToSave);
|
||||
|
||||
final ContentSection contentSection = sectionRepo.findById(
|
||||
CMS.getContext().getContentSection().getObjectId())
|
||||
|
|
@ -241,28 +257,28 @@ class RoleAdminPaneController {
|
|||
final Folder rootAssetsFolder = contentSection.getRootAssetsFolder();
|
||||
|
||||
final List<Permission> currentPermissionsSection = permissionManager
|
||||
.findPermissionsForRoleAndObject(role, contentSection);
|
||||
.findPermissionsForRoleAndObject(roleToSave, contentSection);
|
||||
final List<Permission> currentPermissionsDocuments = permissionManager
|
||||
.findPermissionsForRoleAndObject(role, rootDocumentsFolder);
|
||||
.findPermissionsForRoleAndObject(roleToSave, rootDocumentsFolder);
|
||||
final List<Permission> currentPermissionsAssets = permissionManager
|
||||
.findPermissionsForRoleAndObject(role, rootAssetsFolder);
|
||||
.findPermissionsForRoleAndObject(roleToSave, rootAssetsFolder);
|
||||
|
||||
//Revoke permissions not in selectedPermissions
|
||||
revokeNotSelectedPrivileges(selectedPermissions,
|
||||
role,
|
||||
roleToSave,
|
||||
currentPermissionsSection);
|
||||
revokeNotSelectedPrivileges(selectedPermissions,
|
||||
role,
|
||||
roleToSave,
|
||||
currentPermissionsDocuments);
|
||||
revokeNotSelectedPrivileges(selectedPermissions,
|
||||
role,
|
||||
roleToSave,
|
||||
currentPermissionsAssets);
|
||||
|
||||
// Grant selected privileges
|
||||
for (final String privilege : adminPrivileges) {
|
||||
if (isPrivilegeSelected(selectedPermissions, privilege)) {
|
||||
permissionManager.grantPrivilege(privilege,
|
||||
role,
|
||||
roleToSave,
|
||||
contentSection);
|
||||
}
|
||||
}
|
||||
|
|
@ -270,7 +286,7 @@ class RoleAdminPaneController {
|
|||
for (final String privilege : itemPrivileges) {
|
||||
if (isPrivilegeSelected(selectedPermissions, privilege)) {
|
||||
permissionManager.grantPrivilege(privilege,
|
||||
role,
|
||||
roleToSave,
|
||||
rootDocumentsFolder);
|
||||
}
|
||||
}
|
||||
|
|
@ -278,7 +294,7 @@ class RoleAdminPaneController {
|
|||
for (final String privilege : assetPrivileges) {
|
||||
if (isPrivilegeSelected(selectedPermissions, privilege)) {
|
||||
permissionManager.grantPrivilege(privilege,
|
||||
role,
|
||||
roleToSave,
|
||||
rootAssetsFolder);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,20 +24,10 @@ import com.arsdigita.bebop.event.FormInitListener;
|
|||
import com.arsdigita.bebop.event.FormProcessListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
import org.libreccm.l10n.LocalizedString;
|
||||
import org.libreccm.security.Permission;
|
||||
import org.libreccm.security.PermissionManager;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.security.RoleRepository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Represents a {@link com.arsdigita.bebop.Form Form} to edit
|
||||
|
|
@ -76,17 +66,15 @@ final class RoleEditForm extends BaseRoleForm {
|
|||
final PageState state = event.getPageState();
|
||||
final Role role = roleRequestLocal.getRole(state);
|
||||
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final RoleAdminPaneController controller = cdiUtil.findBean(
|
||||
RoleAdminPaneController.class);
|
||||
|
||||
getRoleName().setValue(state, role.getName());
|
||||
getRoleDescription().setValue(
|
||||
state,
|
||||
role.getDescription().getValue(defaultLocale));
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final RoleAdminPaneController controller = cdiUtil.findBean(
|
||||
RoleAdminPaneController.class);
|
||||
controller.getRoleDescription(role)
|
||||
);
|
||||
|
||||
final String[] permissions = controller.getGrantedPrivileges(
|
||||
role, CMS.getContext().getContentSection());
|
||||
|
|
|
|||
|
|
@ -18,10 +18,13 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui.type;
|
||||
|
||||
import com.ibm.icu.impl.IllegalIcuArgumentException;
|
||||
import org.libreccm.workflow.Workflow;
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
import org.librecms.contentsection.ContentSectionManager;
|
||||
import org.librecms.contentsection.ContentSectionRepository;
|
||||
import org.librecms.contentsection.ContentType;
|
||||
import org.librecms.contentsection.ContentTypeManager;
|
||||
import org.librecms.contentsection.ContentTypeRepository;
|
||||
import org.librecms.contenttypes.ContentTypeInfo;
|
||||
import org.librecms.contenttypes.ContentTypesManager;
|
||||
|
|
@ -39,11 +42,6 @@ import java.util.stream.Collectors;
|
|||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.TypedQuery;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import javax.persistence.criteria.Root;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
/**
|
||||
|
|
@ -63,9 +61,15 @@ class ContentTypeAdminPaneController {
|
|||
@Inject
|
||||
private ContentSectionRepository sectionRepo;
|
||||
|
||||
@Inject
|
||||
private ContentSectionManager sectionManager;
|
||||
|
||||
@Inject
|
||||
private ContentTypeRepository typeRepo;
|
||||
|
||||
@Inject
|
||||
private ContentTypeManager typeManager;
|
||||
|
||||
@Inject
|
||||
private ContentTypesManager typesManager;
|
||||
|
||||
|
|
@ -78,6 +82,27 @@ class ContentTypeAdminPaneController {
|
|||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
protected List<String> getContentItemClassesList(
|
||||
final ContentSection ofSection
|
||||
) {
|
||||
final ContentSection section = sectionRepo.findById(
|
||||
ofSection.getObjectId()
|
||||
)
|
||||
.orElseThrow(
|
||||
() -> new IllegalIcuArgumentException(
|
||||
String.format(
|
||||
"No ContentSection with ID %d found.",
|
||||
ofSection.getObjectId()
|
||||
)
|
||||
)
|
||||
);
|
||||
return section.getContentTypes()
|
||||
.stream()
|
||||
.map(type -> type.getContentItemClass())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private String[] generateListEntry(final ContentType type) {
|
||||
final String[] entry = new String[2];
|
||||
|
||||
|
|
@ -126,7 +151,8 @@ class ContentTypeAdminPaneController {
|
|||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected Optional<String> getLifecycleDefinitionLabel(final ContentType type,
|
||||
protected Optional<String> getLifecycleDefinitionLabel(
|
||||
final ContentType type,
|
||||
final Locale locale) {
|
||||
|
||||
final LifecycleDefinition lifecycleDefinition = getLifecycleDefinition(
|
||||
|
|
@ -193,4 +219,30 @@ class ContentTypeAdminPaneController {
|
|||
return new ArrayList<>(contentSection.getWorkflowTemplates());
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected void addContentTypeToContentSection(
|
||||
final String type, final ContentSection toSection
|
||||
) {
|
||||
Objects.requireNonNull(type);
|
||||
Objects.requireNonNull(toSection);
|
||||
|
||||
final ContentSection section = sectionRepo
|
||||
.findById(toSection.getObjectId())
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No ContentSection identified by ID %d found.",
|
||||
toSection.getObjectId()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
sectionManager.addContentTypeToSection(
|
||||
typeManager.classNameToClass(type),
|
||||
section,
|
||||
section.getLifecycleDefinitions().get(0),
|
||||
section.getWorkflowTemplates().get(0)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ public class SelectType extends CMSForm implements PrintListener,
|
|||
/**
|
||||
* Generate a checkbox list of all content type not associated with the
|
||||
* current content section
|
||||
* @param event
|
||||
*/
|
||||
@Override
|
||||
public void prepare(final PrintEvent event) {
|
||||
|
|
@ -111,18 +112,22 @@ public class SelectType extends CMSForm implements PrintListener,
|
|||
final ContentSection section = CMS.getContext().getContentSection();
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final ContentTypeAdminPaneController controller = cdiUtil
|
||||
.findBean(ContentTypeAdminPaneController.class);
|
||||
final ContentTypesManager typesManager = cdiUtil.findBean(
|
||||
ContentTypesManager.class);
|
||||
|
||||
final List<ContentTypeInfo> availableTypes = typesManager
|
||||
.getAvailableContentTypes();
|
||||
final List<String> assignedTypes = section.getContentTypes()
|
||||
.stream()
|
||||
.map(contentType -> contentType.getContentItemClass())
|
||||
.collect(Collectors.toList());
|
||||
final List<String> assignedTypes = controller
|
||||
.getContentItemClassesList(section);
|
||||
// = section.getContentTypes()
|
||||
// .stream()
|
||||
// .map(contentType -> contentType.getContentItemClass())
|
||||
// .collect(Collectors.toList());
|
||||
|
||||
final List<ContentTypeInfo> notAssignedTypes = availableTypes.stream()
|
||||
.filter(type -> assignedTypes.contains(type.getContentItemClass()
|
||||
.filter(type -> !assignedTypes.contains(type.getContentItemClass()
|
||||
.getName()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
|
@ -184,18 +189,21 @@ public class SelectType extends CMSForm implements PrintListener,
|
|||
final String[] types = (String[]) data.get(TYPES);
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final ContentTypeManager typeManager = cdiUtil.findBean(
|
||||
ContentTypeManager.class);
|
||||
final ContentSectionManager sectionManager = cdiUtil.findBean(
|
||||
ContentSectionManager.class);
|
||||
// final ContentTypeManager typeManager = cdiUtil.findBean(
|
||||
// ContentTypeManager.class);
|
||||
// final ContentSectionManager sectionManager = cdiUtil.findBean(
|
||||
// ContentSectionManager.class);
|
||||
final ContentTypeAdminPaneController controller = cdiUtil
|
||||
.findBean(ContentTypeAdminPaneController.class);
|
||||
|
||||
if (types != null) {
|
||||
for (String type : types) {
|
||||
sectionManager.addContentTypeToSection(
|
||||
typeManager.classNameToClass(type),
|
||||
section,
|
||||
section.getLifecycleDefinitions().get(0),
|
||||
section.getWorkflowTemplates().get(0));
|
||||
// sectionManager.addContentTypeToSection(
|
||||
// typeManager.classNameToClass(type),
|
||||
// section,
|
||||
// section.getLifecycleDefinitions().get(0),
|
||||
// section.getWorkflowTemplates().get(0));
|
||||
controller.addContentTypeToContentSection(type, section);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,22 +255,28 @@ abstract class BaseWorkflowItemPane extends BaseItemPane {
|
|||
= ((Optional<Workflow>) workflowRequestLocal
|
||||
.get(state)).get();
|
||||
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
// final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
// final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
|
||||
final WorkflowAdminPaneController controller = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(WorkflowAdminPaneController.class);
|
||||
|
||||
props.addAll(controller.getWorkflowProperties(workflow));
|
||||
// props.add(new Property(gz("cms.ui.workflow.name"),
|
||||
// workflow.getName()
|
||||
// .getValue(defaultLocale)));
|
||||
// props.add(new Property(
|
||||
// gz("cms.ui.workflow.description"),
|
||||
// workflow.getDescription().getValue(defaultLocale)));
|
||||
// if (workflow.getState() == null) {
|
||||
// props.add(new Property(gz("cms.ui.workflow.current_state"),
|
||||
// gz("cms.ui.workflow.current_state.none")));
|
||||
// } else {
|
||||
// props.add(new Property(gz("cms.ui.workflow.current_state"),
|
||||
// workflow.getState().toString()));
|
||||
// }
|
||||
|
||||
props.add(new Property(gz("cms.ui.workflow.name"),
|
||||
workflow.getName()
|
||||
.getValue(defaultLocale)));
|
||||
props.add(new Property(
|
||||
gz("cms.ui.workflow.description"),
|
||||
workflow.getDescription().getValue(defaultLocale)));
|
||||
if (workflow.getState() == null) {
|
||||
props.add(new Property(gz("cms.ui.workflow.current_state"),
|
||||
gz("cms.ui.workflow.current_state.none")));
|
||||
} else {
|
||||
props.add(new Property(gz("cms.ui.workflow.current_state"),
|
||||
workflow.getState().toString()));
|
||||
}
|
||||
return props;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui.workflow;
|
||||
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.toolbox.ui.Property;
|
||||
import com.arsdigita.util.GraphSet;
|
||||
import com.arsdigita.util.Graphs;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -36,6 +38,7 @@ import org.libreccm.workflow.TaskManager;
|
|||
import org.libreccm.workflow.TaskRepository;
|
||||
import org.libreccm.workflow.Workflow;
|
||||
import org.libreccm.workflow.WorkflowRepository;
|
||||
import org.librecms.CmsConstants;
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
import org.librecms.contentsection.ContentSectionManager;
|
||||
import org.librecms.contentsection.ContentSectionRepository;
|
||||
|
|
@ -102,6 +105,97 @@ public class WorkflowAdminPaneController {
|
|||
return new ArrayList<>(contentSection.getWorkflowTemplates());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<Map<String, String>> listWorkflowTemplates(
|
||||
final ContentSection section
|
||||
) {
|
||||
final List<Workflow> templates = retrieveWorkflows(section);
|
||||
return templates
|
||||
.stream()
|
||||
.map(this::buildWorkflowTemplateListItem)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Map<String, String> buildWorkflowTemplateListItem(
|
||||
final Workflow workflow
|
||||
) {
|
||||
final Map<String, String> item = new HashMap<>();
|
||||
item.put(
|
||||
WorkflowListModelBuilder.WORKFLOW_TEMPLATE_ID,
|
||||
Long.toString(workflow.getWorkflowId())
|
||||
);
|
||||
item.put(
|
||||
WorkflowListModelBuilder.WORKFLOW_TEMPLATE_NAME,
|
||||
workflow
|
||||
.getName()
|
||||
.getValue(KernelConfig.getConfig().getDefaultLocale()
|
||||
)
|
||||
);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<Property> getWorkflowProperties(final Workflow ofWorkflow) {
|
||||
final Workflow workflow = workflowRepo
|
||||
.findById(ofWorkflow.getWorkflowId())
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No Workflow with ID %d available.",
|
||||
ofWorkflow.getWorkflowId()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
final KernelConfig kernelConfig = confManager
|
||||
.findConfiguration(KernelConfig.class);
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
|
||||
final List<Property> properties = new ArrayList<>();
|
||||
properties.add(
|
||||
new Property(
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.workflow.name", CmsConstants.CMS_BUNDLE
|
||||
),
|
||||
workflow.getName().getValue(defaultLocale)
|
||||
)
|
||||
);
|
||||
properties.add(
|
||||
new Property(
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.workflow.description",
|
||||
CmsConstants.CMS_BUNDLE
|
||||
),
|
||||
workflow.getDescription().getValue(defaultLocale)
|
||||
)
|
||||
);
|
||||
if (workflow.getState() == null) {
|
||||
properties.add(
|
||||
new Property(
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.workflow.current_state",
|
||||
CmsConstants.CMS_BUNDLE
|
||||
),
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.workflow.current_state.none",
|
||||
CmsConstants.CMS_BUNDLE
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
properties.add(
|
||||
new Property(
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.workflow.current_state",
|
||||
CmsConstants.CMS_BUNDLE
|
||||
),
|
||||
workflow.getState().toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Workflow createWorkflow(final ContentSection section,
|
||||
final String name,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import org.libreccm.workflow.Workflow;
|
|||
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Builds a list of workflow templates registered to the current content
|
||||
|
|
@ -41,6 +42,11 @@ import java.util.Locale;
|
|||
*/
|
||||
class WorkflowListModelBuilder extends AbstractListModelBuilder {
|
||||
|
||||
protected static final String WORKFLOW_TEMPLATE_ID = "workflowTemplateId";
|
||||
|
||||
protected static final String WORKFLOW_TEMPLATE_NAME
|
||||
= "workflowTemplateName";
|
||||
|
||||
@Override
|
||||
public final ListModel makeModel(final List list, final PageState state) {
|
||||
return new Model();
|
||||
|
|
@ -48,8 +54,9 @@ class WorkflowListModelBuilder extends AbstractListModelBuilder {
|
|||
|
||||
private class Model implements ListModel {
|
||||
|
||||
private final Iterator<Workflow> templates;
|
||||
private Workflow currentTemplate;
|
||||
private final Iterator<Map<String, String>> templates;
|
||||
|
||||
private Map<String, String> currentTemplate;
|
||||
|
||||
public Model() {
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
|
|
@ -57,7 +64,7 @@ class WorkflowListModelBuilder extends AbstractListModelBuilder {
|
|||
WorkflowAdminPaneController.class);
|
||||
|
||||
templates = controller
|
||||
.retrieveWorkflows(CMS.getContext().getContentSection())
|
||||
.listWorkflowTemplates(CMS.getContext().getContentSection())
|
||||
.iterator();
|
||||
}
|
||||
|
||||
|
|
@ -73,14 +80,12 @@ class WorkflowListModelBuilder extends AbstractListModelBuilder {
|
|||
|
||||
@Override
|
||||
public Object getElement() {
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
return currentTemplate.getName().getValue(defaultLocale);
|
||||
return currentTemplate.get(WORKFLOW_TEMPLATE_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return Long.toString(currentTemplate.getWorkflowId());
|
||||
return currentTemplate.get(WORKFLOW_TEMPLATE_ID);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,150 @@
|
|||
package db.migrations.org.librecms.ccm_cms;
|
||||
|
||||
import org.flywaydb.core.api.migration.BaseJavaMigration;
|
||||
import org.flywaydb.core.api.migration.Context;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class V7_0_0_24__add_lifecycle_uuid extends BaseJavaMigration {
|
||||
|
||||
@Override
|
||||
public void migrate(final Context context) throws Exception {
|
||||
|
||||
final Connection connection = context.getConnection();
|
||||
|
||||
final List<Long> lifecycleIds = retrieveLifecycleIds(connection);
|
||||
final List<Long> definitionIds = retrieveDefinitionIds(
|
||||
connection
|
||||
);
|
||||
|
||||
addLifecycleUuidCol(connection);
|
||||
addDefinitionLifecycleCol(connection);
|
||||
|
||||
setLifecycleUuid(connection, lifecycleIds);
|
||||
setDefinitionUuid(connection, definitionIds);
|
||||
|
||||
addLifecycleUniqueConstraint(connection);
|
||||
addDefinitionUniqueConstraint(connection);
|
||||
|
||||
}
|
||||
|
||||
private List<Long> retrieveLifecycleIds(final Connection connection)
|
||||
throws Exception {
|
||||
final List<Long> result = new ArrayList<>();
|
||||
try (PreparedStatement stmt = connection
|
||||
.prepareStatement("select LIFECYCLE_ID from LIFECYCLES");
|
||||
ResultSet resultSet = stmt.executeQuery()) {
|
||||
|
||||
while (resultSet.next()) {
|
||||
result.add(resultSet.getLong("LIFECYCLE_ID"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<Long> retrieveDefinitionIds(final Connection connection)
|
||||
throws Exception {
|
||||
final List<Long> result = new ArrayList<>();
|
||||
try (PreparedStatement stmt = connection
|
||||
.prepareStatement(
|
||||
"select LIFECYCLE_DEFINITION_ID "
|
||||
+ "from LIFECYLE_DEFINITIONS"
|
||||
);
|
||||
ResultSet resultSet = stmt.executeQuery()) {
|
||||
|
||||
while (resultSet.next()) {
|
||||
result.add(resultSet.getLong("LIFECYCLE_ID"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void addLifecycleUuidCol(final Connection connection)
|
||||
throws Exception {
|
||||
try (PreparedStatement stmt = connection.prepareStatement(
|
||||
"alter table LIFECYCLES add column UUID varchar(255)"
|
||||
)) {
|
||||
stmt.execute();
|
||||
}
|
||||
}
|
||||
|
||||
private void addDefinitionLifecycleCol(final Connection connection)
|
||||
throws Exception {
|
||||
try (PreparedStatement stmt = connection.prepareStatement(
|
||||
"alter table lifecyle_definitions "
|
||||
+ "add column UUID varchar(255)"
|
||||
)) {
|
||||
stmt.execute();
|
||||
}
|
||||
}
|
||||
|
||||
private void setLifecycleUuid(
|
||||
final Connection connection, final List<Long> lifecycleIds
|
||||
) throws Exception {
|
||||
try (PreparedStatement stmt = connection.prepareStatement(
|
||||
"update LIFECYCLES set UUID = ? where LIFECYCLE_ID = ?"
|
||||
)) {
|
||||
for (final Long lifecycleId : lifecycleIds) {
|
||||
stmt.setString(1, UUID.randomUUID().toString());
|
||||
stmt.setLong(2, lifecycleId);
|
||||
stmt.executeUpdate();
|
||||
stmt.clearParameters();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setDefinitionUuid(
|
||||
final Connection connection, final List<Long> definitionIds
|
||||
) throws Exception {
|
||||
try (PreparedStatement stmt = connection.prepareStatement(
|
||||
"update LIFECYLE_DEFINITIONS set UUID = ? "
|
||||
+ "where LIFECYCLE_DEFINITION_ID = ?"
|
||||
)) {
|
||||
for (final Long lifecycleId : definitionIds) {
|
||||
stmt.setString(1, UUID.randomUUID().toString());
|
||||
stmt.setLong(2, lifecycleId);
|
||||
stmt.executeUpdate();
|
||||
stmt.clearParameters();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addLifecycleUniqueConstraint(
|
||||
final Connection connection
|
||||
) throws Exception {
|
||||
try (PreparedStatement stmt = connection.prepareStatement(
|
||||
"alter table LIFECYCLES "
|
||||
+ "add constraint UK_40o4njo54m8c4xlwq6ctnsimd "
|
||||
+ "unique (UUID)"
|
||||
)) {
|
||||
stmt.execute();
|
||||
}
|
||||
}
|
||||
|
||||
private void addDefinitionUniqueConstraint(
|
||||
final Connection connection
|
||||
) throws Exception {
|
||||
try (PreparedStatement stmt = connection.prepareStatement(
|
||||
"alter table LIFECYLE_DEFINITIONS "
|
||||
+ "add constraint UK_n6ki3s5im2k2nccpocuctqqe3 "
|
||||
+ "unique (UUID)"
|
||||
)) {
|
||||
stmt.execute();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 db.migrations.org.librecms.ccm_cms.h2;
|
||||
|
||||
import org.flywaydb.core.api.migration.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class V7_0_0_24__add_lifecycle_uuid
|
||||
extends db.migrations.org.librecms.ccm_cms.V7_0_0_24__add_lifecycle_uuid {
|
||||
|
||||
@Override
|
||||
public void migrate(final Context context) throws Exception {
|
||||
super.migrate(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 db.migrations.org.librecms.ccm_cms.pgsql;
|
||||
|
||||
import org.flywaydb.core.api.migration.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class V7_0_0_24__add_lifecycle_uuid
|
||||
extends db.migrations.org.librecms.ccm_cms.V7_0_0_24__add_lifecycle_uuid {
|
||||
|
||||
@Override
|
||||
public void migrate(final Context context) throws Exception {
|
||||
super.migrate(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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 org.librecms.contentsection;
|
||||
|
||||
import org.libreccm.categorization.Category;
|
||||
import org.libreccm.imexport.AbstractEntityImExporter;
|
||||
import org.libreccm.imexport.Exportable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
* @param <T>
|
||||
*/
|
||||
public abstract class AbstractContentItemImExporter<T extends ContentItem>
|
||||
extends AbstractEntityImExporter<T> {
|
||||
|
||||
@Inject
|
||||
private ContentItemRepository itemRepository;
|
||||
|
||||
@Override
|
||||
protected Set<Class<? extends Exportable>> getRequiredEntities() {
|
||||
|
||||
final Set<Class<? extends Exportable>> entities = new HashSet<>();
|
||||
entities.add(Category.class);
|
||||
entities.add(ContentSection.class);
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public void saveImportedEntity(final T entity) {
|
||||
itemRepository.save(entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.librecms.contentsection;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
|
|
@ -56,9 +58,12 @@ import org.hibernate.search.annotations.IndexedEmbedded;
|
|||
import javax.persistence.FetchType;
|
||||
|
||||
import org.hibernate.envers.NotAudited;
|
||||
import org.libreccm.imexport.Exportable;
|
||||
import org.librecms.contentsection.privileges.ItemPrivileges;
|
||||
|
||||
import javax.persistence.OrderBy;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -594,12 +599,13 @@ import javax.persistence.OrderBy;
|
|||
+ " )"
|
||||
)
|
||||
})
|
||||
public class ContentItem extends CcmObject implements Serializable {
|
||||
public class ContentItem extends CcmObject implements Serializable, Exportable {
|
||||
|
||||
private static final long serialVersionUID = 5897287630227129653L;
|
||||
|
||||
@Column(name = "ITEM_UUID", nullable = false)
|
||||
@Field
|
||||
@XmlElement(name = "item-uuid", namespace = CMS_XML_NS)
|
||||
private String itemUuid;
|
||||
|
||||
/**
|
||||
|
|
@ -619,6 +625,7 @@ public class ContentItem extends CcmObject implements Serializable {
|
|||
)
|
||||
)
|
||||
// @Field
|
||||
@XmlElement(name = "name", namespace = CMS_XML_NS)
|
||||
private LocalizedString name;
|
||||
|
||||
/**
|
||||
|
|
@ -628,6 +635,7 @@ public class ContentItem extends CcmObject implements Serializable {
|
|||
@JoinColumn(name = "CONTENT_TYPE_ID")
|
||||
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
|
||||
// @Field
|
||||
@XmlElement(name = "content-type", namespace = CMS_XML_NS)
|
||||
private ContentType contentType;
|
||||
|
||||
/**
|
||||
|
|
@ -644,6 +652,7 @@ public class ContentItem extends CcmObject implements Serializable {
|
|||
)
|
||||
)
|
||||
@IndexedEmbedded
|
||||
@XmlElement(name = "title", namespace = CMS_XML_NS)
|
||||
private LocalizedString title;
|
||||
|
||||
/**
|
||||
|
|
@ -658,6 +667,7 @@ public class ContentItem extends CcmObject implements Serializable {
|
|||
@JoinColumn(name = "OBJECT_ID")}
|
||||
))
|
||||
@IndexedEmbedded
|
||||
@XmlElement(name = "description", namespace = CMS_XML_NS)
|
||||
private LocalizedString description;
|
||||
|
||||
/**
|
||||
|
|
@ -666,6 +676,7 @@ public class ContentItem extends CcmObject implements Serializable {
|
|||
@Column(name = "VERSION")
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Field
|
||||
@XmlElement(name = "version", namespace = CMS_XML_NS)
|
||||
private ContentItemVersion version;
|
||||
|
||||
/**
|
||||
|
|
@ -673,6 +684,7 @@ public class ContentItem extends CcmObject implements Serializable {
|
|||
*/
|
||||
@Column(name = "LAUNCH_DATE")
|
||||
@Temporal(TemporalType.DATE)
|
||||
@XmlElement(name = "launch-date", namespace = CMS_XML_NS)
|
||||
private Date launchDate;
|
||||
|
||||
/**
|
||||
|
|
@ -684,16 +696,20 @@ public class ContentItem extends CcmObject implements Serializable {
|
|||
|
||||
@OneToMany(mappedBy = "item", fetch = FetchType.LAZY)
|
||||
@OrderBy("order ASC")
|
||||
@XmlElementWrapper(name = "attachments", namespace = CMS_XML_NS)
|
||||
@JsonIgnore
|
||||
private List<AttachmentList> attachments;
|
||||
|
||||
@OneToOne()
|
||||
@JoinColumn(name = "LIFECYCLE_ID")
|
||||
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
|
||||
@XmlElement(name = "lifecycle", namespace = CMS_XML_NS)
|
||||
private Lifecycle lifecycle;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "WORKFLOW_ID")
|
||||
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
|
||||
@XmlElement(name = "workflow", namespace = CMS_XML_NS)
|
||||
private Workflow workflow;
|
||||
|
||||
/**
|
||||
|
|
@ -706,6 +722,7 @@ public class ContentItem extends CcmObject implements Serializable {
|
|||
@Column(name = "CREATION_DATE")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@NotAudited
|
||||
@XmlElement(name = "creation-date", namespace = CMS_XML_NS)
|
||||
private Date creationDate;
|
||||
|
||||
/**
|
||||
|
|
@ -718,6 +735,7 @@ public class ContentItem extends CcmObject implements Serializable {
|
|||
@Column(name = "LAST_MODIFIED")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@NotAudited
|
||||
@XmlElement(name = "last-modified", namespace = CMS_XML_NS)
|
||||
private Date lastModified;
|
||||
|
||||
/**
|
||||
|
|
@ -732,6 +750,7 @@ public class ContentItem extends CcmObject implements Serializable {
|
|||
*/
|
||||
@Column(name = "CREATION_USER_NAME")
|
||||
@NotAudited
|
||||
@XmlElement(name = "creation-username", namespace = CMS_XML_NS)
|
||||
private String creationUserName;
|
||||
|
||||
/**
|
||||
|
|
@ -746,6 +765,7 @@ public class ContentItem extends CcmObject implements Serializable {
|
|||
*/
|
||||
@Column(name = "LAST_MODIFYING_USER_NAME")
|
||||
@NotAudited
|
||||
@XmlElement(name = "last-modifying-username", namespace = CMS_XML_NS)
|
||||
private String lastModifyingUserName;
|
||||
|
||||
public ContentItem() {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.librecms.contentsection;
|
||||
|
||||
import org.libreccm.imexport.Exportable;
|
||||
import org.libreccm.security.RecursivePermissions;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.web.CcmApplication;
|
||||
|
|
@ -116,7 +117,9 @@ import static org.librecms.CmsConstants.*;
|
|||
// creator = ContentSectionCreator.class,
|
||||
// servlet = ContentSectionServlet.class,
|
||||
// instanceForm = ApplicationInstanceForm.class)
|
||||
public class ContentSection extends CcmApplication implements Serializable {
|
||||
public class ContentSection
|
||||
extends CcmApplication
|
||||
implements Serializable, Exportable {
|
||||
|
||||
private static final long serialVersionUID = -671718122153931727L;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.librecms.contentsection;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
|
@ -26,6 +25,7 @@ import org.libreccm.core.UnexpectedErrorException;
|
|||
import org.libreccm.modules.InstallEvent;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.web.AbstractCcmApplicationSetup;
|
||||
import org.libreccm.workflow.Workflow;
|
||||
import org.librecms.CmsConstants;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -44,7 +44,7 @@ import org.librecms.dispatcher.MultilingualItemResolver;
|
|||
import java.util.Arrays;
|
||||
|
||||
import org.librecms.contentsection.privileges.TypePrivileges;
|
||||
import org.librecms.contenttypes.ContentTypeDescription;
|
||||
import org.librecms.lifecycle.LifecycleDefinition;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
|
@ -267,6 +267,22 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
|
|||
section.addRole(publisher);
|
||||
section.addRole(contentReader);
|
||||
|
||||
final LifecycleDefinition lifecycleDefinition = new LifecycleDefinition();
|
||||
lifecycleDefinition.setUuid(UUID.randomUUID().toString());
|
||||
lifecycleDefinition.getLabel().addValue(Locale.ENGLISH, "Standard");
|
||||
|
||||
final Workflow workflow = new Workflow();
|
||||
workflow.setUuid(UUID.randomUUID().toString());
|
||||
workflow.setAbstractWorkflow(true);
|
||||
workflow.getName().addValue(Locale.ENGLISH, "Standard");
|
||||
|
||||
section.addLifecycleDefinition(lifecycleDefinition);
|
||||
|
||||
section.addWorkflowTemplate(workflow);
|
||||
|
||||
getEntityManager().persist(lifecycleDefinition);
|
||||
getEntityManager().persist(workflow);
|
||||
|
||||
LOGGER.debug("Setting ItemResolver for content section '{}'...",
|
||||
sectionName);
|
||||
final String itemResolverClassName;
|
||||
|
|
@ -345,7 +361,7 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
|
|||
}
|
||||
|
||||
if (ContentItem.class.isAssignableFrom(clazz)) {
|
||||
LOGGER.warn("'{}' is not is assignable from '{}'!",
|
||||
LOGGER.warn("'{}' is assignable from '{}'!",
|
||||
ContentItem.class.getName(),
|
||||
clazz.getName());
|
||||
final ContentType type = new ContentType();
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ import static org.librecms.CmsConstants.*;
|
|||
|
||||
import org.librecms.contentsection.ContentItem;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:konerman@tzi.de">Alexander Konermann</a>
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
|
|
@ -69,6 +71,7 @@ import org.librecms.contentsection.ContentItem;
|
|||
order = 2
|
||||
)
|
||||
})
|
||||
@XmlRootElement(name = "article", namespace = CMS_XML_NS)
|
||||
public class Article extends ContentItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3832010184748095822L;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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 org.librecms.contenttypes;
|
||||
|
||||
import org.libreccm.imexport.Processes;
|
||||
import org.librecms.contentsection.AbstractContentItemImExporter;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Processes(Article.class)
|
||||
public class ArticleImExporter extends AbstractContentItemImExporter<Article> {
|
||||
|
||||
@Override
|
||||
protected Class<Article> getEntityClass() {
|
||||
return Article.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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 org.librecms.contenttypes;
|
||||
|
||||
import org.libreccm.imexport.Processes;
|
||||
import org.librecms.contentsection.AbstractContentItemImExporter;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Processes(Event.class)
|
||||
public class EventImExporter extends AbstractContentItemImExporter<Event> {
|
||||
|
||||
@Override
|
||||
protected Class<Event> getEntityClass() {
|
||||
return Event.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* 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 org.librecms.contenttypes;
|
||||
|
||||
import org.libreccm.imexport.Processes;
|
||||
import org.librecms.contentsection.AbstractContentItemImExporter;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Processes(MultiPartArticle.class)
|
||||
public class MultiPartArticleImExporter
|
||||
extends AbstractContentItemImExporter<MultiPartArticle> {
|
||||
|
||||
@Override
|
||||
protected Class<MultiPartArticle> getEntityClass() {
|
||||
return MultiPartArticle.class;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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 org.librecms.contenttypes;
|
||||
|
||||
import org.libreccm.imexport.Processes;
|
||||
import org.librecms.contentsection.AbstractContentItemImExporter;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Processes(News.class)
|
||||
public class NewsImExporter extends AbstractContentItemImExporter<News> {
|
||||
|
||||
@Override
|
||||
protected Class<News> getEntityClass() {
|
||||
return News.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
package org.librecms.lifecycle;
|
||||
|
||||
import org.hibernate.search.annotations.Field;
|
||||
import org.libreccm.core.Identifiable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
|
@ -36,6 +39,8 @@ import javax.persistence.OneToOne;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
|
|
@ -45,7 +50,7 @@ import static org.librecms.CmsConstants.*;
|
|||
*/
|
||||
@Entity
|
||||
@Table(name = "LIFECYCLES", schema = DB_SCHEMA)
|
||||
public class Lifecycle implements Serializable {
|
||||
public class Lifecycle implements Identifiable, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 184357562249530038L;
|
||||
|
||||
|
|
@ -54,6 +59,15 @@ public class Lifecycle implements Serializable {
|
|||
@Column(name = "LIFECYCLE_ID")
|
||||
private long lifecycleId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Column(name = "UUID", unique = true)
|
||||
@NotNull
|
||||
@Field
|
||||
@XmlElement(name = "uuid")
|
||||
private String uuid;
|
||||
|
||||
@Column(name = "START_DATE_TIME")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date startDateTime;
|
||||
|
|
@ -90,6 +104,15 @@ public class Lifecycle implements Serializable {
|
|||
this.lifecycleId = lifecycleId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(final String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public Date getStartDateTime() {
|
||||
return new Date(startDateTime.getTime());
|
||||
}
|
||||
|
|
@ -232,4 +255,5 @@ public class Lifecycle implements Serializable {
|
|||
Objects.toString(definition),
|
||||
data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.librecms.lifecycle;
|
||||
|
||||
import org.hibernate.search.annotations.Field;
|
||||
import org.libreccm.core.Identifiable;
|
||||
import org.libreccm.l10n.LocalizedString;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -37,6 +39,8 @@ import javax.persistence.JoinColumn;
|
|||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
|
|
@ -46,7 +50,7 @@ import static org.librecms.CmsConstants.*;
|
|||
*/
|
||||
@Entity
|
||||
@Table(name = "LIFECYLE_DEFINITIONS", schema = DB_SCHEMA)
|
||||
public class LifecycleDefinition implements Serializable {
|
||||
public class LifecycleDefinition implements Identifiable, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1291162870555527717L;
|
||||
|
||||
|
|
@ -55,6 +59,12 @@ public class LifecycleDefinition implements Serializable {
|
|||
@Column(name = "LIFECYCLE_DEFINITION_ID")
|
||||
private long definitionId;
|
||||
|
||||
@Column(name = "UUID", unique = true)
|
||||
@NotNull
|
||||
@Field
|
||||
@XmlElement(name = "uuid")
|
||||
private String uuid;
|
||||
|
||||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
|
|
@ -96,6 +106,15 @@ public class LifecycleDefinition implements Serializable {
|
|||
this.definitionId = definitionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(final String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public LocalizedString getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ package org.librecms.lifecycle;
|
|||
|
||||
import org.libreccm.core.AbstractEntityRepository;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
||||
/**
|
||||
|
|
@ -52,4 +54,12 @@ public class LifecycleDefinitionRepository
|
|||
return lifecycleDefinition.getDefinitionId() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initNewEntity(final LifecycleDefinition entity) {
|
||||
super.initNewEntity(entity);
|
||||
entity.setUuid(UUID.randomUUID().toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ package org.librecms.lifecycle;
|
|||
|
||||
import org.libreccm.core.AbstractEntityRepository;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
||||
/**
|
||||
|
|
@ -30,6 +32,8 @@ import javax.enterprise.context.RequestScoped;
|
|||
public class LifecycleRepository
|
||||
extends AbstractEntityRepository<Long, Lifecycle> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Class<Lifecycle> getEntityClass() {
|
||||
return Lifecycle.class;
|
||||
|
|
@ -50,4 +54,10 @@ public class LifecycleRepository
|
|||
return lifecycle.getLifecycleId() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initNewEntity(final Lifecycle entity) {
|
||||
super.initNewEntity(entity);
|
||||
entity.setUuid(UUID.randomUUID().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,13 +72,13 @@ public class CategoryTreeComponentRenderer
|
|||
|
||||
if (!parameters.containsKey(PARAMETER_CATEGORY)) {
|
||||
throw new IllegalArgumentException(
|
||||
"The parameters map passed to this GreetingItem component does "
|
||||
"The parameters map passed to this CategoryTree component does "
|
||||
+ "not include the parameter \"category\"");
|
||||
}
|
||||
|
||||
if (!(parameters.get(PARAMETER_CATEGORY) instanceof Category)) {
|
||||
throw new IllegalArgumentException(String
|
||||
.format("The parameters map passed to this GreetingItem "
|
||||
.format("The parameters map passed to this CategoryTree "
|
||||
+ "component contains the parameter \"category\", but the "
|
||||
+ "parameter is not of type \"%s\" but of type \"%s\".",
|
||||
Category.class.getName(),
|
||||
|
|
@ -106,6 +106,8 @@ public class CategoryTreeComponentRenderer
|
|||
|
||||
final Category rootCategory = findRootCategory(category);
|
||||
|
||||
result.put("categoryId", Long.toString(rootCategory.getObjectId()));
|
||||
result.put("uuid", rootCategory.getUuid());
|
||||
result.put("categoryName", rootCategory.getName());
|
||||
result.put("categoryPath",
|
||||
categoryManager.getCategoryPath(rootCategory));
|
||||
|
|
@ -141,6 +143,8 @@ public class CategoryTreeComponentRenderer
|
|||
final Locale language) {
|
||||
|
||||
final Map<String, Object> result = new HashMap<>();
|
||||
result.put("categoryId", Long.toString(category.getObjectId()));
|
||||
result.put("uuid", category.getUuid());
|
||||
result.put("categoryName", category.getName());
|
||||
result.put("categoryPath", categoryManager.getCategoryPath(category));
|
||||
result.put("categoryTitle", category.getTitle().getValue(language));
|
||||
|
|
@ -153,6 +157,8 @@ public class CategoryTreeComponentRenderer
|
|||
final Locale language) {
|
||||
|
||||
final Map<String, Object> result = new HashMap<>();
|
||||
result.put("categoryId", Long.toString(category.getObjectId()));
|
||||
result.put("uuid", category.getUuid());
|
||||
result.put("categoryName", category.getName());
|
||||
result.put("categoryPath", categoryManager.getCategoryPath(category));
|
||||
result.put("categoryTitle", category.getTitle().getValue(language));
|
||||
|
|
|
|||
|
|
@ -80,12 +80,24 @@ public class GreetingItemComponentRenderer
|
|||
parameters.get(PARAMETER_CATEGORY).getClass().getName()));
|
||||
}
|
||||
|
||||
final Category category = categoryRepo
|
||||
.findById(((CcmObject) parameters.get(PARAMETER_CATEGORY))
|
||||
.getObjectId())
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||
final Optional<Category> catResult = categoryRepo.findById(
|
||||
((CcmObject) parameters.get(PARAMETER_CATEGORY)).getObjectId()
|
||||
);
|
||||
final Category category = catResult.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No category with ID %d in the database.",
|
||||
((CcmObject) parameters.get(PARAMETER_CATEGORY)).getObjectId())));
|
||||
((CcmObject) parameters.get(PARAMETER_CATEGORY))
|
||||
.getObjectId()
|
||||
)
|
||||
)
|
||||
);
|
||||
// final Category category = categoryRepo
|
||||
// .findById(((CcmObject) parameters.get(PARAMETER_CATEGORY))
|
||||
// .getObjectId())
|
||||
// .orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||
// "No category with ID %d in the database.",
|
||||
// ((CcmObject) parameters.get(PARAMETER_CATEGORY)).getObjectId())));
|
||||
|
||||
final Optional<CcmObject> indexObj = categoryManager
|
||||
.getIndexObject(category)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.librecms.pages;
|
||||
|
||||
import org.libreccm.categorization.Category;
|
||||
import org.libreccm.pagemodel.AbstractPageRenderer;
|
||||
import org.libreccm.pagemodel.PageRenderer;
|
||||
|
||||
|
|
@ -38,11 +39,20 @@ public class CmsPageRenderer extends AbstractPageRenderer {
|
|||
public Map<String, Object> renderPage(final Map<String, Object> parameters) {
|
||||
|
||||
final Map<String, Object> result = new HashMap<>();
|
||||
result.put("application", Pages.class.getName());
|
||||
if (parameters.containsKey(PagesRouter.SITE_INFO)) {
|
||||
result.put(
|
||||
PagesRouter.SITE_INFO, parameters.get(PagesRouter.SITE_INFO)
|
||||
);
|
||||
}
|
||||
|
||||
if (parameters.containsKey(PagesRouter.PAGE_PATH)) {
|
||||
result.put(
|
||||
PagesRouter.PAGE_PATH, parameters.get(PagesRouter.PAGE_PATH)
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
|||
import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import org.libreccm.categorization.Category;
|
||||
import org.libreccm.categorization.CategoryManager;
|
||||
import org.libreccm.categorization.CategoryRepository;
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
|
|
@ -43,10 +44,12 @@ import java.net.URI;
|
|||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
|
@ -75,6 +78,29 @@ import static org.librecms.pages.PagesConstants.*;
|
|||
@Path("/")
|
||||
public class PagesRouter {
|
||||
|
||||
protected static final String PAGE_PATH = "pagePath";
|
||||
|
||||
protected static final String PAGE_PATH_CATEGORY_ID = "categoryId";
|
||||
|
||||
protected static final String PAGE_PATH_CATEGORY_NAME = "categoryName";
|
||||
|
||||
protected static final String PAGE_PATH_CATEGORY_TITLE = "categoryTitle";
|
||||
|
||||
protected static final String PAGE_PATH_CATEGORY_UUID = "uuid";
|
||||
|
||||
protected static final String SITE_INFO = "siteInfo";
|
||||
|
||||
protected static final String SITE_INFO_NAME = "name";
|
||||
|
||||
protected static final String SITE_INFO_DOMAIN = "domain";
|
||||
|
||||
protected static final String SITE_INFO_HOST = "host";
|
||||
|
||||
protected static final String SITE_INFO_LANGS = "supportedLanguages";
|
||||
|
||||
@Inject
|
||||
private CategoryManager categoryManager;
|
||||
|
||||
@Inject
|
||||
private CategoryRepository categoryRepo;
|
||||
|
||||
|
|
@ -306,7 +332,7 @@ public class PagesRouter {
|
|||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/{page:[\\w/]+}/{name:[\\w\\-]+}")
|
||||
@Path("/{page:[\\w\\-/]+}/{name:[\\w\\-]+}")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Response getPage(
|
||||
@Context final UriInfo uriInfo,
|
||||
|
|
@ -346,7 +372,7 @@ public class PagesRouter {
|
|||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/{page:[\\w/]+}/{name:[\\w\\-]+}.html")
|
||||
@Path("/{page:[\\w\\-/]+}/{name:[\\w\\-]+}.html")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Response getPageAsHtml(
|
||||
@Context final UriInfo uriInfo,
|
||||
|
|
@ -388,7 +414,7 @@ public class PagesRouter {
|
|||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/{page:[\\w/]+}/{name:[\\w\\-]+}.{lang:\\w+}.html")
|
||||
@Path("/{page:[\\w\\-/]+}/{name:[\\w\\-]+}.{lang:\\w+}.html")
|
||||
@Produces("text/html")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getPageAsHtml(
|
||||
|
|
@ -443,7 +469,7 @@ public class PagesRouter {
|
|||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/{page:[\\w/]+}/{name:[\\w\\-]+}.{lang:\\w+}.json")
|
||||
@Path("/{page:[\\w\\-/]+}/{name:[\\w\\-]+}.{lang:\\w+}.json")
|
||||
@Produces("application/json")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getPageAsJson(
|
||||
|
|
@ -498,7 +524,7 @@ public class PagesRouter {
|
|||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/{page:[\\w/]+}/{name:[\\w\\-]+}.{lang:\\w+}.xml")
|
||||
@Path("/{page:[\\w\\-/]+}/{name:[\\w\\-]+}.{lang:\\w+}.xml")
|
||||
@Produces("text/xml")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getPageAsXml(
|
||||
|
|
@ -634,8 +660,22 @@ public class PagesRouter {
|
|||
Objects.requireNonNull(pagePath);
|
||||
Objects.requireNonNull(parameters);
|
||||
|
||||
final KernelConfig kernelConfig = confManager
|
||||
.findConfiguration(KernelConfig.class);
|
||||
|
||||
final String domain = uriInfo.getBaseUri().getHost();
|
||||
final Pages pages = getPages(domain);
|
||||
final Map<String, Object> siteInfo = new HashMap<>();
|
||||
siteInfo.put(SITE_INFO_HOST, uriInfo.getBaseUri().getHost());
|
||||
siteInfo.put(SITE_INFO_DOMAIN, pages.getSite().getDomainOfSite());
|
||||
siteInfo.put(SITE_INFO_NAME, pages.getSite().getDisplayName());
|
||||
siteInfo.put(
|
||||
SITE_INFO_LANGS,
|
||||
kernelConfig.getSupportedLanguages().stream().sorted().collect(
|
||||
Collectors.toList()
|
||||
)
|
||||
);
|
||||
parameters.put(SITE_INFO, siteInfo);
|
||||
final Category category = getCategory(domain, pages, pagePath);
|
||||
|
||||
final Locale locale = new Locale(language);
|
||||
|
|
@ -648,6 +688,7 @@ public class PagesRouter {
|
|||
|
||||
globalizationHelper.setSelectedLocale(locale);
|
||||
|
||||
parameters.put(PAGE_PATH, buildPageCategoriesPath(category, locale));
|
||||
parameters.put(PARAMETER_CATEGORY, category);
|
||||
return pageManager.findPageForCategory(category);
|
||||
}
|
||||
|
|
@ -729,6 +770,32 @@ public class PagesRouter {
|
|||
return buildPage(pageModel, parameters);
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> buildPageCategoriesPath(
|
||||
final Category category, Locale language
|
||||
) {
|
||||
final List<Category> categoriesInPath = categoryManager
|
||||
.getCategoriesInPath(category);
|
||||
return categoriesInPath
|
||||
.stream()
|
||||
.map(cat -> buildPathCategoriesPathEntry(category, language))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Map<String, Object> buildPathCategoriesPathEntry(
|
||||
final Category category, Locale language
|
||||
) {
|
||||
|
||||
final Map<String, Object> result = new HashMap<>();
|
||||
result.put(PAGE_PATH_CATEGORY_ID, Long.toString(category.getObjectId()));
|
||||
result.put(PAGE_PATH_CATEGORY_UUID, category.getUuid());
|
||||
result.put(PAGE_PATH_CATEGORY_NAME, category.getName());
|
||||
result.put(
|
||||
PAGE_PATH_CATEGORY_TITLE, category.getTitle().getValue(language)
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the value of the {@code preview} query parameter.
|
||||
*
|
||||
|
|
@ -794,10 +861,12 @@ public class PagesRouter {
|
|||
* Version of content to use
|
||||
*/
|
||||
private ContentItemVersion contentVersion;
|
||||
|
||||
/**
|
||||
* Version of {@link PageModel} to use.
|
||||
*/
|
||||
private PageModelVersion pageModelVersion;
|
||||
|
||||
/**
|
||||
* Version of theme to use.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ alter table CCM_CMS.PAGES
|
|||
add constraint FKmgmth087tmxwieujn2vs5opbo
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.CCM_OBJECTS;
|
||||
);
|
||||
|
||||
alter table CCM_CMS.PAGES_APP
|
||||
add constraint FK5swx0e8pj0mm5t1es0lj4nwlx
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
<#--filedoc
|
||||
Functions for processing file attachments.
|
||||
|
||||
@depcrecated Use ccm-cms/file-attachments.ftl
|
||||
-->
|
||||
|
||||
<#import "/ccm-cms/file-attachments" as FileAttachments>
|
||||
|
||||
<#--doc
|
||||
Gets the file attachements of an content item.
|
||||
|
||||
@param item The content item providing the file attachments.
|
||||
|
||||
@return A sequence of the file attachments
|
||||
-->
|
||||
<#function getFileAttachments item>
|
||||
<#return FileAttachments.getFileAttachments(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
*Internal* function for determing the type of a file attachment.
|
||||
|
||||
@param file The file attachment.
|
||||
|
||||
@return The type the file. Either `caption` or `file`.
|
||||
-->
|
||||
<#function _getFileType file>
|
||||
<#return FileAttachments._getFileType(file)>
|
||||
</#function>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<#--filedoc
|
||||
Provides functions for processing the image attachemnts of a content item.
|
||||
|
||||
@depcrecated Use ccm-cms/image-attachments.ftl instead
|
||||
-->
|
||||
|
||||
<#import "/ccm-cms/image-attachments.ftl" as ImageAttachments>
|
||||
|
||||
<#--doc
|
||||
Creates a sorted sequence of hashes (see Freemarker docuementation) for the
|
||||
image attachments of a content item.
|
||||
|
||||
@param item The model of the content item to use.
|
||||
|
||||
@return The images attached to the item.
|
||||
-->
|
||||
<#function getImageAttachments item>
|
||||
<#return ImageAttachments.getImageAttachments(item)>
|
||||
</#function>
|
||||
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<#--filedoc
|
||||
Functions for processing note attachments.
|
||||
|
||||
@depcrecated Use ccm-cms/sidenote-attachments instead
|
||||
-->
|
||||
|
||||
<#import "/ccm-cms/sidenote-attachments" as SideNotes>
|
||||
|
||||
<#--doc
|
||||
Generates a sorted sequence of hashes (see Freemarker documentation) for
|
||||
the note attachments of a content item.
|
||||
|
||||
@param item The model of the content item to use.
|
||||
|
||||
@return The side notes attached to the item.
|
||||
-->
|
||||
<#function getNotes item>
|
||||
<#return item.sideNotes>
|
||||
</#function>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<#--filedoc
|
||||
Functions for processing article items.
|
||||
|
||||
@depcrecated Use ccm-cms/article-item.ftl instea
|
||||
-->
|
||||
|
||||
<#import "/ccm-cms/article-item.ftl" as Article>
|
||||
|
||||
<#--doc
|
||||
Gets the lead text of the provided article.
|
||||
|
||||
@param item The article item to use.
|
||||
|
||||
@return The lead text of the article.
|
||||
-->
|
||||
<#function getLead item>
|
||||
<#return Article.getLead(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Checks if the provided item has a lead property.
|
||||
|
||||
@param item The article item to use.
|
||||
|
||||
@return `true` If the provided article has a lead text, `false` otherwise.
|
||||
-->
|
||||
<#function hasLead item>
|
||||
<#return Article.hasLead(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the main text the the provided article.
|
||||
|
||||
@param item The article item to use.
|
||||
|
||||
@return The main text of the article.
|
||||
-->
|
||||
<#function getMainText item>
|
||||
<#return Article.getMainText(item)>
|
||||
</#function>
|
||||
|
|
@ -0,0 +1,342 @@
|
|||
<#--filedoc
|
||||
Functions for processing Event items.
|
||||
|
||||
@depcrecated Use ccm-cms/event-item.ftl
|
||||
-->
|
||||
|
||||
<#import "/ccm-cms/event-item.ftl" as Event>
|
||||
|
||||
<#--doc
|
||||
Gets the lead text of an event item
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The lead text of the event item.
|
||||
-->
|
||||
|
||||
<#function getLead item>
|
||||
<#return Event.getLead(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the main text of an event item
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The main of the event item.
|
||||
-->
|
||||
<#function getMainText item>
|
||||
<#return Event.getMainText(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the end date of an event item
|
||||
|
||||
@param item The news event to use.
|
||||
|
||||
@return The date of the event item.
|
||||
-->
|
||||
<#function getEndDate item>
|
||||
<#return Event.getEndDate(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the year of the end date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The year of the end date of the event.
|
||||
-->
|
||||
<#function getEndDateYear item>
|
||||
<#return Event.getEndDateYear(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the month of the end date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The month of the end date of the event.
|
||||
-->
|
||||
<#function getEndDateMonth item>
|
||||
<#return Event.getEndDateMonth(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the day of the end date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The day of the end date of the event.
|
||||
-->
|
||||
<#function getEndDateDay item>
|
||||
<#return Event.getEndDateDay(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the short name of the day of the end date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The short name of the day of the end date of the event.
|
||||
-->
|
||||
<#function getEndDateDayNameShort item>
|
||||
<#return Event.getEndDateDayNameShort(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the end time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The end time of the event.
|
||||
-->
|
||||
<#function getEndTime item>
|
||||
<#return Event.getEndTime(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the hour of the end time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The hour of the end time of the event.
|
||||
-->
|
||||
<#function getEndTimeHour item>
|
||||
<#return Event.getEndTimeHour(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the minute of the end time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The minute of the end time of the event.
|
||||
-->
|
||||
<#function getEndTimeMinute item>
|
||||
<#return Event.getEndTimeMinute(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the second of the end time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The second of the end time of the event.
|
||||
-->
|
||||
<#function getEndTimeSecond item>
|
||||
<#return Event.getEndTimeSecond(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the start date of an event item
|
||||
|
||||
@param item The news event to use.
|
||||
|
||||
@return The start of the event item.
|
||||
-->
|
||||
<#function getStartDate item>
|
||||
<#return Event.getStartDate(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the year of the start date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The year of the start date of the event.
|
||||
-->
|
||||
<#function getStartDateYear item>
|
||||
<#return Event.getStartDateYear(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the month of the start date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The month of the start date of the event.
|
||||
-->
|
||||
<#function getStartDateMonth item>
|
||||
<#return Event.getStartDateMonth(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the day of the start date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The day of the start date of the event.
|
||||
-->
|
||||
<#function getStartDateDay item>
|
||||
<#return Event.getStartDateDay(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the short name of the day of the start date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The short name of the day of the start date of the event.
|
||||
-->
|
||||
<#function getStartDateDayNameShort item>
|
||||
<#return Event.getStartDateDayNameShort(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the start time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The start time of the event.
|
||||
-->
|
||||
<#function getStartTime item>
|
||||
<#return Event.getStartTime(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if the provided event item has a start time
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return `true` if the provided event item has a start time, `false` otherwise.
|
||||
-->
|
||||
<#function hasStartTime item>
|
||||
<#return Event.hasStartTime(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if the provided event item has a end time
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return `true` if the provided event item has a end time, `false` otherwise.
|
||||
-->
|
||||
<#function hasEndTime item>
|
||||
<#return Event.getEndTime(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if the provided event item has a start date.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return `true` if the provided event item has a start date, `false` otherwise.
|
||||
-->
|
||||
<#function hasStartDate item>
|
||||
<#return Event.hasStartDate(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if the provided event item has a end date.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return `true` if the provided event item has a end date, `false` otherwise.
|
||||
-->
|
||||
<#function hasEndDate item>
|
||||
<#return Event.getEndDate(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the hour of the start time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The hour of the start time of the event.
|
||||
-->
|
||||
<#function getstartTimeHour item>
|
||||
<#return Event.getstartTimeHour(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the minute of the start time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The minute of the start time of the event.
|
||||
-->
|
||||
<#function getstartTimeMinute item>
|
||||
<#return Event.getstartTimeMinute(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the second of the start time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The second of the start time of the event.
|
||||
-->
|
||||
<#function getstartTimeSecond item>
|
||||
<#return Event.getstartTimeSecond(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the location of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The value of the `location` property of the event.
|
||||
-->
|
||||
<#function getLocation(item)>
|
||||
<#return Event.getLocation(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the main contributor of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The value of the `mainContributor` property of the event.
|
||||
-->
|
||||
<#function getMainContributor item>
|
||||
<#return Event.getMainContributor(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the type of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The value of the `eventType` property of the event.
|
||||
-->
|
||||
<#function getEventType item>
|
||||
<#return Event.getEventType(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the cost of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The value of the `cost` property of the event.
|
||||
-->
|
||||
<#function getCost item>
|
||||
<#return Event.getCost(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the map link for the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The value of the `mapLink` property of the event.
|
||||
-->
|
||||
<#function getMapLink item>
|
||||
<#return Event.getMapLink(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the addendium of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The value of the `eventDate` property of the event.
|
||||
-->
|
||||
<#function getEventDateAddendum item>
|
||||
<#return Event.getEventDateAddendum(item)>
|
||||
</#function>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<#--filedoc
|
||||
Functions for creating the table of contents of a multi part article.
|
||||
|
||||
@depcrecated Use ccm-cms/multiparticle-item-toc.ftl
|
||||
-->
|
||||
|
||||
<#import "/ccm-cms/multiparticle-item-toc.ftl" as Toc>
|
||||
|
||||
<#--doc
|
||||
Gets the sections of a multi part article.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The sections of the multi part article.
|
||||
-->
|
||||
<#function getSections item>
|
||||
<#return Toc.getSections(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the title of a section.
|
||||
|
||||
@param section The model of the section as returned by `getSections`.
|
||||
|
||||
@return The title of the section.
|
||||
-->
|
||||
<#function getSectionTitle section>
|
||||
<#return Toc.getSectionTitle(section)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link for the section.
|
||||
|
||||
@param section The model of the section as returned by `getSections`.
|
||||
|
||||
@return The link for the section.
|
||||
-->
|
||||
<#function getSectionLink section>
|
||||
<#return Toc.getSectionLink(section)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines of the provided section is the active section.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@param section The model of the section as returned by `getSections`.
|
||||
|
||||
@return `true` if the provided section is the active section, `false` otherwise.
|
||||
-->
|
||||
<#function isActiveSection item section>
|
||||
<#return Toc.getActiveSection(item, section)>
|
||||
</#function>
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
<#--filedoc
|
||||
Functions for processing MultiPartArticles.
|
||||
|
||||
@depcrecated Use ccm-cms/multiparticle-item.ftl
|
||||
-->
|
||||
|
||||
<#import "/ccm-cms/multiparticle-item.ftl" as Mpa>
|
||||
|
||||
<#--doc
|
||||
Get the summary of a multi part article.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The summary of the multi part article.
|
||||
-->
|
||||
<#function getSummary item>
|
||||
<#return Map.getSummary(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the visible sections of a multi part article.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The visible sections of the multi part article.
|
||||
-->
|
||||
<#function getSections item>
|
||||
<#return Map.getSections(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the title of a section.
|
||||
|
||||
@param section The model of the section to use, as returned by `getSections`.
|
||||
|
||||
@return The title of the section.
|
||||
-->
|
||||
<#function getSectionTitle section>
|
||||
<#return Map.getSectionTitle(section)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the content of a section.
|
||||
|
||||
@param section The model of the section to use, as returned by `getSections`.
|
||||
|
||||
@return The content of the section.
|
||||
-->
|
||||
<#function getSectionContent section>
|
||||
<#return Map.getSectionContent(section)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the rank (sort key) of a section.
|
||||
|
||||
@param section The model of the section to use, as returned by `getSections`.
|
||||
|
||||
@return The rank of the section.
|
||||
-->
|
||||
<#function getSectionRank section>
|
||||
<#return Map.getSectionRank(section)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the number of the current page.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The number of the current page.
|
||||
-->
|
||||
<#function getPageNumber item>
|
||||
<#return Map.getPageNumber(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the number of the pages.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The number of the pages.
|
||||
-->
|
||||
<#function getNumberOfPages item>
|
||||
<#return Map.getNumberOfPages(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if a link to the previous page is available.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return `true` if the link is available, `false` otherwise.
|
||||
-->
|
||||
<#function hasPreviousPage item>
|
||||
<#return Mpa.hasPreviousPage(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if a link to the next page is available.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return `true` if the link is available, `false` otherwise.
|
||||
-->
|
||||
<#function hasNextPage item>
|
||||
<#return Map.hasNextPage(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines of the multi part article has multiple pages.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return `true` if the article has multiple pages, `false` otherwise.
|
||||
-->
|
||||
<#function hasMultiplePages item>
|
||||
<#return Map.hasMultiplePages(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the previous page.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The link to the previous page.
|
||||
-->
|
||||
<#function getLinkToPreviousPage item>
|
||||
<#return Map.getLinkToPreviousPage(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the next page.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The link to the next page.
|
||||
-->
|
||||
<#function getLinkToNextPage item>
|
||||
<#return Map.getLinkToNextPage(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link for showing all sections on one page..
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The link for showing all sections on one page.
|
||||
-->
|
||||
<#function getAllSectionsLink item>
|
||||
<#return Map.getAllSectionsLink(item)>
|
||||
</#function>
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<#--filedoc
|
||||
Functions for processing article items.
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Gets the lead text of the provided article.
|
||||
|
||||
@param item The article item to use.
|
||||
|
||||
@return The lead text of the article.
|
||||
-->
|
||||
<#function getLead item>
|
||||
<#return item.lead>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Checks if the provided item has a lead property.
|
||||
|
||||
@param item The article item to use.
|
||||
|
||||
@return `true` If the provided article has a lead text, `false` otherwise.
|
||||
-->
|
||||
<#function hasLead item>
|
||||
<#return (getLead(item)?length > 0)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the main text the the provided article.
|
||||
|
||||
@param item The article item to use.
|
||||
|
||||
@return The main text of the article.
|
||||
-->
|
||||
<#function getMainText item>
|
||||
<#return item.text>
|
||||
</#function>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<#--filedoc
|
||||
Functions for Bookmark items.
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Gets the description of a bookmark.
|
||||
|
||||
@param item The bookmark item to use.
|
||||
|
||||
@return The description of the provided bookmark.
|
||||
-->
|
||||
<#function getDescription item>
|
||||
<#return item.description>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link of a bookmark.
|
||||
|
||||
@param item The bookmark item to use.
|
||||
|
||||
@return The link of the provided bookmark.
|
||||
-->
|
||||
<#function getLink item>
|
||||
<#return item.link>
|
||||
</#function>
|
||||
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
<#--filedoc
|
||||
Functions for processing related links.
|
||||
|
||||
@depcrecated Use ccm-cms/relatedlink-attachments.ftl instead
|
||||
-->
|
||||
|
||||
<#import "/ccm-cms/relatedlink-attachments.ftl" as RelatedLinks>
|
||||
|
||||
<#--doc
|
||||
Generates a sorted sequence of hashes (see Freemarker documentation)
|
||||
from the related links of a content item.
|
||||
|
||||
@param item The model of the content item to use.
|
||||
|
||||
@param linkListName: The name of the link list to use.
|
||||
|
||||
@return The links attached to the provided item.
|
||||
-->
|
||||
<#function getRelatedLinks item linkListName="NONE">
|
||||
|
||||
<#return RelatedLinks.getRelatedLinks(item linkListName)>
|
||||
|
||||
<#-- <#return item["./links[./linkListName='${linkListName}']"]?sort_by("linkOrder")> -->
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
*Internal* function for determing the type a related link.
|
||||
|
||||
@param link The link
|
||||
|
||||
@return The type of the link. Either `externalLink`, `internalLink` or `caption`.
|
||||
-->
|
||||
<#function _getLinkType link>
|
||||
<#return RelatedLinks.:_getLinkType(link)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
*Internal* function for getting parameters for the link.
|
||||
|
||||
@param link The link
|
||||
|
||||
@return Parameters for an internal link.
|
||||
-->
|
||||
<#function _getInternalLinkParameters link>
|
||||
<#return RelatedLinks._getInternalLinkParameters(link)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
*Internal* function for constructing the target URI of a related link.
|
||||
|
||||
@param link The link model to use.
|
||||
|
||||
@return The URL for the target of the link.
|
||||
-->
|
||||
<#function _getTargetUri link>
|
||||
<#return RelatedLinks._getTargetUri(link)>
|
||||
</#function>
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<#--filedoc
|
||||
Functions for Bookmark items.
|
||||
-->
|
||||
|
||||
<#--filedoc
|
||||
Functions for Bookmark items.
|
||||
|
||||
@depcrecated Use ccm-cms/bookmark-item.ftl
|
||||
-->
|
||||
|
||||
<#import "ccm-cms/bookmark-item.ftl" as Bookmark>
|
||||
|
||||
<#--doc
|
||||
Gets the description of a bookmark.
|
||||
|
||||
@param item The bookmark item to use.
|
||||
|
||||
@return The description of the provided bookmark.
|
||||
-->
|
||||
<#function getDescription item>
|
||||
<#return Bookmark.getDescription(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link of a bookmark.
|
||||
|
||||
@param item The bookmark item to use.
|
||||
|
||||
@return The link of the provided bookmark.
|
||||
-->
|
||||
<#function getLink item>
|
||||
<#return Bookmark.getLink(item)>
|
||||
</#function>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
<#--filedoc
|
||||
This library provides functions and macros for processing the data of
|
||||
content items.
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Gets the current content item, or more exactly the model of the current
|
||||
content item from the model. This function only works on cms pages and
|
||||
not on navigation pages. For navigation pages use the functions
|
||||
provided by ccm-navigation for extracting the index item.
|
||||
|
||||
@return The model of the current content item.
|
||||
-->
|
||||
<#function getContentItem container="">
|
||||
<#if container == "">
|
||||
<#return contentItem>
|
||||
<#else>
|
||||
<#return [container].contentItem>
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Includes the template for the type of the provided content item
|
||||
for the provided view and style. The paramters view and style are
|
||||
optional. If not provided the default value "detail" is used for
|
||||
the view parameter.
|
||||
|
||||
@param item The data model of the content item itself. There are
|
||||
several functions for extracting this provided by other modules.
|
||||
|
||||
@param view View type to use. Either `detail` or `list`. Default
|
||||
value is `detail`.
|
||||
|
||||
@param style Style to use. Styles allow it to use different
|
||||
templates for `detail` or `list` views depending on the context were the
|
||||
content item is displayed.
|
||||
-->
|
||||
<#macro contentItem item view="detail" style="">
|
||||
|
||||
<#--<pre>
|
||||
item["/objectType"]: ${item["./objectType"]?size}
|
||||
item["/nav:attribute[@name='objectType']"]: ${item["./nav:attribute[@name='objectType']"]?size}
|
||||
</pre>-->
|
||||
|
||||
|
||||
<#if (item.contentType.name?length > 0)>
|
||||
<#include getContentItemTemplate(item.contentType.name, view, style)>
|
||||
<#else>
|
||||
<#include getContentItemTemplate("org.librecms.contentsection.ContentItem", view, style)>
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#--doc
|
||||
Retrieve the title of a content item.
|
||||
|
||||
@param item The content item.
|
||||
|
||||
@return The title of the content item.
|
||||
-->
|
||||
<#function getItemTitle item>
|
||||
<#return item.title>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the title of the current page. This function tries several possible
|
||||
sources for the title of the current page and uses to first source found.
|
||||
|
||||
The possible sources are:
|
||||
|
||||
* The title of the primary content item. For items of the types
|
||||
Glossary Item and FAQ Item special titles are used.
|
||||
* If the title `AtoZ` is provided by Bebop the localized text
|
||||
`layout.page.title.atoz` used.
|
||||
* If the title `Search` is provided by Bebop
|
||||
|
||||
@param useCategoryMenu The name of the category menu to use for retrieving
|
||||
the page title.
|
||||
|
||||
@param useRootIndexItemTitle Wether to use the title of the index item of
|
||||
the root category as page title.
|
||||
|
||||
@return The title of the current page.
|
||||
-->
|
||||
<#function getPageTitle useCategoryMenu='categoryMenu' useRootIndexItemTitle=false>
|
||||
|
||||
<#if contentItem??>
|
||||
<#return contentItem.title>
|
||||
<#elseif (application == 'login')>
|
||||
<#return getLocalizedText('layout.page.title.login')>
|
||||
<#elseif (application == 'sitemap'))>
|
||||
<#return getLocalizedText('layout.page.title.sitemap')>
|
||||
<#elseif (application == 'PublicPersonalProfile')>
|
||||
<#return model["/bebop:page/nav:greetingItem/cms:item/title"].@@text>
|
||||
<#else>
|
||||
<#return pageTitle>
|
||||
</#if>
|
||||
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Retrieves the summary/lead text of an content item. The function
|
||||
will check several possible sources.
|
||||
|
||||
@param item The item from which the the summary is read.
|
||||
|
||||
@return The value of the `summary` or `lead` property or the provided
|
||||
content item. If the content item does not have a such a property an
|
||||
empty string is returned.
|
||||
-->
|
||||
<#function getItemSummary item>
|
||||
<#if (item.lead??)>
|
||||
<#return item.lead>
|
||||
<#elseif (item.summary??)>
|
||||
<#return item.summary>
|
||||
<#else>
|
||||
<#return "">
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Retrieve the value the `pageDescription` property of a conten item.
|
||||
If the provided content item does not have a `pageDescription` property
|
||||
an empty string is returned.
|
||||
|
||||
@param item The content item from which the description is read.
|
||||
|
||||
@return The value of the `pageDescription` property of the provided content
|
||||
item. If the provided content item does not have such a property an
|
||||
empty string is returned.
|
||||
-->
|
||||
<#function getPageDescription item>
|
||||
<#if (item.pageDescription??)>
|
||||
<#return item.pageDescription>
|
||||
<#else>
|
||||
<#return "">
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Generated a link to a content using the OID of the content item.
|
||||
|
||||
@param oid The OID of the content.
|
||||
|
||||
@return A link to the content item identified by the provided OID.
|
||||
-->
|
||||
<#function generateContentItemLink oid>
|
||||
<#return "./${oid}">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Generates the the edit link for the provided content item. The link
|
||||
is generated using the `editLink` property which is only present in the
|
||||
model if the current user is permitted to edit the item.
|
||||
|
||||
@param item The item for which the edit link is generated.
|
||||
|
||||
@return An edit link for the item. If the provided item does not have an
|
||||
`editLink` property an empty string is returned.
|
||||
-->
|
||||
<#function getEditLink item>
|
||||
<#if (item.editLink??)>
|
||||
<#return item.editLink>
|
||||
<#else>
|
||||
<#return "">
|
||||
</#if>
|
||||
</#function>
|
||||
|
|
@ -0,0 +1,340 @@
|
|||
<#import "./article-item.ftl" as Article>
|
||||
|
||||
<#--filedoc
|
||||
Functions for processing Event items.
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Gets the lead text of an event item
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The lead text of the event item.
|
||||
-->
|
||||
|
||||
<#function getLead item>
|
||||
<#return Article.getLead(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the main text of an event item
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The main of the event item.
|
||||
-->
|
||||
<#function getMainText item>
|
||||
<#return Article.getMainText(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the end date of an event item
|
||||
|
||||
@param item The news event to use.
|
||||
|
||||
@return The date of the event item.
|
||||
-->
|
||||
<#function getEndDate item format="yyyy-MM-dd hh:mm">
|
||||
<#return item.endDate?string(format)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the year of the end date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The year of the end date of the event.
|
||||
-->
|
||||
<#function getEndDateYear item>
|
||||
<#return item.endDate?("YYYY")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the month of the end date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The month of the end date of the event.
|
||||
-->
|
||||
<#function getEndDateMonth item>
|
||||
<#return item.endDate?string("MM")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the day of the end date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The day of the end date of the event.
|
||||
-->
|
||||
<#function getEndDateDay item>
|
||||
<#return item.endDate?string("dd")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the short name of the day of the end date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The short name of the day of the end date of the event.
|
||||
-->
|
||||
<#function getEndDateDayNameShort item>
|
||||
<#return item.endDate?string("E")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the end time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The end time of the event.
|
||||
-->
|
||||
<#function getEndTime item format="hh:mm">
|
||||
<#return item.endDate?string(format)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the hour of the end time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The hour of the end time of the event.
|
||||
-->
|
||||
<#function getEndTimeHour item>
|
||||
<#return item.endDate?string("hh")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the minute of the end time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The minute of the end time of the event.
|
||||
-->
|
||||
<#function getEndTimeMinute item>
|
||||
<#return item.endDate?string("mm")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the second of the end time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The second of the end time of the event.
|
||||
-->
|
||||
<#function getEndTimeSecond item>
|
||||
<#return item.endDate?string("ss")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the start date of an event item
|
||||
|
||||
@param item The news event to use.
|
||||
|
||||
@return The start of the event item.
|
||||
-->
|
||||
<#function getStartDate item format="yyyy-MM-dd hh:mm:ss">
|
||||
<#return item.startDate?string(format)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the year of the start date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The year of the start date of the event.
|
||||
-->
|
||||
<#function getStartDateYear item>
|
||||
<#return item.startDate?string("yyyy")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the month of the start date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The month of the start date of the event.
|
||||
-->
|
||||
<#function getStartDateMonth item>
|
||||
<#return item.startDate?string("MM")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the day of the start date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The day of the start date of the event.
|
||||
-->
|
||||
<#function getStartDateDay item>
|
||||
<#return item.startDate?string("dd")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the short name of the day of the start date of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The short name of the day of the start date of the event.
|
||||
-->
|
||||
<#function getStartDateDayNameShort item>
|
||||
<#return item.startDate?string("E")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the start time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The start time of the event.
|
||||
-->
|
||||
<#function getStartTime item format="hh:mm">
|
||||
<#return item.startDate?string(format)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if the provided event item has a start time
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return `true` if the provided event item has a start time, `false` otherwise.
|
||||
-->
|
||||
<#function hasStartTime item>
|
||||
<#return item.startDate??>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if the provided event item has a end time
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return `true` if the provided event item has a end time, `false` otherwise.
|
||||
-->
|
||||
<#function hasEndTime item>
|
||||
<#return item.endDate??>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if the provided event item has a start date.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return `true` if the provided event item has a start date, `false` otherwise.
|
||||
-->
|
||||
<#function hasStartDate item>
|
||||
<#return item.startDate??>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if the provided event item has a end date.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return `true` if the provided event item has a end date, `false` otherwise.
|
||||
-->
|
||||
<#function hasEndDate item>
|
||||
<#return item.endDate??>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the hour of the start time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The hour of the start time of the event.
|
||||
-->
|
||||
<#function getStartTimeHour item>
|
||||
<#return item.startDate?string("hh")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the minute of the start time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The minute of the start time of the event.
|
||||
-->
|
||||
<#function getstartTimeMinute item>
|
||||
<#return item.startDate?string("mm")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the second of the start time of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The second of the start time of the event.
|
||||
-->
|
||||
<#function getstartTimeSecond item>
|
||||
<#return item.startTime?string("ss")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the location of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The value of the `location` property of the event.
|
||||
-->
|
||||
<#function getLocation(item)>
|
||||
<#return item.location>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the main contributor of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The value of the `mainContributor` property of the event.
|
||||
-->
|
||||
<#function getMainContributor item>
|
||||
<#return item.mainContributor>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the type of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The value of the `eventType` property of the event.
|
||||
-->
|
||||
<#function getEventType item>
|
||||
<#return item.eventType>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the cost of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The value of the `cost` property of the event.
|
||||
-->
|
||||
<#function getCost item>
|
||||
<#return item.cost]>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the map link for the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The value of the `mapLink` property of the event.
|
||||
-->
|
||||
<#function getMapLink item>
|
||||
<#return item.mapLink>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the addendium of the event.
|
||||
|
||||
@param item The event item to use.
|
||||
|
||||
@return The value of the `eventDate` property of the event.
|
||||
-->
|
||||
<#function getEventDateAddendum item>
|
||||
<#return item.eventDate>
|
||||
</#function>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<#--filedoc
|
||||
Functions for processing file attachments.
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Gets the file attachements of an content item.
|
||||
|
||||
@param item The content item providing the file attachments.
|
||||
|
||||
@return A sorted sequence of hashes (see Freemarker documentation) containing
|
||||
the data the file attachments. The following keys are available:
|
||||
|
||||
* `fileType`: Type of the attachments. Either `file` or `caption`
|
||||
* `mimeType`: The mime type of the file.
|
||||
* `mimeTypeLabel`: A human readable label for the mime type.
|
||||
* `fileSize`: The size of the file.
|
||||
* `fileExtension`: The extension part of the file name.
|
||||
* `fileId`: The ID of the file.
|
||||
* `fileName`: The name of the file.
|
||||
* `description`: The description of the file attachment.
|
||||
* `fileUrl`: The URL for downloading the file.
|
||||
* `fileOrder`: The value of the order property of the file attachment.
|
||||
-->
|
||||
|
||||
<#function getFileAttachments item>
|
||||
<#return item.fileAttachments>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
*Internal* function for determing the type of a file attachment.
|
||||
|
||||
@param file The file attachment.
|
||||
|
||||
@depcrecated without replacement.
|
||||
|
||||
@return The type the file. Starting with version 7.0.0 always `file`.
|
||||
-->
|
||||
<#function _getFileType file>
|
||||
<#return "file">
|
||||
</#function>
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<#--filedoc
|
||||
Provides functions for processing the image attachemnts of a content item.
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Creates a sorted sequence of hashes (see Freemarker docuementation) for the
|
||||
image attachments of a content item.
|
||||
|
||||
@param item The model of the content item to use.
|
||||
|
||||
@return The images attached to the provided item.
|
||||
-->
|
||||
<#function getImageAttachments item>
|
||||
<#return item.imageAttachments>
|
||||
</#function>
|
||||
|
||||
|
|
@ -0,0 +1,460 @@
|
|||
<#--filedoc
|
||||
Functions for accessing item lists and their properties.
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Retrieve the item (models) of an object list. This function can deal with
|
||||
several different types of object lists, including `SimpleObjectList`,
|
||||
`ComplexObjectList` and `CustomziableObjectList`.
|
||||
|
||||
@param listId The ID of the object list from the the items are retrieved.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@return The models for the entries in the object list. If no list with
|
||||
the provided `listId` is found and empty sequence is returned.
|
||||
-->
|
||||
<#function getItems listId containerId="container">
|
||||
<#return containerId?eval[listId].items>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the number of objects/items in an object list.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@return The number of objects in the list. If no list with the provided
|
||||
`listId` is found `0` is returned.
|
||||
-->
|
||||
<#function getObjectCount listId containerId="container">
|
||||
<#return getItems(listId, containerId)?size>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the base URL for the paginator of an object list.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@return The base URL for the the paginator.
|
||||
-->
|
||||
<#function getPaginatorBaseUrl listId containerId="container">
|
||||
<#return containerId?eval[listId].paginator.baseUrl
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the index of the first item shown on the current page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@return The index of the first item shown on the current page.
|
||||
-->
|
||||
<#function getPaginatorBegin listId containerId="container">
|
||||
<#return containerId?eval[listId].paginator.start>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the index of the last item shown on the curent page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@return The index of the last item shown on the current page.
|
||||
-->
|
||||
<#function getPaginatorEnd listId containerId="container">
|
||||
<#return containerId?eval[listId].paginator.end>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the number of pages of an object list.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@return The number of pages of the object list. If no list with the
|
||||
provided `listId` is found the function will return `0`.
|
||||
-->
|
||||
<#function getPageCount listId containerId="container">
|
||||
<#return containerId?eval[listId].paginator.pageCount
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the number of the current page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@return The number of the page currently shown.
|
||||
-->
|
||||
<#function getPageNumber listId containerId="container">
|
||||
<#return containerId?eval[listId].paginator.pageNumber>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the name of the page URL parameter.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@return The name of the page URL parameter.
|
||||
-->
|
||||
<#function getPageParam listId containerId="container">
|
||||
<#return containerId?eval[listId].paginator.pageParam>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the maximum number of items on a page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@return The maxium number of items on a page.
|
||||
-->
|
||||
<#function getPageSize listId containerId="container">
|
||||
<#return containerId?eval[listId].paginator.pageSize>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the previous page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@return The link to the previous page.
|
||||
-->
|
||||
<#function getPrevPageLink listId containerId="container">
|
||||
<#return containerId?eval[listId].paginator.prevPageLink>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the next page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@return The link to the next page.
|
||||
-->
|
||||
<#function getNextPageLink listId containerId="container">
|
||||
<#return containerId?eval[listId].paginator.nextPageLink>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the first page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@return The link to the first page.
|
||||
-->
|
||||
<#function getFirstPageLink listId containerId="container">
|
||||
<#return containerId?eval[listId].paginator.firstPageLink>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the last page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@return The link to the last page.
|
||||
-->
|
||||
<#function getLastPageLink listId containerId="container">
|
||||
<#return containerId?eval[listId].paginator.lastPageLink>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the title of an item from an object list.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
@param containerId The ID of the container of the list
|
||||
|
||||
@depcrecated Use the title property of the item directly
|
||||
|
||||
@return The title of the item.
|
||||
-->
|
||||
<#function getItemTitle item>
|
||||
<#return item.title>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the detail view of an item in a list.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return The link to the detail view of the item.
|
||||
-->
|
||||
<#function getItemLink item>
|
||||
<#return "./" + item.name>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Checks if the model of the list entry of an item contains a value for the
|
||||
`lead` property.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return `true` if the model provides a value of the `lead` property,
|
||||
`false` if not.
|
||||
-->
|
||||
<#function hasItemLead item>
|
||||
<#return item.lead??>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the value of the `lead` property of an item.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return The value of the `lead` property.
|
||||
-->
|
||||
<#function getItemLead item>
|
||||
<#return item.lead>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
A generic function for checking if the model of a list entry for an item
|
||||
has a specific property.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@param property The name of the property to check for.
|
||||
|
||||
@return `true` If the provided model provides an value for the property,
|
||||
`false` if not.
|
||||
-->
|
||||
<#function hasItemProperty item property>
|
||||
<#return false>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
A generic function for retrieving the value of an property from the model
|
||||
for a list entry for an item.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@param property The name of the property to retrieve.
|
||||
|
||||
@return The value of the property.
|
||||
-->
|
||||
<#function getItemProperty item property>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Checks if the provided item has an associated image.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return `true` if the item has an associated image, `false` if not.
|
||||
-->
|
||||
<#function hasImage item>
|
||||
<#return false>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the ID of an associated image.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return The ID of the associated image.
|
||||
-->
|
||||
<#function getImageId item>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Generates the URL for an associated image.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return The URL of the associated image.
|
||||
-->
|
||||
<#function getImageUrl item>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the caption for the associated image.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return The caption for the associated image.
|
||||
-->
|
||||
<#function getImageCaption item>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Retrieves the filters for an object list.
|
||||
|
||||
@param listId The ID of the list to use.
|
||||
|
||||
@return The filters for the list. An empty sequence is returned if no list
|
||||
with the provided `listId` could be found or if the list does not have any filters.
|
||||
-->
|
||||
<#function getFilters listId containerId="container">
|
||||
<#return []>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the label of a filter.
|
||||
|
||||
@param filter model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The label of the filter.
|
||||
-->
|
||||
<#function getFilterLabel filter>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the type of a filter.
|
||||
|
||||
@param filter model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The type of the filter.
|
||||
-->
|
||||
<#function getFilterType filter>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the options of a select filter.
|
||||
|
||||
@param filter model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The options of the select filter.
|
||||
-->
|
||||
<#function getSelectFilterOptions filter>
|
||||
<#return []>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the currently selected option of a select filter.
|
||||
|
||||
@param filter model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The currently selected option.
|
||||
-->
|
||||
<#function getSelectFilterSelection filter>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
The label for an option of a select filter.
|
||||
|
||||
@param filter model of an option as returned by `getSelectFilterOptions`.
|
||||
|
||||
@return The label of the option.
|
||||
-->
|
||||
<#function getSelectFilterOptionLabel option>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the search string of an category filter.
|
||||
|
||||
@param filter model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The search string.
|
||||
-->
|
||||
<#function getCategoryFilterSearchString filter>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the separator for a category filter.
|
||||
|
||||
@param filter The model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The separator for separating the categories in the search string.
|
||||
-->
|
||||
<#function getCategoryFilterSeparator filter>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if a category allows the selection of multiple categories.
|
||||
|
||||
@param filter The model of a filter as returned by `getFilters`.
|
||||
|
||||
@return `true` if the filter allows multiple selections, `false` otherwise.
|
||||
-->
|
||||
<#function getCategoryFilterMultiple filter>
|
||||
<#return false>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the selectable categories for a category filter.
|
||||
|
||||
@param filter The model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The selectable categories.
|
||||
-->
|
||||
<#function getCategoryFilterCategories filter>
|
||||
<#return []>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the groups of a category filter.
|
||||
|
||||
@param filter The model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The groups of a category filter.
|
||||
-->
|
||||
<#function getCategoryFilterCategoryGroups filter>
|
||||
<#return []>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the label of a category group.
|
||||
|
||||
@param group The model of a category group as returned by
|
||||
`getCategoryFilterCategoryGroups`.
|
||||
|
||||
@return The label for the group.
|
||||
-->
|
||||
<#function getCategoryGroupLabel group>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the categories in a group.
|
||||
|
||||
@param group The model of a category group as returned by
|
||||
`getCategoryFilterCategoryGroups`.
|
||||
|
||||
@return The categories in the group.
|
||||
-->
|
||||
<#function getCategoryFilterCategoryGroupsCategories groups>
|
||||
|
||||
<#return "">
|
||||
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the ID of a category of a category filter.
|
||||
|
||||
@param category The model of a category as returned by
|
||||
`getCategoryFilterCategoryGroupsCategories`.
|
||||
|
||||
@return The ID of the category.
|
||||
-->
|
||||
<#function getCategoryFilterCategoryId category>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the label of a category of a category filter.
|
||||
|
||||
@param category The model of a category as returned by
|
||||
`getCategoryFilterCategoryGroupsCategories`.
|
||||
|
||||
@return The label of the category.
|
||||
-->
|
||||
<#function getCategoryFilterCategoryLabel category>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<#--filedoc
|
||||
Functions for creating the table of contents of a multi part article.
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Gets the sections of a multi part article.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The sections of the multi part article.
|
||||
-->
|
||||
<#function getSections item>
|
||||
<#return item.toc.sections"]>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the title of a section.
|
||||
|
||||
@param section The model of the section as returned by `getSections`.
|
||||
|
||||
@return The title of the section.
|
||||
-->
|
||||
<#function getSectionTitle section>
|
||||
<#return section.title>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link for the section.
|
||||
|
||||
@param section The model of the section as returned by `getSections`.
|
||||
|
||||
@return The link for the section.
|
||||
-->
|
||||
<#function getSectionLink section>
|
||||
<#return section.link>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines of the provided section is the active section.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@param section The model of the section as returned by `getSections`.
|
||||
|
||||
@return `true` if the provided section is the active section, `false` otherwise.
|
||||
-->
|
||||
<#function isActiveSection item section>
|
||||
<#return section.rank == item.rank>
|
||||
</#function>
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
<#--filedoc
|
||||
Functions for processing MultiPartArticles.
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Get the summary of a multi part article.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The summary of the multi part article.
|
||||
-->
|
||||
<#function getSummary item>
|
||||
<#return item.summary>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the visible sections of a multi part article.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The visible sections of the multi part article.
|
||||
-->
|
||||
<#function getSections item>
|
||||
<#return item.sections>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the title of a section.
|
||||
|
||||
@param section The model of the section to use, as returned by `getSections`.
|
||||
|
||||
@return The title of the section.
|
||||
-->
|
||||
<#function getSectionTitle section>
|
||||
<#return section.title>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the content of a section.
|
||||
|
||||
@param section The model of the section to use, as returned by `getSections`.
|
||||
|
||||
@return The content of the section.
|
||||
-->
|
||||
<#function getSectionContent section>
|
||||
<#return section.text>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the rank (sort key) of a section.
|
||||
|
||||
@param section The model of the section to use, as returned by `getSections`.
|
||||
|
||||
@return The rank of the section.
|
||||
-->
|
||||
<#function getSectionRank section>
|
||||
<#return section.rank>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the number of the current page.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The number of the current page.
|
||||
-->
|
||||
<#function getPageNumber item>
|
||||
<#return item.pageNumber>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the number of the pages.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The number of the pages.
|
||||
-->
|
||||
<#function getNumberOfPages item>
|
||||
<#return item.numberOfPages>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if a link to the previous page is available.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return `true` if the link is available, `false` otherwise.
|
||||
-->
|
||||
<#function hasPreviousPage item>
|
||||
<#return (item.pageNumber != "all" && item.numberOfPages > 1)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if a link to the next page is available.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return `true` if the link is available, `false` otherwise.
|
||||
-->
|
||||
<#function hasNextPage item>
|
||||
<#return (item.pageNumber != "all" && item.pageNumber < itemnumberOfPages)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines of the multi part article has multiple pages.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return `true` if the article has multiple pages, `false` otherwise.
|
||||
-->
|
||||
<#function hasMultiplePages item>
|
||||
<#return item.pageNumber != "all" && item.pageNumber != "1">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the previous page.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The link to the previous page.
|
||||
-->
|
||||
<#function getLinkToPreviousPage item>
|
||||
<#return "?page${item.pageNumber - 1}">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the next page.
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The link to the next page.
|
||||
-->
|
||||
<#function getLinkToNextPage item>
|
||||
<#return "?page${item.pageNumber + 1}">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link for showing all sections on one page..
|
||||
|
||||
@param item The model of the multi part article to use.
|
||||
|
||||
@return The link for showing all sections on one page.
|
||||
-->
|
||||
<#function getAllSectionsLink item>
|
||||
<#return "?page=all">
|
||||
</#function>
|
||||
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
<#import "/ccm-cms/article-item.ftl" as Article>
|
||||
|
||||
<#--filedoc
|
||||
Functions for News items
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Gets the lead text of a news item
|
||||
|
||||
@param item The news item to use.
|
||||
|
||||
@return The lead text of the news item.
|
||||
-->
|
||||
<#function getLead item>
|
||||
<#return Article.getLead(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the main text of a news item
|
||||
|
||||
@param item The news item to use.
|
||||
|
||||
@return The main of the news item.
|
||||
-->
|
||||
<#function getMainText item>
|
||||
<#return Article.getMainText(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the date of a news item
|
||||
|
||||
@param item The news item to use.
|
||||
|
||||
@return The date of the news item.
|
||||
-->
|
||||
<#function getNewsDate item format="yyyy-MM-dd">
|
||||
<#return item.newDate?string(format)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the year of the news date.
|
||||
|
||||
@param item The news item to use.
|
||||
|
||||
@return The year of the news date.
|
||||
-->
|
||||
<#function getNewsDateYear item>
|
||||
<#return item.newsDate?string("yyyy")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the month of the news date.
|
||||
|
||||
@param item The news item to use.
|
||||
|
||||
@return The month of the news date.
|
||||
-->
|
||||
<#function getNewsDateMonth item>
|
||||
<#return item.newsDate?string("mm")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the day of the news date.
|
||||
|
||||
@param item The news item to use.
|
||||
|
||||
@return The day of the news date.
|
||||
-->
|
||||
<#function getNewsDateDay item>
|
||||
<#return item.newDate?string("dd")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the short name of the day of the news date.
|
||||
|
||||
@param item The news item to use.
|
||||
|
||||
@return The short name of the day of the news date.
|
||||
-->
|
||||
<#function getNewsDateDayNameShort item>
|
||||
<#return item.newDate?string("E")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the hour of the news date.
|
||||
|
||||
@param item The news item to use.
|
||||
|
||||
@return The hour of the news date.
|
||||
-->
|
||||
<#function newsDateHour item>
|
||||
<#return item.newDate?string("hh")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the minute of the news date.
|
||||
|
||||
@param item The news item to use.
|
||||
|
||||
@return The minute of the news date.
|
||||
-->
|
||||
<#function newsDateMinute item>
|
||||
<#return item.newDate?string("mm")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the second of the news date.
|
||||
|
||||
@param item The news item to use.
|
||||
|
||||
@return The second of the news date.
|
||||
-->
|
||||
<#function newsDateSecond item>
|
||||
<#return item.newDate?string("ss")>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the news date in ISO format (`yyyy-mm-dd HH:mm:ss`).
|
||||
|
||||
@param item The news item to use.
|
||||
|
||||
@return The in ISO format.
|
||||
-->
|
||||
<#function getNewsDateIso item>
|
||||
<#return news.newsDate?string("yyyy-MM-dd hh:mm:ss")>
|
||||
</#function>
|
||||
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
<#--filedoc
|
||||
Functions for processing the data provided by the pages application
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Alias for getPathPath
|
||||
-->
|
||||
<#function getCategoryPath>
|
||||
<#return getPagePath()>
|
||||
</#function>
|
||||
|
||||
<#--
|
||||
Gets the path of the current page.
|
||||
|
||||
@return A list of categories of all categories in the
|
||||
path of the current page.
|
||||
-->
|
||||
<#function getPagePath>
|
||||
<#return pagePath>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if the current page is the root page of a navigation.
|
||||
|
||||
@return `true` if teh current page is a root page, `false` otherwise.
|
||||
-->
|
||||
<#function isRootPage>
|
||||
<#return getPagePath()?size <= 0>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the currently selected category.
|
||||
|
||||
@return The currently selected category.
|
||||
-->
|
||||
<#function getSelectedCategory>
|
||||
<#if isRootPage()>
|
||||
<#return null>
|
||||
<#elseif getPagePath()??>
|
||||
<#return getPagePath()?last>
|
||||
<#else>
|
||||
<#return null>
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the ID of the currently selected category.
|
||||
|
||||
@return The ID of the currently selected category.
|
||||
-->
|
||||
<#function getSelectedCategoryId>
|
||||
<#if getSelectedCategory()??>
|
||||
<#return getSelectedCategory().categoryId>
|
||||
<#else>
|
||||
<#return "">
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the title of the provided category.
|
||||
|
||||
@param The model of a category as returned by several functions in this
|
||||
library.
|
||||
|
||||
@depcrecated Use the title property directly
|
||||
|
||||
@return The title of the category.
|
||||
-->
|
||||
<#function getCategoryTitle category>
|
||||
<#return category.categoryTitle>
|
||||
</#function>
|
||||
|
||||
<#--
|
||||
Get the ID get the provided category.
|
||||
|
||||
@param The model of a category as returned by several functions in this
|
||||
library.
|
||||
|
||||
@depcrecated Use the categoryId of uuid property directly
|
||||
|
||||
@return The ID of the provided category.
|
||||
-->
|
||||
<#function getCategoryId category>
|
||||
<#return category.categoryId>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines of the provided category is selected.
|
||||
|
||||
@param The model of a category as returned by several functions in this
|
||||
library.
|
||||
|
||||
@depcrecated Use the selected property directly
|
||||
|
||||
@return `true` if the category is selected, `false` if not.
|
||||
-->
|
||||
<#function isCategorySelected category>
|
||||
<#return category.selected>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the URL of the root category of the navigation with the provided id.
|
||||
|
||||
@param navigationId The ID of the navigation system to use.
|
||||
@param containerId Container of the category menu
|
||||
|
||||
@return The URL of the root category of the navigation system with the
|
||||
provided ID.
|
||||
-->
|
||||
<#function getNavigationRootUrl navigationId="categoryTree" containerId="container">
|
||||
<#return containerId?eval[navigationId].categoryPath>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get title of the navigation with the provided id.
|
||||
|
||||
@param navigationId The ID of the navigation system to use.
|
||||
@param containerId Container of the category menu
|
||||
|
||||
@depcrecated Without replacement
|
||||
|
||||
@return The title of the navigation.
|
||||
-->
|
||||
<#function getNavigationTitle navigationId="categoryMenu" containerId="container">
|
||||
<#return containerId?eval[navigationId].categoryTitle>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Retrieves the first level of categories from the category hierachy with the
|
||||
provided ID. If no id is provided 'categoryTree' is used.
|
||||
|
||||
@param hierarchyId The ID of the category hierarchy to use.
|
||||
@param containerId Container of the category hierarchy
|
||||
|
||||
@return The first level of categories in the hierarchy.
|
||||
-->
|
||||
<#function getCategoryHierarchy hierarchyId="categoryTree" containerId="container">
|
||||
<#return containerId?eval[hierarchyId].subCategories>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the subcategories of the provided category.
|
||||
|
||||
@param ofCategory The model of the category.
|
||||
|
||||
@depcrected Use the subCategories property directly
|
||||
|
||||
@return The sub categories of the provided category.
|
||||
-->
|
||||
<#function getSubCategories ofCategory>
|
||||
<#return ofCategory.subCategories>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Not longer supported
|
||||
|
||||
@param categoryId The ID of the category to use.
|
||||
|
||||
@depcrecated Without replacement
|
||||
|
||||
@return Nothing
|
||||
-->
|
||||
<#function getSubCategoriesOfCategoryWithId categoryId>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the greeting/index item of the current navigation page. The returned
|
||||
model can be processed with usual functions for processing content items.
|
||||
|
||||
@param containerId Container of the index item.
|
||||
|
||||
@return The model of the index item.
|
||||
-->
|
||||
<#function getIndexItem containerId="container">
|
||||
<#return containerId?eval.greetingItem>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the greeting/index item of the current navigation page. The returned
|
||||
model can be processed with usual functions for processing content items.
|
||||
|
||||
@param containerId Container of the index item.
|
||||
|
||||
@depcrecated Use getIndexItem
|
||||
|
||||
@return The model of the index item.
|
||||
-->
|
||||
<#function getGreetingItem containerId="container">
|
||||
<#return getIndexItem(containerId)>
|
||||
</#function>
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<#--filedoc
|
||||
Functions for processing related links.
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Generates a sorted sequence of hashes (see Freemarker documentation)
|
||||
from the related links of a content item.
|
||||
|
||||
@param item The model of the content item to use.
|
||||
|
||||
@param linkListName: The name of the link list to use.
|
||||
|
||||
@return The links attached to the provided item.
|
||||
-->
|
||||
<#function getRelatedLinks item linkListName="NONE">
|
||||
|
||||
<#return item.relatedLinks[linkListName]>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
*Internal* function for determing the type a related link.
|
||||
|
||||
@param link The link
|
||||
|
||||
@return The type of the link..
|
||||
-->
|
||||
<#function _getLinkType link>
|
||||
<#return link.type>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
*Internal* function for getting parameters for the link.
|
||||
|
||||
@param link The link
|
||||
|
||||
@return Parameters for an internal link.
|
||||
-->
|
||||
<#function _getInternalLinkParameters link>
|
||||
<#return link.parameters>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
*Internal* function for constructing the target URI of a related link.
|
||||
|
||||
@param link The link model to use.
|
||||
|
||||
@return The URL for the target of the link.
|
||||
-->
|
||||
<#function _getTargetUri link>
|
||||
<#return link.targetUri>
|
||||
</#function>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<#--filedoc
|
||||
Functions for processing note attachments.
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Generates a sorted sequence of hashes (see Freemarker documentation) for
|
||||
the note attachments of a content item.
|
||||
|
||||
@param item The model of the content item to use.
|
||||
|
||||
@return The side notes attached to the item.
|
||||
-->
|
||||
<#function getNotes item>
|
||||
<#returm item.sideNotes>
|
||||
</#function>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
<#--
|
||||
@depcrecated Use ccm-cms/pages.ftl
|
||||
The functions in this libary call the functions with the same
|
||||
names from ccm-cms/pages.ftl. This library will removed in a future
|
||||
release.
|
||||
-->
|
||||
|
||||
<#import "/ccm-cms/pages.ftl" as Pages>
|
||||
|
||||
<#--doc
|
||||
Get all categories from the category path.
|
||||
|
||||
@return All categories in the current category path.
|
||||
-->
|
||||
<#function getCategoryPath>
|
||||
<#return Pages.getCategoryPath()>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if the current page is the root page of a navigation.
|
||||
|
||||
@return `true` if teh current page is a root page, `false` otherwise.
|
||||
-->
|
||||
<#function isRootPage>
|
||||
<#return Pages.isRootPage()>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the currently selected category.
|
||||
|
||||
@return The currently selected category.
|
||||
-->
|
||||
<#function getSelectedCategory>
|
||||
<#return Pages.getSelectedCategory()>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the ID of the currently selected category.
|
||||
|
||||
@return The ID of the currently selected category.
|
||||
-->
|
||||
<#function getSelectedCategoryId>
|
||||
<#return Pages.getSelectedCategoryId()>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the title of the provided category.
|
||||
|
||||
@param The model of a category as returned by several functions in this
|
||||
library.
|
||||
|
||||
@return The title of the category.
|
||||
-->
|
||||
<#function getCategoryTitle category>
|
||||
<#return Pages.getCategoryTitle(category)>
|
||||
</#function>
|
||||
|
||||
<#--
|
||||
Get the URL of the provided category.
|
||||
|
||||
@param The model of a category as returned by several functions in this
|
||||
library.
|
||||
|
||||
@return The URL of the category.
|
||||
-->
|
||||
<#function getCategoryUrl category>
|
||||
<#return Pages.getCategoryUrl(category)>
|
||||
</#function>
|
||||
|
||||
<#--
|
||||
Get the ID get the provided category.
|
||||
|
||||
@param The model of a category as returned by several functions in this
|
||||
library.
|
||||
|
||||
@return The ID of the provided category.
|
||||
-->
|
||||
<#function getCategoryId category>
|
||||
<#return Pages.getCategoryId(category)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines of the provided category is selected.
|
||||
|
||||
@param The model of a category as returned by several functions in this
|
||||
library.
|
||||
|
||||
@return `true` if the category is selected, `false` if not.
|
||||
-->
|
||||
<#function isCategorySelected category>
|
||||
<#return Pages.isCategorySelected(category)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the URL of the root category of the navigation with the provided id.
|
||||
|
||||
@param navigationId The ID of the navigation system to use.
|
||||
|
||||
@return The URL of the root category of the navigation system with the
|
||||
provided ID.
|
||||
-->
|
||||
<#function getNavigationRootUrl navigationId="categoryMenu">
|
||||
<#return Pages.getNavigationRootUrl(navigationId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get title of the navigation with the provided id.
|
||||
|
||||
@param navigationId The ID of the navigation system to use.
|
||||
|
||||
@return The title of the navigation.
|
||||
-->
|
||||
<#function getNavigationTitle navigationId="categoryMenu">
|
||||
<#return Pages.getNavigationTitle(navigationId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Retrieves the first level of categories from the category menu with the provided ID.
|
||||
If no id is provided "categoryMenu" is used.
|
||||
|
||||
@param menuId The ID of the category menu to use.
|
||||
|
||||
@return The first level of categories in the menu.
|
||||
-->
|
||||
<#function getCategoryMenu menuId="categoryMenu">
|
||||
<#return Pages.getCategoryMenu(menuId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Retrieves the first level of categories from the category hierachy with the
|
||||
provided ID. If no id is provided 'categoryNav' is used.
|
||||
|
||||
@param hierarchyId The ID of the category hierachy to use.
|
||||
|
||||
@return The first level of categories in the hierarchy.
|
||||
-->
|
||||
<#function getCategoryHierarchy hierarchyId="categoryNav">
|
||||
<#return Pages.getCategoryHierarchy(hierarchyId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the subcategories of the provided category.
|
||||
|
||||
@param ofCategory The model of the category.
|
||||
|
||||
@return The sub categories of the provided category.
|
||||
-->
|
||||
<#function getSubCategories ofCategory>
|
||||
<#return Pages.getSubCategories(ofCategory)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the subcategories of the category with the provided id.
|
||||
|
||||
@param categoryId The ID of the category to use.
|
||||
|
||||
@return The sub categories of the category with the provided ID.
|
||||
-->
|
||||
<#function getSubCategoriesOfCategoryWithId categoryId>
|
||||
<#return Pages.getSubCategoriesOfCategoryWithId(categoryId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the greeting/index item of the current navigation page. The returned
|
||||
model can be processed with usual functions for processing content items.
|
||||
|
||||
@return The model of the index item.
|
||||
-->
|
||||
<#function getGreetingItem>
|
||||
<#return Pages.getGreetingItem()>
|
||||
</#function>
|
||||
|
|
@ -0,0 +1,446 @@
|
|||
<#--filedoc
|
||||
Functions for accessing objects lists and their properties.
|
||||
|
||||
@depcrecated use ccmc-cms/item-list.ftl instead
|
||||
-->
|
||||
|
||||
<#import "/ccm-navigation/item-list.ftl" as ItemList>
|
||||
|
||||
<#--doc
|
||||
Retrieve the item (models) of an object list. This function can deal with
|
||||
several different types of object lists, including `SimpleObjectList`,
|
||||
`ComplexObjectList` and `CustomziableObjectList`.
|
||||
|
||||
@param listId The ID of the object list from the the items are retrieved.
|
||||
|
||||
@return The models for the entries in the object list. If no list with
|
||||
the provided `listId` is found and empty sequence is returned.
|
||||
-->
|
||||
<#function getItems listId>
|
||||
<#return ItemList.getItems(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the number of objects/items in an object list.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
|
||||
@return The number of objects in the list. If no list with the provided
|
||||
`listId` is found `0` is returned.
|
||||
-->
|
||||
<#function getObjectCount listId>
|
||||
<#return ItemList.getObjectCount(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the base URL for the paginator of an object list.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
|
||||
@return The base URL for the the paginator.
|
||||
-->
|
||||
<#function getPaginatorBaseUrl listId>
|
||||
<#return ItemList.getPaginatorBaseUrl(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the index of the first item shown on the current page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
|
||||
@return The index of the first item shown on the current page.
|
||||
-->
|
||||
<#function getPaginatorBegin listId>
|
||||
<#return ItemList.getPaginatorBegin(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the index of the last item shown on the curent page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
|
||||
@return The index of the last item shown on the current page.
|
||||
-->
|
||||
<#function getPaginatorEnd listId>
|
||||
<#return ItemList.getPaginatorEnd(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the number of pages of an object list.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
|
||||
@return The number of pages of the object list. If no list with the
|
||||
provided `listId` is found the function will return `0`.
|
||||
-->
|
||||
<#function getPageCount listId>
|
||||
<#return ItemList.getPageCount(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the number of the current page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
|
||||
@return The number of the page currently shown.
|
||||
-->
|
||||
<#function getPageNumber listId>
|
||||
<#return ItemList.getPageNumber(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the name of the page URL parameter.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
|
||||
@return The name of the page URL parameter.
|
||||
-->
|
||||
<#function getPageParam listId>
|
||||
<#return ItemList.getPageParam(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the maximum number of items on a page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
|
||||
@return The maxium number of items on a page.
|
||||
-->
|
||||
<#function getPageSize listId>
|
||||
<#return ItemList.getPageSize(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the previous page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
|
||||
@return The link to the previous page.
|
||||
-->
|
||||
<#function getPrevPageLink listId>
|
||||
<#return ItemList.getPrevPageLink(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the next page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
|
||||
@return The link to the next page.
|
||||
-->
|
||||
<#function getNextPageLink listId>
|
||||
<#return ItemList.getNextPageLink(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the first page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
|
||||
@return The link to the first page.
|
||||
-->
|
||||
<#function getFirstPageLink listId>
|
||||
<#return ItemList.getFirstPageLink(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the last page.
|
||||
|
||||
@param listId The ID of the object list to use.
|
||||
|
||||
@return The link to the last page.
|
||||
-->
|
||||
<#function getLastPageLink listId>
|
||||
<#return ItemList.getLastPageLink(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the title of an item from an object list.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return The title of the item.
|
||||
-->
|
||||
<#function getItemTitle item>
|
||||
<#return ItemList.getItemTitle(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the link to the detail view of an item in a list.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return The link to the detail view of the item.
|
||||
-->
|
||||
<#function getItemLink item>
|
||||
<#return ItemList.getItemLink(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Checks if the model of the list entry of an item contains a value for the
|
||||
`lead` property.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return `true` if the model provides a value of the `lead` property,
|
||||
`false` if not.
|
||||
-->
|
||||
<#function hasItemLead item>
|
||||
<#return ItemList.hasItemLead(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the value of the `lead` property of an item.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return The value of the `lead` property.
|
||||
-->
|
||||
<#function getItemLead item>
|
||||
<#return ItemList.getItemLead(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
A generic function for checking if the model of a list entry for an item
|
||||
has a specific property.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@param property The name of the property to check for.
|
||||
|
||||
@return `true` If the provided model provides an value for the property,
|
||||
`false` if not.
|
||||
-->
|
||||
<#function hasItemProperty item property>
|
||||
<#return ItemList.hasItemProperty(item, property)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
A generic function for retrieving the value of an property from the model
|
||||
for a list entry for an item.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@param property The name of the property to retrieve.
|
||||
|
||||
@return The value of the property.
|
||||
-->
|
||||
<#function getItemProperty item property>
|
||||
<#return ItemList.getItemProperty(item, property)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Checks if the provided item has an associated image.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return `true` if the item has an associated image, `false` if not.
|
||||
-->
|
||||
<#function hasImage item>
|
||||
<#return ItemList.hasImage(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the ID of an associated image.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return The ID of the associated image.
|
||||
-->
|
||||
<#function getImageId item>
|
||||
<#return ItemList.getImageId(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Generates the URL for an associated image.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return The URL of the associated image.
|
||||
-->
|
||||
<#function getImageUrl item>
|
||||
<#return ItemList.getImageUrl(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the caption for the associated image.
|
||||
|
||||
@param item The model of the list entry for the item.
|
||||
|
||||
@return The caption for the associated image.
|
||||
-->
|
||||
<#function getImageCaption item>
|
||||
#return ItemList.getImageCaption(item)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Retrieves the filters for an object list.
|
||||
|
||||
@param listId The ID of the list to use.
|
||||
|
||||
@return The filters for the list. An empty sequence is returned if no list
|
||||
with the provided `listId` could be found or if the list does not have any filters.
|
||||
-->
|
||||
<#function getFilters listId>
|
||||
<#return ItemList.getFilters(listId)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the label of a filter.
|
||||
|
||||
@param filter model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The label of the filter.
|
||||
-->
|
||||
<#function getFilterLabel filter>
|
||||
<#return ItemList.getFilterLabel(filter)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the type of a filter.
|
||||
|
||||
@param filter model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The type of the filter.
|
||||
-->
|
||||
<#function getFilterType filter>
|
||||
<#return ItemList.getFilterType(filter)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the options of a select filter.
|
||||
|
||||
@param filter model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The options of the select filter.
|
||||
-->
|
||||
<#function getSelectFilterOptions filter>
|
||||
<#return ItemList.getSelectedFilterOptions(filter)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the currently selected option of a select filter.
|
||||
|
||||
@param filter model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The currently selected option.
|
||||
-->
|
||||
<#function getSelectFilterSelection filter>
|
||||
<#return ItemList.getSelectFilterSelection(filter)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
The label for an option of a select filter.
|
||||
|
||||
@param filter model of an option as returned by `getSelectFilterOptions`.
|
||||
|
||||
@return The label of the option.
|
||||
-->
|
||||
<#function getSelectFilterOptionLabel option>
|
||||
<#return ItemList.getSelectFilterOptionLabel(filter)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the search string of an category filter.
|
||||
|
||||
@param filter model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The search string.
|
||||
-->
|
||||
<#function getCategoryFilterSearchString filter>
|
||||
<#return ItemList.getCategoryFilterSearchString(filter)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the separator for a category filter.
|
||||
|
||||
@param filter The model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The separator for separating the categories in the search string.
|
||||
-->
|
||||
<#function getCategoryFilterSeparator filter>
|
||||
<#return ItemList.getCategoryFilterSeparator(filter)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Determines if a category allows the selection of multiple categories.
|
||||
|
||||
@param filter The model of a filter as returned by `getFilters`.
|
||||
|
||||
@return `true` if the filter allows multiple selections, `false` otherwise.
|
||||
-->
|
||||
<#function getCategoryFilterMultiple filter>
|
||||
<#return ItemList.getCategoryFilterMultiple(filter)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the selectable categories for a category filter.
|
||||
|
||||
@param filter The model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The selectable categories.
|
||||
-->
|
||||
<#function getCategoryFilterCategories filter>
|
||||
<#return ItemList.getCategoryFilterCategories(filter)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the groups of a category filter.
|
||||
|
||||
@param filter The model of a filter as returned by `getFilters`.
|
||||
|
||||
@return The groups of a category filter.
|
||||
-->
|
||||
<#function getCategoryFilterCategoryGroups filter>
|
||||
<#return ItemList.getCategoryFilterCategoryGroups(filter)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the label of a category group.
|
||||
|
||||
@param group The model of a category group as returned by
|
||||
`getCategoryFilterCategoryGroups`.
|
||||
|
||||
@return The label for the group.
|
||||
-->
|
||||
<#function getCategoryGroupLabel group>
|
||||
<#return ItemList.getCategoryGroupLabel(filter)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the categories in a group.
|
||||
|
||||
@param group The model of a category group as returned by
|
||||
`getCategoryFilterCategoryGroups`.
|
||||
|
||||
@return The categories in the group.
|
||||
-->
|
||||
<#function getCategoryFilterCategoryGroupsCategories groups>
|
||||
|
||||
<#return ItemList.getCategoryFilterCategoryGroupsCategories(filter)>
|
||||
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the ID of a category of a category filter.
|
||||
|
||||
@param category The model of a category as returned by
|
||||
`getCategoryFilterCategoryGroupsCategories`.
|
||||
|
||||
@return The ID of the category.
|
||||
-->
|
||||
<#function getCategoryFilterCategoryId category>
|
||||
<#return ItemList.getCategoryFilterCategoryId(filter)>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Gets the label of a category of a category filter.
|
||||
|
||||
@param category The model of a category as returned by
|
||||
`getCategoryFilterCategoryGroupsCategories`.
|
||||
|
||||
@return The label of the category.
|
||||
-->
|
||||
<#function getCategoryFilterCategoryLabel category>
|
||||
<#return ItemList.getCategoryFilterCategoryLabel(category)>
|
||||
</#function>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<#--filedoc
|
||||
Language related utility functions
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Retrieves the supported languages.
|
||||
|
||||
@deprecated: Use getSupportedLanguages
|
||||
|
||||
@return A sequence of the available languages (as ISO language codes)
|
||||
#-->
|
||||
<#function getSupportedLanguages>
|
||||
<#return siteInfo.supportedLanguages>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Retrieves the supported languages.
|
||||
|
||||
@deprecated: Use getSupportedLanguages and the functions provided by the
|
||||
module providing content.
|
||||
|
||||
@return A sequence of the available languages (as ISO language codes)
|
||||
#-->
|
||||
<#function getAvailableLanguages>
|
||||
<#return getSupportedLanguages()>
|
||||
</#function>
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
<#--filedoc
|
||||
Utility functions for Freemarker based themes.
|
||||
-->
|
||||
|
||||
<#--doc
|
||||
Gets the application of the page served from the model.
|
||||
|
||||
@return The current application.
|
||||
-->
|
||||
<#function getPageApplication>
|
||||
<#return application>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
|
||||
Not supported in 7.0.0 yet, will always return an empty string.
|
||||
|
||||
Get the title of the current page.
|
||||
|
||||
This will only work of the current page with a category tree
|
||||
|
||||
@return The title of the current page
|
||||
-->
|
||||
<#function getPageTitle>
|
||||
<#return "">
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the hostname from the sitebanner data.
|
||||
|
||||
@return The host name of the site.
|
||||
-->
|
||||
<#function getSiteHostName>
|
||||
<#return siteInfo.host>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the name of the site from the sitebanner data.
|
||||
|
||||
@return The name of the site.
|
||||
-->
|
||||
<#function getSiteName>
|
||||
<#return siteInfo.name>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
Get the domain of the site.
|
||||
|
||||
@return The name of the site.
|
||||
-->
|
||||
<#function getSiteDomain>
|
||||
<#return siteInfo.domain>
|
||||
</#function>
|
||||
|
||||
<#--doc
|
||||
A wrapper for the `_formatDateTime` function which adds missing numbers.
|
||||
`_formatDateTime` uses Java APIs for formatting which don't work well with
|
||||
incomplete dates. This function takes a date from the data model and checks
|
||||
if a component (year, month, day, hour, minute, second) is missing. If the
|
||||
the component is missing the function adds uses a default value of that
|
||||
component.
|
||||
|
||||
@param style The date format style from the theme manifest to use.
|
||||
|
||||
@param date the date to format.
|
||||
|
||||
@return The formatted date.
|
||||
-->
|
||||
<#function formatDateTime style date>
|
||||
<#assign year = date.year!0>
|
||||
<#assign month = date.month!0>
|
||||
<#assign day = date.day!0>
|
||||
<#assign hour = date.hour!0>
|
||||
<#assign minute = date.minute!0>
|
||||
<#assign second = date.second!0>
|
||||
<#return _formatDateTime(style, year, month, day, hour, minute, second)>
|
||||
</#function>
|
||||
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
drop schema if exists CCM_CMS;
|
||||
drop schema if exists CCM_CORE;
|
||||
drop schema if exists CCM_CMS CASCADE;
|
||||
drop schema if exists CCM_CORE CASCADE;
|
||||
|
||||
drop sequence if exists HIBERNATE_SEQUENCE;
|
||||
|
||||
|
||||
create schema CCM_CMS;
|
||||
|
||||
create schema CCM_CORE;
|
||||
|
|
|
|||
|
|
@ -736,6 +736,7 @@
|
|||
LISTENER varchar(1024),
|
||||
START_DATE_TIME date,
|
||||
STARTED boolean,
|
||||
UUID varchar(255),
|
||||
DEFINITION_ID bigint,
|
||||
primary key (LIFECYCLE_ID)
|
||||
);
|
||||
|
|
@ -743,6 +744,7 @@
|
|||
create table CCM_CMS.LIFECYLE_DEFINITIONS (
|
||||
LIFECYCLE_DEFINITION_ID bigint not null,
|
||||
DEFAULT_LISTENER varchar(1024),
|
||||
UUID varchar(255),
|
||||
primary key (LIFECYCLE_DEFINITION_ID)
|
||||
);
|
||||
|
||||
|
|
@ -1040,6 +1042,12 @@
|
|||
alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
|
||||
add constraint UK_goj42ghwu4tf1akfb2r6ensns unique (WORKFLOW_TEMPLATE_ID);
|
||||
|
||||
alter table CCM_CMS.LIFECYCLES
|
||||
add constraint UK_40o4njo54m8c4xlwq6ctnsimd unique (UUID);
|
||||
|
||||
alter table CCM_CMS.LIFECYLE_DEFINITIONS
|
||||
add constraint UK_n6ki3s5im2k2nccpocuctqqe3 unique (UUID);
|
||||
|
||||
create table CCM_CORE.APPLICATIONS (
|
||||
APPLICATION_TYPE varchar(1024) not null,
|
||||
PRIMARY_URL varchar(1024) not null,
|
||||
|
|
@ -1584,11 +1592,11 @@
|
|||
SETTING_ID bigint not null,
|
||||
CONFIGURATION_CLASS varchar(512) not null,
|
||||
NAME varchar(512) not null,
|
||||
SETTING_VALUE_LONG bigint,
|
||||
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
|
||||
SETTING_VALUE_DOUBLE double,
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
SETTING_VALUE_LONG bigint,
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_DOUBLE double,
|
||||
primary key (SETTING_ID)
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -736,6 +736,7 @@
|
|||
LISTENER varchar(1024),
|
||||
START_DATE_TIME date,
|
||||
STARTED boolean,
|
||||
UUID varchar(255),
|
||||
DEFINITION_ID int8,
|
||||
primary key (LIFECYCLE_ID)
|
||||
);
|
||||
|
|
@ -743,6 +744,7 @@
|
|||
create table CCM_CMS.LIFECYLE_DEFINITIONS (
|
||||
LIFECYCLE_DEFINITION_ID int8 not null,
|
||||
DEFAULT_LISTENER varchar(1024),
|
||||
UUID varchar(255),
|
||||
primary key (LIFECYCLE_DEFINITION_ID)
|
||||
);
|
||||
|
||||
|
|
@ -1040,6 +1042,12 @@
|
|||
alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
|
||||
add constraint UK_goj42ghwu4tf1akfb2r6ensns unique (WORKFLOW_TEMPLATE_ID);
|
||||
|
||||
alter table CCM_CMS.LIFECYCLES
|
||||
add constraint UK_40o4njo54m8c4xlwq6ctnsimd unique (UUID);
|
||||
|
||||
alter table CCM_CMS.LIFECYLE_DEFINITIONS
|
||||
add constraint UK_n6ki3s5im2k2nccpocuctqqe3 unique (UUID);
|
||||
|
||||
create table CCM_CORE.APPLICATIONS (
|
||||
APPLICATION_TYPE varchar(1024) not null,
|
||||
PRIMARY_URL varchar(1024) not null,
|
||||
|
|
@ -1584,11 +1592,11 @@
|
|||
SETTING_ID int8 not null,
|
||||
CONFIGURATION_CLASS varchar(512) not null,
|
||||
NAME varchar(512) not null,
|
||||
SETTING_VALUE_LONG int8,
|
||||
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
|
||||
SETTING_VALUE_DOUBLE float8,
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
SETTING_VALUE_LONG int8,
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_DOUBLE float8,
|
||||
primary key (SETTING_ID)
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -221,6 +221,80 @@
|
|||
primary key (COMPONENT_MODEL_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRIES (
|
||||
CONTACT_ENTRY_ID bigint not null,
|
||||
ENTRY_ORDER bigint,
|
||||
ENTRY_VALUE varchar(4096),
|
||||
CONTACT_ENTRY_KEY_ID bigint,
|
||||
CONTACTABLE_ID bigint,
|
||||
primary key (CONTACT_ENTRY_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRIES_AUD (
|
||||
CONTACT_ENTRY_ID bigint not null,
|
||||
REV integer not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
ENTRY_ORDER bigint,
|
||||
ENTRY_VALUE varchar(4096),
|
||||
CONTACT_ENTRY_KEY_ID bigint,
|
||||
primary key (CONTACT_ENTRY_ID, REV)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRY_KEY_LABELS (
|
||||
KEY_ID bigint not null,
|
||||
LOCALIZED_VALUE varchar(2147483647),
|
||||
LOCALE varchar(255) not null,
|
||||
primary key (KEY_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRY_KEY_LABELS_AUD (
|
||||
REV integer not null,
|
||||
KEY_ID bigint not null,
|
||||
LOCALIZED_VALUE varchar(2147483647) not null,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, KEY_ID, LOCALIZED_VALUE, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRY_KEYS (
|
||||
KEY_ID bigint not null,
|
||||
ENTRY_KEY varchar(255),
|
||||
primary key (KEY_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRY_KEYS_AUD (
|
||||
KEY_ID bigint not null,
|
||||
REV integer not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
ENTRY_KEY varchar(255),
|
||||
primary key (KEY_ID, REV)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACTABLE_ENTITIES (
|
||||
OBJECT_ID bigint not null,
|
||||
POSTAL_ADDRESS_ID bigint,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACTABLE_ENTITIES_AUD (
|
||||
OBJECT_ID bigint not null,
|
||||
REV integer not null,
|
||||
POSTAL_ADDRESS_ID bigint,
|
||||
primary key (OBJECT_ID, REV)
|
||||
);
|
||||
|
||||
create table CCM_CMS.ContactableEntity_ContactEntry_AUD (
|
||||
REV integer not null,
|
||||
CONTACTABLE_ID bigint not null,
|
||||
CONTACT_ENTRY_ID bigint not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, CONTACTABLE_ID, CONTACT_ENTRY_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTENT_ITEM_COMPONENTS (
|
||||
MODE varchar(255),
|
||||
COMPONENT_MODEL_ID bigint not null,
|
||||
|
|
@ -662,6 +736,7 @@
|
|||
LISTENER varchar(1024),
|
||||
START_DATE_TIME date,
|
||||
STARTED boolean,
|
||||
UUID varchar(255),
|
||||
DEFINITION_ID bigint,
|
||||
primary key (LIFECYCLE_ID)
|
||||
);
|
||||
|
|
@ -669,6 +744,7 @@
|
|||
create table CCM_CMS.LIFECYLE_DEFINITIONS (
|
||||
LIFECYCLE_DEFINITION_ID bigint not null,
|
||||
DEFAULT_LISTENER varchar(1024),
|
||||
UUID varchar(255),
|
||||
primary key (LIFECYCLE_DEFINITION_ID)
|
||||
);
|
||||
|
||||
|
|
@ -805,6 +881,19 @@
|
|||
primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.ORGANIZATIONS (
|
||||
NAME varchar(1024),
|
||||
OBJECT_ID bigint not null,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.ORGANIZATIONS_AUD (
|
||||
OBJECT_ID bigint not null,
|
||||
REV integer not null,
|
||||
NAME varchar(1024),
|
||||
primary key (OBJECT_ID, REV)
|
||||
);
|
||||
|
||||
create table CCM_CMS.PAGE_THEME_CONFIGURATIONS (
|
||||
PAGE_ID bigint not null,
|
||||
INDEX_PAGE_TEMPLATE varchar(255),
|
||||
|
|
@ -827,6 +916,60 @@
|
|||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.PERSON_NAMES (
|
||||
PERSON_ID bigint not null,
|
||||
GIVEN_NAME varchar(255),
|
||||
NAME_PREFIX varchar(255),
|
||||
SUFFIX varchar(255),
|
||||
SURNAME varchar(255)
|
||||
);
|
||||
|
||||
create table CCM_CMS.PERSON_NAMES_AUD (
|
||||
REV integer not null,
|
||||
REVTYPE tinyint not null,
|
||||
PERSON_ID bigint not null,
|
||||
REVEND integer,
|
||||
SURNAME varchar(255),
|
||||
NAME_PREFIX varchar(255),
|
||||
GIVEN_NAME varchar(255),
|
||||
SUFFIX varchar(255),
|
||||
primary key (REV, REVTYPE, PERSON_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.PERSONS (
|
||||
BIRTHDATE date,
|
||||
OBJECT_ID bigint not null,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.PERSONS_AUD (
|
||||
OBJECT_ID bigint not null,
|
||||
REV integer not null,
|
||||
BIRTHDATE date,
|
||||
primary key (OBJECT_ID, REV)
|
||||
);
|
||||
|
||||
create table CCM_CMS.POSTAL_ADDRESSES (
|
||||
ADDRESS varchar(2048),
|
||||
CITY varchar(512),
|
||||
ISO_COUNTRY_CODE varchar(10),
|
||||
POSTAL_CODE varchar(255),
|
||||
ADDRESS_STATE varchar(255),
|
||||
OBJECT_ID bigint not null,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.POSTAL_ADDRESSES_AUD (
|
||||
OBJECT_ID bigint not null,
|
||||
REV integer not null,
|
||||
ADDRESS varchar(2048),
|
||||
CITY varchar(512),
|
||||
ISO_COUNTRY_CODE varchar(10),
|
||||
POSTAL_CODE varchar(255),
|
||||
ADDRESS_STATE varchar(255),
|
||||
primary key (OBJECT_ID, REV)
|
||||
);
|
||||
|
||||
create table CCM_CMS.RELATED_LINKS (
|
||||
OBJECT_ID bigint not null,
|
||||
BOOKMARK_ID bigint,
|
||||
|
|
@ -899,6 +1042,12 @@
|
|||
alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
|
||||
add constraint UK_goj42ghwu4tf1akfb2r6ensns unique (WORKFLOW_TEMPLATE_ID);
|
||||
|
||||
alter table CCM_CMS.LIFECYCLES
|
||||
add constraint UK_40o4njo54m8c4xlwq6ctnsimd unique (UUID);
|
||||
|
||||
alter table CCM_CMS.LIFECYLE_DEFINITIONS
|
||||
add constraint UK_n6ki3s5im2k2nccpocuctqqe3 unique (UUID);
|
||||
|
||||
create table CCM_CORE.APPLICATIONS (
|
||||
APPLICATION_TYPE varchar(1024) not null,
|
||||
PRIMARY_URL varchar(1024) not null,
|
||||
|
|
@ -1444,10 +1593,10 @@
|
|||
CONFIGURATION_CLASS varchar(512) not null,
|
||||
NAME varchar(512) not null,
|
||||
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
|
||||
SETTING_VALUE_DOUBLE double,
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
SETTING_VALUE_LONG bigint,
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_DOUBLE double,
|
||||
primary key (SETTING_ID)
|
||||
);
|
||||
|
||||
|
|
@ -1917,6 +2066,76 @@ create sequence hibernate_sequence start with 1 increment by 1;
|
|||
foreign key (COMPONENT_MODEL_ID)
|
||||
references CCM_CORE.PAGE_MODEL_COMPONENT_MODELS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRIES
|
||||
add constraint FKirtfj8sm4y5myworl5hvs1l78
|
||||
foreign key (CONTACT_ENTRY_KEY_ID)
|
||||
references CCM_CMS.CONTACT_ENTRY_KEYS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRIES
|
||||
add constraint FKljrrfco44damal9eaqrnfam0m
|
||||
foreign key (CONTACTABLE_ID)
|
||||
references CCM_CMS.CONTACTABLE_ENTITIES;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRIES_AUD
|
||||
add constraint FKib8xp3ab8kdkc0six36f99e2g
|
||||
foreign key (REV)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRIES_AUD
|
||||
add constraint FKrse7ibjqsfnny5t1b2tqqs3pt
|
||||
foreign key (REVEND)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRY_KEY_LABELS
|
||||
add constraint FK243nk3buqm0pskkr5ifjqfxn5
|
||||
foreign key (KEY_ID)
|
||||
references CCM_CMS.CONTACT_ENTRY_KEYS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRY_KEY_LABELS_AUD
|
||||
add constraint FK6n995k5gao6v63gfcga3yaxcw
|
||||
foreign key (REV)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRY_KEY_LABELS_AUD
|
||||
add constraint FKdr8ujdpn1ej8l6omlxq8bsxbd
|
||||
foreign key (REVEND)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRY_KEYS_AUD
|
||||
add constraint FKcvn2b1h1d4uvvmtbf4qf81l0y
|
||||
foreign key (REV)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRY_KEYS_AUD
|
||||
add constraint FKkyy4v3tax8w5htnpkmmt8aec1
|
||||
foreign key (REVEND)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACTABLE_ENTITIES
|
||||
add constraint FKqefwowr9adclj3xvpfje9rddr
|
||||
foreign key (POSTAL_ADDRESS_ID)
|
||||
references CCM_CMS.POSTAL_ADDRESSES;
|
||||
|
||||
alter table CCM_CMS.CONTACTABLE_ENTITIES
|
||||
add constraint FKhdwlhf3jp8wf5wxjkoynrcspj
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CMS.ASSETS;
|
||||
|
||||
alter table CCM_CMS.CONTACTABLE_ENTITIES_AUD
|
||||
add constraint FKjx8trfvt96fkdn6bafnh839id
|
||||
foreign key (OBJECT_ID, REV)
|
||||
references CCM_CMS.ASSETS_AUD;
|
||||
|
||||
alter table CCM_CMS.ContactableEntity_ContactEntry_AUD
|
||||
add constraint FKs5tfdp1auj9ocgvfa9ivec517
|
||||
foreign key (REV)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.ContactableEntity_ContactEntry_AUD
|
||||
add constraint FKskn2ovg24tnnnwd2o8y0biyje
|
||||
foreign key (REVEND)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTENT_ITEM_COMPONENTS
|
||||
add constraint FKp83o82kxo2ipa0xo03wxp4dcr
|
||||
foreign key (COMPONENT_MODEL_ID)
|
||||
|
|
@ -2447,6 +2666,16 @@ create sequence hibernate_sequence start with 1 increment by 1;
|
|||
foreign key (REVEND)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.ORGANIZATIONS
|
||||
add constraint FK77ig0to48xrlfx8qsc0vlfsp6
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CMS.CONTACTABLE_ENTITIES;
|
||||
|
||||
alter table CCM_CMS.ORGANIZATIONS_AUD
|
||||
add constraint FKp0k3bf008pih96sguio80siql
|
||||
foreign key (OBJECT_ID, REV)
|
||||
references CCM_CMS.CONTACTABLE_ENTITIES_AUD;
|
||||
|
||||
alter table CCM_CMS.PAGE_THEME_CONFIGURATIONS
|
||||
add constraint FK6l6xp6ex6sh2uuxfmeekf6ckn
|
||||
foreign key (PAGE_ID)
|
||||
|
|
@ -2477,6 +2706,41 @@ create sequence hibernate_sequence start with 1 increment by 1;
|
|||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.SITE_AWARE_APPLICATIONS;
|
||||
|
||||
alter table CCM_CMS.PERSON_NAMES
|
||||
add constraint FK2yluyhmpuhwxafcbna6u8txrt
|
||||
foreign key (PERSON_ID)
|
||||
references CCM_CMS.PERSONS;
|
||||
|
||||
alter table CCM_CMS.PERSON_NAMES_AUD
|
||||
add constraint FKtqtlwx8pa9ydh009sudtpfxie
|
||||
foreign key (REV)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.PERSON_NAMES_AUD
|
||||
add constraint FKs6m8tgbp8agrd5q3klwbtcujg
|
||||
foreign key (REVEND)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.PERSONS
|
||||
add constraint FKiv4ydysjekfx64pkb5v4vd9yj
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CMS.CONTACTABLE_ENTITIES;
|
||||
|
||||
alter table CCM_CMS.PERSONS_AUD
|
||||
add constraint FKpup1q3295qkuovaptq8aj5lxp
|
||||
foreign key (OBJECT_ID, REV)
|
||||
references CCM_CMS.CONTACTABLE_ENTITIES_AUD;
|
||||
|
||||
alter table CCM_CMS.POSTAL_ADDRESSES
|
||||
add constraint FK4vajjjjo8ro0wns58t8f3i782
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CMS.ASSETS;
|
||||
|
||||
alter table CCM_CMS.POSTAL_ADDRESSES_AUD
|
||||
add constraint FKcrxgaot6kcp9rbxlg8gpp4grg
|
||||
foreign key (OBJECT_ID, REV)
|
||||
references CCM_CMS.ASSETS_AUD;
|
||||
|
||||
alter table CCM_CMS.RELATED_LINKS
|
||||
add constraint FKb517dnfj56oby2s34jp1omuim
|
||||
foreign key (BOOKMARK_ID)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* 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.ui.admin.applications;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
import org.libreccm.web.ApplicationRepository;
|
||||
import org.libreccm.web.CcmApplication;
|
||||
|
||||
import java.io.Serializable;
|
||||
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 ApplicationInstanceTreeCdiUtil implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Inject
|
||||
private ApplicationRepository applicationRepo;
|
||||
|
||||
@Inject
|
||||
private ConfigurationManager confManager;
|
||||
|
||||
@Inject
|
||||
private GlobalizationHelper globalizationHelper;
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String getTitle(final CcmApplication ofApplication) {
|
||||
final CcmApplication application = applicationRepo
|
||||
.findById(ofApplication.getObjectId())
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No CcmApplication with ID %d available.",
|
||||
ofApplication.getObjectId()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
KernelConfig.class);
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
|
||||
final String title;
|
||||
if (application.getTitle().hasValue(globalizationHelper
|
||||
.getNegotiatedLocale())) {
|
||||
title = application.getTitle().getValue(globalizationHelper
|
||||
.getNegotiatedLocale());
|
||||
} else if (application.getTitle().hasValue(defaultLocale)) {
|
||||
title = application.getTitle().getValue(defaultLocale);
|
||||
} else if (application.getTitle().hasValue(Locale.getDefault())) {
|
||||
title = application.getTitle().getValue(Locale.getDefault());
|
||||
} else {
|
||||
title = application.getPrimaryUrl();
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -51,28 +51,31 @@ public class ApplicationInstanceTreeNode implements TreeNode {
|
|||
|
||||
@Override
|
||||
public Object getElement() {
|
||||
final GlobalizationHelper globalizationHelper = CdiUtil.createCdiUtil()
|
||||
.findBean(GlobalizationHelper.class);
|
||||
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
// final GlobalizationHelper globalizationHelper = cdiUtil
|
||||
// .findBean(GlobalizationHelper.class);
|
||||
final ConfigurationManager confManager = cdiUtil
|
||||
.findBean(ConfigurationManager.class);
|
||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
KernelConfig.class);
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
// final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
// KernelConfig.class);
|
||||
// final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
final ApplicationInstanceTreeCdiUtil util = cdiUtil
|
||||
.findBean(ApplicationInstanceTreeCdiUtil.class);
|
||||
|
||||
final String title;
|
||||
if (application.getTitle().hasValue(globalizationHelper
|
||||
.getNegotiatedLocale())) {
|
||||
title = application.getTitle().getValue(globalizationHelper
|
||||
.getNegotiatedLocale());
|
||||
} else if (application.getTitle().hasValue(defaultLocale)) {
|
||||
title = application.getTitle().getValue(defaultLocale);
|
||||
} else if (application.getTitle().hasValue(Locale.getDefault())) {
|
||||
title = application.getTitle().getValue(Locale.getDefault());
|
||||
} else {
|
||||
title = application.getPrimaryUrl();
|
||||
}
|
||||
|
||||
return title;
|
||||
// final String title;
|
||||
// if (application.getTitle().hasValue(globalizationHelper
|
||||
// .getNegotiatedLocale())) {
|
||||
// title = application.getTitle().getValue(globalizationHelper
|
||||
// .getNegotiatedLocale());
|
||||
// } else if (application.getTitle().hasValue(defaultLocale)) {
|
||||
// title = application.getTitle().getValue(defaultLocale);
|
||||
// } else if (application.getTitle().hasValue(Locale.getDefault())) {
|
||||
// title = application.getTitle().getValue(Locale.getDefault());
|
||||
// } else {
|
||||
// title = application.getPrimaryUrl();
|
||||
// }
|
||||
// return title;
|
||||
return util.getTitle(application);
|
||||
}
|
||||
|
||||
public CcmApplication getApplication() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (C) 2020 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.api;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.ws.rs.container.ContainerRequestContext;
|
||||
import javax.ws.rs.container.ContainerResponseContext;
|
||||
import javax.ws.rs.container.ContainerResponseFilter;
|
||||
|
||||
/**
|
||||
* A JAX-RS filter adding HTTP headers required for CORS.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class CorsFilter implements ContainerResponseFilter {
|
||||
|
||||
@Override
|
||||
public void filter(
|
||||
final ContainerRequestContext requestContext,
|
||||
final ContainerResponseContext responseContext)
|
||||
throws IOException {
|
||||
if (!requestContext.getMethod().equals("OPTIONS")) {
|
||||
responseContext.getHeaders().add("Access-Control-Allow-Origin", "*");
|
||||
responseContext.getHeaders().add(
|
||||
"Access-Control-Allow-Headers", "Authorization, Content-Type"
|
||||
);
|
||||
responseContext.getHeaders().add(
|
||||
"Access-Control-Allow-Methods",
|
||||
"DELETE, HEAD, GET, OPTIONS, POST, PUT"
|
||||
);
|
||||
responseContext.getHeaders().add("Access-Control-Max-Age", "86400");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (C) 2020 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.api;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.ext.WriterInterceptor;
|
||||
import javax.ws.rs.ext.WriterInterceptorContext;
|
||||
|
||||
/**
|
||||
* Add some headers to every response.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class DefaultResponseHeaders implements WriterInterceptor {
|
||||
|
||||
@Override
|
||||
public void aroundWriteTo(WriterInterceptorContext context)
|
||||
throws IOException, WebApplicationException {
|
||||
context
|
||||
.getHeaders()
|
||||
.add("Access-Control-Allow-Origin", "*");
|
||||
context.proceed();
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue