Page 1 of 2

TimeStamp Backup

Posted: Sun Jan 01, 2017 5:29 pm
by Zizi64
This extension created for the LibreOffice and OpenOffice enables the
user to make normal Save and to create a TimeStamped Backup copy of the
actual document at once.
The archiv file with a time stamped filename will placed into the
Backup directory given in the
Tools - Options - Open/LibreOffice - Paths
It is better to adjust the path of the Backup directory to a user
friendly place.

The extension has a menu item in the File menu, and a toolbar icon
in the Standard toolbar, and it works in the applications listed below:
Writer, WriterWeb, WriterMaster; Calc, Draw, Impress, Math applications.

You can download the latest (timeStampBackup_v1-1-8.oxt) version of this extension for LibreOffice
and for OpenOffice from these pages (updated):
https://extensions.libreoffice.org/exte ... amp-backup
http://flowcont.hu/LO_oxt_store/

This extension licenced under the GPL v3 licence.
timeStampBackup_v1-1-2.oxt
(53.59 KiB) Downloaded 1044 times
 Edit: (There is a newer version on the extension site...)
See the latest version on the linked pages above or below in this topic. 

Re: TimeStamp Backup

Posted: Sun Jan 01, 2017 5:56 pm
by charlie.it
Ciao Zizi64, it's your job? My compliments to you.
I report a problem: you must have first saved the file normally?
Schermata 01-2457755 alle 16.51.49.png
Then, it does not exist for Base?

Re: TimeStamp Backup

Posted: Sun Jan 01, 2017 6:33 pm
by Zizi64
Thank you.
Yes, it is my job, but it is based on the structure of the extension MultiSave:
http://extensions.openoffice.org/en/project/multisave
and the extension MultiFormatSave:
http://extensions.openoffice.org/en/pro ... formatsave

And yes: you must save a new document first when you use this version of the extension. The extension works with documents that have URL.

The extension localised for three languages only: HU, EN, and DE
Sorry for my poor english, (and sorry for the german translation of the Google Translator;-) )
If you can fix (grammatically) my english and german (deutch) strings inside the extension, or if you can make the italian (and other language) strings, please help me.

I never used the Base application, therefere I have not created icons for the Base. But I suppose the StarBasic/API code can work with the Base too...
I will try to insert menu item and toolbar icon for the Base.

Re: TimeStamp Backup

Posted: Sun Jan 01, 2017 6:39 pm
by charlie.it
Some time ago I reported that this extension, also works with Base: viewtopic.php?f=47&t=77024.

Re: TimeStamp Backup

Posted: Sun Jan 01, 2017 6:50 pm
by charlie.it
Ciao, here is the original extension in French and the translated extension in Italian (this one works with AOO. With LO it works, but there are not the icon in the bar):
Edit: Also here you must save a new document first when you use this version of the extension

Re: TimeStamp Backup

Posted: Sun Jan 01, 2017 7:04 pm
by Zizi64
I have published a version of my code in this forum in year 2015 (but it was created some years before):
viewtopic.php?f=106&t=78912&p=362314&hi ... y+#p362314
It is my first extension what i created. We used the code with manually associating to the menu items before. But my collegues have not experience in the associating procedure of the macro codes to a menu item or to a toolbar icon, therefore I tried to create an "easy to install" extension based on the code.

Unfortunatelly, I never found your extension on the non-english, non-hungarian web pages...)

As I see now your code is much larger than mine. Have your code some other functionalities?

Re: TimeStamp Backup

Posted: Sun Jan 01, 2017 7:16 pm
by charlie.it
The code in not mine, I have only traslate the text from French (with Google :oops: ). Than a volunteer/user in Italian forum has compiled it.
In the menu it allows you to make some settings, like choose the backup folder.
But yours is a great work too :super: :bravo: .

Re: TimeStamp Backup

Posted: Sun Jan 01, 2017 7:29 pm
by Zizi64
It would be nice if we had a similar feature embedded in the AOO/LO software package.

