Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

nuBuilder4-cloner

Questions related to using nuBuilder Forte.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

nuBuilder4-cloner

Unread post by kev1n »

Hi guys,

Here comes the "nuBuilder cloner".

It allows you to clone a nuBuilder Form with all its objects, events etc.

Features:

* Clone/Duplicate Forms with all PHP events, select, select clause, browse, tabs etc.
* Clone Objects with their events etc.
* Include only certain form tabs
* Copy objects to a new or existing form
* Dump the SQL INSERT statements to the browser window instead of executing them


Some Use cases:

* Clone a form to test changes before they are integrated into the productive system
* Export a form from one database and import it into another one
* You created a form and want to duplicate it because you need a similar form (Instead of recreating it from scratch)
* You want to copy a bunch of controls from one form to another
* You want other users than globeadmin (e.g. supervisors/managers) to manage the nuBuilder users. Clone nuBuilder's user form, customize it and give access to any users.

https://github.com/smalos/nuBuilder4-cloner
Last edited by kev1n on Thu Oct 29, 2020 10:53 pm, edited 3 times in total.
nc07
Posts: 118
Joined: Tue Jun 04, 2019 4:05 am
Has thanked: 5 times
Been thanked: 22 times

Re: nuBuilder4-cloner

Unread post by nc07 »

Thanks, Ke1vin for your hard work and time, the nubuilder4 cloner would really save time now as we don't have to recreate the forms from the scratch. I have tested it and it works like charm.
Cheers
nc07
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: nuBuilder4-cloner

Unread post by Janusz »

To confirm - I tested it as well - and works very well. It's really helpful tool. Thanks kev1n.
If you like nuBuilder, please leave a review on SourceForge
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: nuBuilder4-cloner

Unread post by kev1n »

Thank you for your kind words, I truly appreciate it!

Any other comments/suggesions? (Especially from the nuBuilder specialists)

BTW, there has been an update:
* Fix cloner_tabs: Include only those specified with nuSetProperty()
* Added: cloneFormSelect(), cloneFormSelectClause() to clone a form's select and select clause.
* Added: If the Hash Cookie #cloner_open_new_form# is set to '0', the new form is not displayed
* Changed : If the Hash Cookie #cloner_without_objects# is set to '1', the objects on the form are not cloned
nac
Posts: 115
Joined: Tue Dec 12, 2017 11:28 pm
Location: Aberdeen, UK
Has thanked: 9 times
Been thanked: 12 times

Re: nuBuilder4-cloner

Unread post by nac »

Hello kev1n,

As others have said, this works really well and is a very welcome addition. Thanks for your efforts on this.

One suggestion - as it works by building a series of SQL INSERT statements, why not have an option that directs these to a .SQL text (dump) file rather than executing them in the current database? This would then allow the user to create a simple export file to copy a form and all its components to a different nuBuilder instance. I can see that you are using prepared statements with parameters in function insertRecord and so adding an option to create the equivalent insert statement with literals should be quite straightforward (I think!).

Even in the same database, it can sometimes be faster to dump some of the zzzz* records as a set of SQL statements, edit values and then re-import - if you know what you are doing.

Thanks again.

Neil
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: nuBuilder4-cloner

Unread post by kev1n »

Hi Neil,

Thanks for your feedback! Actually that's an excellent idea. I had actually started another project ("nuBuilder Exporter") that does just that.
However, I was not yet able to finish it completely. I'll see what can be done.
nac
Posts: 115
Joined: Tue Dec 12, 2017 11:28 pm
Location: Aberdeen, UK
Has thanked: 9 times
Been thanked: 12 times

Re: nuBuilder4-cloner

Unread post by nac »

You are very welcome, kev1n . I have been doing a bit more work with nuBuilder recently and have found a number of your code snippets to be very useful. Thanks once again.
It strikes me that you have already done the heavy lifting for a form exporter with the cloning code. It could easily be adapted for other objects as well.

Neil

PS I followed the Discord link in your signature but the invitation is not valid. I have never used Discord and so there may be something else going wrong.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: nuBuilder4-cloner

Unread post by kev1n »

Neil,

I updated the discord link. I hope it works now.

And...

I also updated the cloner. It's now possible to dump the SQL statements instead of executing them.

Code: Select all

nuSetProperty('cloner_dump_statements','1');
nuSetProperty('cloner_without_objects', "0");
nuSetProperty('cloner_tabs','');
nuSetProperty('cloner_f1','');
nuSetProperty('cloner_f2','');
nuRunPHP('cloner', '',1);
Note: Instead of nuRunPHPHidden() use nuRunPHP(). This allows us to output the statements in a new browser tab.
sql_dump.png
You do not have the required permissions to view the files attached to this post.
nac
Posts: 115
Joined: Tue Dec 12, 2017 11:28 pm
Location: Aberdeen, UK
Has thanked: 9 times
Been thanked: 12 times

Re: nuBuilder4-cloner

Unread post by nac »

Hi kev1n,

I have been doing a few tests using version 1.07 (https://github.com/smalos/nuBuilder4-cl ... cloner.php) and it looks good. As you mentioned, the hash cookie flag is now the shorter '#cloner_dump#' (rather than the earlier '#cloner_dump_statements#') . The JS code ..

Code: Select all

nuSetProperty('cloner_dump','1');
nuSetProperty('cloner_without_objects', '0');
nuSetProperty('cloner_tabs','');
nuSetProperty('cloner_f1','');
nuSetProperty('cloner_f2','');
nuRunPHP('cloner', '',1);
.. generates all the SQL statements to create the complete form.

Great job.

Neil
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: nuBuilder4-cloner

Unread post by kev1n »

Thanks Neil for testing (and your inputs) !
Post Reply