[Solved] Writer+CMS for approval cycle w/ tracking changes

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
mamkiks
Posts: 17
Joined: Sun Mar 25, 2018 1:00 pm

[Solved] Writer+CMS for approval cycle w/ tracking changes

Post by mamkiks »

I need a way to use open office in "CMS" there are many user can access it and making changes in the document I want to record their changes by their names that stored in a database so I want to make method like login form in the beginning of the document

Ex:
I create Document on my machine You - as approver - try to open it to make some changes, Login form appear you enter "Mike" the records saved as "Mike" insert "abc"

another one login as "JOHN" record "JOHN" insert "xyz"
Last edited by mamkiks on Tue Apr 03, 2018 4:27 pm, edited 1 time in total.
OpenOffice 4.1.5 on Windows 10
User avatar
Lupp
Volunteer
Posts: 3548
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Writer with CMS to make approval cycle with tracking cha

Post by Lupp »

OpenOffice 'Wiriter' comes with a built-in change tracking system. See https://wiki.openoffice.org/wiki/Docume ... a_document.

Beyond that you would need to write a "minimally complete" CMS yourself. I would expect that to be complicated, inefficient, and unreliable - in specific if based on ordinary macro programming. The original question would be where the "macros" reside. Would you consider to use another document (spreadsheets e.g.) to act as a kind of CMS server? ...

There are CMS after all.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
mamkiks
Posts: 17
Joined: Sun Mar 25, 2018 1:00 pm

Re: Writer with CMS to make approval cycle with tracking cha

Post by mamkiks »

Lupp wrote:OpenOffice 'Wiriter' comes with a built-in change tracking system. See https://wiki.openoffice.org/wiki/Docume ... a_document.

Beyond that you would need to write a "minimally complete" CMS yourself. I would expect that to be complicated, inefficient, and unreliable - in specific if based on ordinary macro programming. The original question would be where the "macros" reside. Would you consider to use another document (spreadsheets e.g.) to act as a kind of CMS server? ...

There are CMS after all.
I need the result to be as the image below
But the way to change who made changes before making it
go to Tools>> Options>> UserData and change First and lastName

I need to Hide the toolbar to disable changing the username by this way above
And I've already made that by macros

now I need to change this data using macros or any method
that enable to enter the username in inputbox then when i make changes >> the changes will record by username that entered in inputbox
Screenshot_from_2018_04_02_13_18_05.png
OpenOffice 4.1.5 on Windows 10
JeJe
Volunteer
Posts: 2779
Joined: Wed Mar 09, 2016 2:40 pm

Re: Writer with CMS to make approval cycle with tracking cha

Post by JeJe »

This code will change the user name. You just need to add the Input Box or a dialog for the user to input their name.

I got the code to access/verify the change here - you might find this a helpful thread to look at.

viewtopic.php?f=20&t=14750&start=0&st=0 ... onprovider

Code: Select all


sub main
	ChangeUserName("Sally","S")
	test_UserProfileData
end sub

Sub ChangeUserName(givenname as string,initial)

	Dim oCP, oCUA

	Const sNodePath$ = "/org.openoffice.UserProfile/Data"
	Dim aProps(0) As New com.sun.star.beans.PropertyValue

	oCP = CreateUnoService("com.sun.star.configuration.ConfigurationProvider" )
	aProps(0).Name = "nodepath"
	aProps(0).Value = sNodePath
	oCUA = oCP.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aProps )

	oCUA.givenname = givenname
	oCUA.initials = initial
	oCUA.commitChanges()

End Sub

'below code posted by Villeroy at
'https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=14750&start=0&st=0&sk=t&sd=a&hilit=configurationprovider

Sub test_UserProfileData() As String
REM look at file <<OOo-Profile/3/user/registry/data>> /org/openoffice/UserProfile.xcu, XML-node "Data":
	Const sNodePath$ = "/org.openoffice.UserProfile/Data"

	oNode = getOOoSetupNode(sNodePath$)
	snval = oNode.getByName("sn")
	gnval = oNode.getByName("givenname")
	ival = oNode.getByName("initials")


	print gnval,snval,ival
End Sub

Function getOOoSetupNode(sNodePath$)
	Dim aConfigProvider, oNode, args(0) As new com.sun.star.beans.PropertyValue
	aConfigProvider = createUnoService("com.sun.star.configuration.ConfigurationProvider")
	args(0).Name = "nodepath"
	args(0).Value = sNodePath
	getOOoSetupNode = aConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", args())

End Function

Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
mamkiks
Posts: 17
Joined: Sun Mar 25, 2018 1:00 pm

Re: Writer with CMS to make approval cycle with tracking cha

Post by mamkiks »

JeJe wrote:This code will change the user name. You just need to add the Input Box or a dialog for the user to input their name.

I got the code to access/verify the change here - you might find this a helpful thread to look at.

viewtopic.php?f=20&t=14750&start=0&st=0 ... onprovider

Code: Select all


sub main
	ChangeUserName("Sally","S")
	test_UserProfileData
end sub

Sub ChangeUserName(givenname as string,initial)

	Dim oCP, oCUA

	Const sNodePath$ = "/org.openoffice.UserProfile/Data"
	Dim aProps(0) As New com.sun.star.beans.PropertyValue

	oCP = CreateUnoService("com.sun.star.configuration.ConfigurationProvider" )
	aProps(0).Name = "nodepath"
	aProps(0).Value = sNodePath
	oCUA = oCP.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aProps )

	oCUA.givenname = givenname
	oCUA.initials = initial
	oCUA.commitChanges()

End Sub

'below code posted by Villeroy at
'https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=14750&start=0&st=0&sk=t&sd=a&hilit=configurationprovider

Sub test_UserProfileData() As String
REM look at file <<OOo-Profile/3/user/registry/data>> /org/openoffice/UserProfile.xcu, XML-node "Data":
	Const sNodePath$ = "/org.openoffice.UserProfile/Data"

	oNode = getOOoSetupNode(sNodePath$)
	snval = oNode.getByName("sn")
	gnval = oNode.getByName("givenname")
	ival = oNode.getByName("initials")


	print gnval,snval,ival
End Sub

Function getOOoSetupNode(sNodePath$)
	Dim aConfigProvider, oNode, args(0) As new com.sun.star.beans.PropertyValue
	aConfigProvider = createUnoService("com.sun.star.configuration.ConfigurationProvider")
	args(0).Name = "nodepath"
	args(0).Value = sNodePath
	getOOoSetupNode = aConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", args())

End Function

It works, Thanks Dude
OpenOffice 4.1.5 on Windows 10
Post Reply