Re: TimeStamp Backup

Posted: Sun Jan 01, 2017 7:58 pm
by charlie.it
But then we would not know what to do ...

Re: TimeStamp Backup

Posted: Tue Jan 03, 2017 12:48 pm
by Zizi64
The version 1.1.4 contains HU, EN, DE, IT, ES, RU localisation. (The Google translator helped me. :oops: )

You can download the recent version from this webpage:
http://flowcont.hu/LO_oxt_store/

And I uploaded it here:
timeStampBackup_v1-1-4.oxt
(93.58 KiB) Downloaded 791 times

Re: TimeStamp Backup

Posted: Tue Jan 03, 2017 1:06 pm
by charlie.it
Great! :bravo:
(Now we expect integration with Base ;) )

Re: TimeStamp Backup

Posted: Tue Jan 03, 2017 1:54 pm
by Zizi64
I tried to integrate my extension to the Basic IDE. The icon, and the menu iten is appeared on the UI of the IDE, but - unfortunately - my code can NOT archive the Basic code of the active Module, or the active Directory. It can save the active (Calc, Writer, etc...) document only.
(I will examine the code of the extension linked by you for some "ideas"...)

I suppose it: the Base integration will cause some Problems for me.

Re: TimeStamp Backup

Posted: Fri Jun 16, 2017 10:21 pm
by john1320
Very useful. Why not add this extension to extensions.openoffice.org or post it on GitHub? )

Re: TimeStamp Backup

Posted: Sun Jun 18, 2017 2:04 pm
by Zizi64
My son (Kovács Levente) has uploaded the project onto GIThub:

https://github.com/kovleventer/timeStampBackup

Re: TimeStamp Backup

Posted: Tue Jun 20, 2017 10:17 am
by hubert lambert
Hello Tibor,

Thank you for this extension, that I just discover yesterday.
I've translated it to french. Hope all is fine.
In addition, I think there is no need anymore to reference the description files in the manifest, if you want to trim it a little ;).
Regards,
HL
 Edit: It seems to work fine with Base, provided that the BaseWindowState.xcu file is included and the module identifier com.sun.star.sdb.DatabaseDocument added in the mergecontext entries of Addons.xcu file. 
 Edit: Nope, sorry: this works on LibreOffice only. 

Re: TimeStamp Backup

Posted: Tue Jun 20, 2017 12:45 pm
by hubert lambert
Finally I found a solution to make your extension available from within Base.
There was two pitfalls :
- the identifier of the module is com.sun.star.sdb.OfficeDatabaseDocument instead of com.sun.star.sdb.DatabaseDocument
- there's no standardbar in Base, only a toolbar.
Hope this works this time.

Re: TimeStamp Backup

Posted: Tue Jun 20, 2017 12:46 pm
by Villeroy
I think it can not work with embedded Base. When you save a copy of the document only, the currently edited database will not be included. The database is written back into the document when the last reference is closed. Any kind of grid view, form, query keeps a reference, may be reports, import ranges, pivot tables too.

Re: TimeStamp Backup

Posted: Tue Jun 20, 2017 5:55 pm
by hubert lambert
The new save option is only available in the main base window, not in the subcomponents. Thus it should be safe.
On the other hand, the global variable ThisComponent seems to be sometimes inconsistent with Base. Maybe would it be better to use instead StarDesktop.CurrentComponent ?
Zizi64 wrote:And yes: you must save a new document first when you use this version of the extension. The extension works with documents that have URL.
One way to avoid this problem could be to use the uno:Save dispatch command (that will pop-up the save file picker if the document has no location):

Code: Select all

	[...]
	oDoc = ThisComponent
	' save
	oFrame = oDoc.CurrentController.Frame
	oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
	oDispatcher.executeDispatch(oFrame, ".uno:Save", "", 0, Array())
	' backup
	sDocURL = oDoc.getURL()
	sBackupURL = CreateUnoService("com.sun.star.util.PathSettings").Backup & "/" & _
	GetFileNameWithoutExtension(sDocURL, "/") & _
	sTimeStamp() & "." & _
	GetFileNameExtension(sDocURL, "/")		
	oDoc.storeToURL(sBackupURL, array()) 
