Hi,
A customer has modified the Hippo CMS to support major/minor versioning of
documents:
- saving a draft creates a minor version, eg. 0.1, 0.2, 0.3, 0.n
- publishing creates a major version, e.g. 1.0, 2.0, 3.0, n.0
Could this be merged with Hippo CMS trunk? I think it would be useful for all
users. WDOT?
It's currently implemented by modifying hippo-cms-core to use a string rather
than an integer for the version number, and then modifying
src/site/actions/actions.js to use strings instead of integers:
src/java/nl/hippo/cms/contentmodel/Document.java
< public void replaceWithVersion(int version) throws ContentModelException;
---
> public void replaceWithVersion(String version) throws
> ContentModelException;
src/java/nl/hippo/cms/contentmodel/WebdavDocument.java
451d450
< int version = 1;
453,457c452,464
< if (latestVersion != "")
< {
< // document has previous versions
< version = Integer.parseInt(latestVersion) + 1;
< }
---
>
> int pos = latestVersion.indexOf('.');
>
> int l = latestVersion.length();
>
> int minor =
> Integer.parseInt(latestVersion.substring(++pos, l));
>
> int major = Integer.parseInt(latestVersion.substring(0,
> --pos));
>
> minor++;
>
> latestVersion = (""+major+"."+minor);
>
470,473d476
< else{
< // direct cache clearing
< WebdavRepository.fireEvent(emanager,uri);
< }
476c479
< Object status2 = WebDAVHelper.put(baseUri + resourceId +
"/" + version + resourceExtension, input, this.httpState);
---
> Object status2 = WebDAVHelper.put(baseUri + resourceId +
> "/" + latestVersion + resourceExtension, input, this.httpState);
508c511
< Object status3 = WebDAVHelper.proppatch(baseUri +
resourceId + "/" + version + resourceExtension, propSet, null, this.httpState);
---
> Object status3 = WebDAVHelper.proppatch(baseUri +
> resourceId + "/" + latestVersion + resourceExtension, propSet, null,
> this.httpState);
513,514c516
< this.setProperty("latestVersion", ""+version);
<
---
> this.setProperty("latestVersion", ""+latestVersion);
531c533
< public void replaceWithVersion(int version) throws ContentModelException
---
> public void replaceWithVersion(String version) throws
> ContentModelException
editor/src/site/actions/flow/actions.js:
< var version = Integer.parseInt(versionAsString);
---
> var version = versionAsString;
Thanks,
Andrew.
--
Andrew Savory
Tel: +44 (0)870 741 6658 Fax: +44 (0)700 598 1135
Sourcesense - making sense of Open Source: http://www.sourcesense.com
********************************************
Hippocms-dev: Hippo CMS development public mailinglist