But first of all, thanks to Zizi64 for this extension!

Re: TimeStamp Backup

Posted: Sun Jun 25, 2017 6:50 pm
by Kovlev
The added French localization and Base support now forms the newest (1.1.5) version of TimeStampBackup (thanks for those contributions, I tried to give proper credit in git commit messages). The displayed file saving dialog on pathless files is not yet included, as it's inclusion is still in consideration.
So the new version can be obtained either from github, FlowCont .oxt store (links were posted above), and additionally, this attachment below.
 Edit: Thanks for approval! 

Re: TimeStamp Backup

Posted: Sun Jun 25, 2017 9:06 pm
by Zizi64
My son, Levente (Kovlev - memberlist.php?mode=viewprofile&u=62579) has updated the code on the github, and the directly downloadable .oxt file on the original place based on your ideas and code snippets:
http://www.flowcont.hu/LO_oxt_store/oxt ... v1-1-5.oxt

The 1.1.5 version of the extension contains the french language support and a limited support for Base. Special thanks to Hubert Lambert.

Unfortunatelly my son can not post into this forum. There is some problem with his authorization in this forum with his registration.
 Edit: He can post now. Thanks to thomasjk 

Re: TimeStamp Backup

Posted: Sun Jun 25, 2017 9:28 pm
by thomasjk
Zizi64. I just approved your son's post under Kovlev. Its now part of the discussion. All new users first post are reviewed and approved by a moderator to avoid spammers.

Re: TimeStamp Backup

Posted: Fri Jan 05, 2018 9:41 am
by Zizi64
Version 1.1.6: NL localisation added.


http://www.flowcont.hu/LO_oxt_store/oxt ... v1-1-6.oxt

Re: TimeStamp Backup

Posted: Mon Apr 02, 2018 6:51 pm
by GerhardW
Hi zizi64, kovlev,

here are better german and english texts:

Code: Select all

MsgBox("The document does not yet have a URL (no valid file name and / or path) ." & Chr(10) & "The document will not be archived. Save your document first.",16,"Attention:")

MsgBox("Das Dokument hat noch keine URL (keinen gültigen Dateinamen und Pfad)." & Chr(10) & "Das Dokument wird nicht archiviert. Speichern Sie zuerst das Dokument.",16,"Achtung:")
But I suggest you consider the proposiion by Hubert Lambert. It has the great advantage that you do not need any language-dependent text, then.
Simply save the document using the dispatcher call if it has no URL or with stor, if it has one, saving the timstamp copy is then identical for both cases. Here is the code:

Code: Select all

	If oDoc.hasLocation() then
		oDoc.store()
	  else
		document   = ThisComponent.CurrentController.Frame
		dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
		dispatcher.executeDispatch(document, ".uno:Save", "", 0, Array())
	end if
	sDocURL = oDoc.getURL()
	sBackupURL = CreateUnoService("com.sun.star.util.PathSettings").Backup & "/" & _
	GetFileNameWithoutExtension(sDocURL, "/") & _
	sTimeStamp() & "." & _
	GetFileNameExtension(sDocURL, "/")		
	oDoc.storeToURL(sBackupURL, array()) 
You also have to add the decaration:

Code: Select all

dim dispatcher as object, document as object
Gerhard

Re: TimeStamp Backup

Posted: Tue Apr 03, 2018 9:01 pm
by Kovlev
Hi

About the texts, those translations were updated recently by swhib on github (https://github.com/kovleventer/timeStampBackup/pull/4), which did include the pkg descriptions as well. (Just in case if you have planned to update those.)

The file saving dialog threw an error message when the user cancelled the initial file save dialog. With that fixed (a simple 'if' check to see if the document still not has a location) I see no reason not to include this patch. This new version is available now at http://flowcont.hu/LO_oxt_store/, github, and the newly created LO extensions page: https://extensions.libreoffice.org/exte ... amp-backup

Re: TimeStamp Backup

Posted: Thu Apr 05, 2018 12:26 am
by GerhardW
Hi kovlev,

I simply don't understand what the link https://github.com/kovleventer/timeStampBackup/pull/4 means. None of the entries does tell me anything.
I proposed a better german and english translation and a code (not my invention) that will make a translations unnecessary. Take it or leave it!
I will use your - or your father's - code with my changes, thanks for that.
I am working with LibreOffice, so perhaps this will be my last post here.

Gerhard

Re: TimeStamp Backup

Posted: Thu Apr 05, 2018 12:39 am
by Kovlev
Hi

Those entries are edited files with translations from another guy. But this is irrelevant in this case, since I did accept your proposed code (thanks for you and hubert lambert). With this update the current version number is 1.1.8, and this version does contain your edit (in case you don't want to modify the code everytime you reinstall this extension, you can use that).

Re: TimeStamp Backup

Posted: Sun Jul 05, 2020 12:25 am
by Zizi64
Improving the TimeStamp Backup extension:

"Manage Backup files"

My recent plan: these features will be embedded into the timeStampBackup extension v.2.0.0 v.1.2.0. Please help me at the translations of labels, and titles. Please fix my mistakes (and the mistakes of the Google translator)

- "Open a Backup file" feature: you will able to filter/select/open one backup file
- "Delete" feature: (filter, select and delete one or more backup files)
- Custom date/time based filters for selecting the relevant backup files
- en-EN, hu-HU, de-DE, it-IT, es-ES, ru-RU, fr-FR localized labels (see them in the macro code). If you want (and if you can) help me, then please send back the modified, fixed strings to me.

Here is the localization part of my code:

Code: Select all

Option explicit


'Localization

Function GetPickerTitle(sLocal as string) as string
 Dim sResult as string
	Select Case sLocal
		Case "en-EN": sResult = "Manage Backup files"
		Case "hu-HU": sResult = "Biztonségi mentések kezelése"
		Case "de-DE": sResult = "Backup-Dateien verwalten"
		Case "it-IT": sResult = "Gestisci i file di backup"
		Case "es-ES": sResult = "Administrar archivos de copia de seguridad"
		Case "ru-RU": sResult = "Управление резервными файлами"
		Case "fr-FR": sResult = "Gérer les fichiers de sauvegarde"
		Case else: sResult = "Manage Backup files"
	End Select
GetPickerTitle = sResult
End function


Function GetDelButtonLabel(sLocal as string) as string
 Dim sResult as string
	Select Case sLocal
		Case "en-EN": sResult = "Delete"
		Case "hu-HU": sResult = "Törlés"
		Case "de-DE": sResult = "Löschen"
		Case "it-IT": sResult = "Elimina"
		Case "es-ES": sResult = "Borrar"
		Case "ru-RU": sResult = "Удалить"
		Case "fr-FR": sResult = "Supprimez"
		Case else: sResult = "Delete"
	End Select
GetDelButtonLabel = sResult
End function


Function GetLoadButtonLabel(sLocal as string) as string
 Dim sResult as string
	Select Case sLocal
		Case "en-EN": sResult = "Open"
		Case "hu-HU": sResult = "Megnyitás"
		Case "de-DE": sResult = "Öffnen"
		Case "it-IT": sResult = "Aperto"
		Case "es-ES": sResult = "Abierto"
		Case "ru-RU": sResult = "Открыть"
		Case "fr-FR": sResult = "Ouvrir"
		Case else: sResult = "Open"
	End Select
GetLoadButtonLabel = sResult
End function


Function GetFilterItem(sLocal as string, iFilterItem as integer) as string
 Dim sResult as string
	Select Case sLocal
		Case "en-EN"
			Select Case iFilterItem
				Case 0: sResult = "All Backups of this document"
				Case 1: sResult = "Actual month's Backups of this document"
				Case 2: sResult = "Previous month's Backups of this document"
				Case 3: sResult = "Today's Backups of this document"
				Case 4: sResult = "Yesterday's Backups of this document"
				Case 5: sResult = "All of Backup files"
				Case 6: sResult = "Today's Backups of all documents"
				Case 7: sResult = "Yesterday's Backups of all documents"
			end Select
		Case "hu-HU"
			Select Case iFilterItem
				Case 0: sResult = "Ennek a fájlnak a mentései"
				Case 1: sResult = "Ennek a fájlnak az e havi mentései"
				Case 2: sResult = "Ennek a fájlnak az előző havi mentései"
				Case 3: sResult = "Ennek a fájlnak a mai mentései"
				Case 4: sResult = "Ennek a fájlnak a tegnapi mentései"
				Case 5: sResult = "Az összes mentett fájl"
				Case 6: sResult = "A mai összes mentett fájl"
				Case 7: sResult = "A tegnapi összes mentett fájl"
			end Select
		Case "de-DE"
			Select Case iFilterItem
				Case 0: sResult = "Alle Backups dieses Dokuments"
				Case 1: sResult = "Aktuelle Monats-Backups dieses Dokuments"
				Case 2: sResult = "Backups dieses Dokuments vom Vormonat"
				Case 3: sResult = "Die heutigen Backups dieses Dokuments"
				Case 4: sResult = "Die gestrigen Backups dieses Dokuments"
				Case 5: sResult = "Alle Sicherungsdateien"
				Case 6: sResult = "Heutige Backups aller Dokumente"
				Case 7: sResult = "Gestern Backups aller Dokumente"
			end Select
		Case "it-IT"
			Select Case iFilterItem
				Case 0: sResult = "Tutti i backup di questo documento"
				Case 1: sResult = "Backup del mese effettivo di questo documento"
				Case 2: sResult = "Backup del mese precedente di questo documento"
				Case 3: sResult = "I backup di oggi di questo documento"
				Case 4: sResult = "I backup di ieri di questo documento"
				Case 5: sResult = "Tutti i file di backup"
				Case 6: sResult = "I backup di oggi di tutti i documenti"
				Case 7: sResult = "I backup di ieri di tutti i documenti"
			end Select
		Case "es-ES"
			Select Case iFilterItem
				Case 0: sResult = "Todas las copias de seguridad de este documento"
				Case 1: sResult = "Copias de seguridad del mes real de este documento"
				Case 2: sResult = "Copias de seguridad de este documento del mes anterior"
				Case 3: sResult = "Copias de seguridad de hoy de este documento"
				Case 4: sResult = "Copias de seguridad de ayer de este documento"
				Case 5: sResult = "Todos los archivos de respaldo"
				Case 6: sResult = "Copias de seguridad de todos los documentos de hoy"
				Case 7: sResult = "Copias de seguridad de todos los documentos de ayer"
			end Select
		Case "ru-RU"
			Select Case iFilterItem
				Case 0: sResult = "Все резервные копии этого документа"
				Case 1: sResult = "Фактические резервные копии этого документа за месяц"
				Case 2: sResult = "Резервные копии этого документа за предыдущий месяц"
				Case 3: sResult = "Сегодняшние резервные копии этого документа"
				Case 4: sResult = "Вчерашние резервные копии этого документа"
				Case 5: sResult = "Все файлы резервных копий"
				Case 6: sResult = "Сегодняшние резервные копии всех документов"
				Case 7: sResult = "Вчерашние резервные копии всех документов"
			end Select
		Case "fr-FR"
			Select Case iFilterItem
				Case 0: sResult = "Toutes les sauvegardes de ce document"
				Case 1: sResult = "Sauvegardes du mois réel de ce document"
				Case 2: sResult = "Sauvegardes du mois précédent de ce document"
				Case 3: sResult = "Sauvegardes d'aujourd'hui de ce document"
				Case 4: sResult = "Sauvegardes d'hier de ce document"
				Case 5: sResult = "Tous les fichiers de sauvegarde"
				Case 6: sResult = "Sauvegardes d'aujourd'hui de tous les documents"
				Case 7: sResult = "Sauvegardes d'hier de tous les documents"
			end Select
		Case else
			Select Case iFilterItem
				Case 0: sResult = "All Backups of this document"
				Case 1: sResult = "Actual month's Backups of this document"
				Case 2: sResult = "Previous month's Backups of this document"
				Case 3: sResult = "Today's Backups of this document"
				Case 4: sResult = "Yesterday's Backups of this document"
				Case 5: sResult = "All of Backup files"
				Case 6: sResult = "Today's Backups of all documents"
				Case 7: sResult = "Yesterday's Backups of all documents"
			end Select
	End Select
GetFilterItem = sResult
End function


Function GetMsgBoxTitle(sLocal as string) as string
 Dim sResult as string
	Select Case sLocal
		Case "en-EN": sResult = "Confirmation request:"
		Case "hu-HU": sResult = "Megerősítés kérése:"
		Case "de-DE": sResult = "Bestätigungsanfrage:"
		Case "it-IT": sResult = "Richiesta di conferma:"
		Case "es-ES": sResult = "Solicitud de confirmación"
		Case "ru-RU": sResult = "Запрос подтверждения:"
		Case "fr-FR": sResult = "Demande de confirmation:"
		Case else: sResult = "Confirmation request:"
	End Select
GetMsgBoxTitle = sResult
End function


Function GetMessage(sLocal as string) as string
 Dim sResult as string
	Select Case sLocal
		Case "en-EN": sResult = "Are you sure you want to delete the following file?"
		Case "hu-HU": sResult = "Biztosan törölni kívánja az alábbi fájlt?"
		Case "de-DE": sResult = "Möchten Sie die folgende Datei wirklich löschen?"
		Case "it-IT": sResult = "Sei sicuro di voler eliminare il seguente file?"
		Case "es-ES": sResult = "¿Seguro que quieres borrar el siguiente archivo?"
		Case "ru-RU": sResult = "Вы действительно хотите удалить следующий файл?"
		Case "fr-FR": sResult = "Êtes-vous sûr de vouloir supprimer le fichier suivant?"
		Case else: sResult = "Are you sure you want to delete the following file?"
	End Select
GetMessage = sResult
End function
'_____________________________________________________________________________

Re: TimeStamp Backup

Posted: Sun Jul 05, 2020 11:09 am
by Hagar Delest
Quite good French translation. Some improvements. I've kept only the modified French lines and the "else" ones to retrieve the strings in the whole code.

Code: Select all

Function GetDelButtonLabel(sLocal as string) as string
		Case "fr-FR": sResult = "Supprimer"
		Case else: sResult = "Delete"
	End Select
GetDelButtonLabel = sResult
End function


Function GetFilterItem(sLocal as string, iFilterItem as integer) as string
		Case "fr-FR"
			Select Case iFilterItem
				Case 1: sResult = "Sauvegardes du mois en cours de ce document"
			end Select
		Case else
			Select Case iFilterItem
				Case 1: sResult = "Actual month's Backups of this document"
			end Select
	End Select
GetFilterItem = sResult
End function

Re: TimeStamp Backup

Posted: Sun Jul 05, 2020 2:28 pm
by Zizi64
Thank you, Hagar.

Re: TimeStamp Backup

Posted: Sun Jul 05, 2020 2:37 pm
by GerhardW
Only one correction for German:
Case 7: sResult = "Gestrige Backups aller Dokumente"

If you wish to use the same wording as in cases 3 a nd 4, you may switch to:
Case 6: sResult = "Die heutigen Backups aller Dokumente"
Case 7: sResult = "Die gestrigen Backups aller Dokumente"
but the present wording is no better or worse than this alternative.
Gerhard