nuBuilder4-cloner

Questions related to using nuBuilder Forte.

nuBuilder4-cloner

Postby kev1n » Sun Oct 25, 2020 5:09 pm

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 Fri Oct 30, 2020 7:23 am, edited 3 times in total.
If you like nuBuilder, please leave a review on SourceForge

nuBuilder Code Library (82)
Installation Guides
Updating nuBuilder

Join Discord to talk about nuBuilder!
kev1n
 
Posts: 1084
Joined: Mon Oct 15, 2018 2:13 am

Re: nuBuilder4-cloner

Postby nc07 » Mon Oct 26, 2020 10:24 am

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
nc07
 
Posts: 25
Joined: Tue Jun 04, 2019 11:35 am

Re: nuBuilder4-cloner

Postby Janusz » Mon Oct 26, 2020 7:48 pm

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
Janusz
 
Posts: 399
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland

Re: nuBuilder4-cloner

Postby kev1n » Wed Oct 28, 2020 4:47 pm

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
If you like nuBuilder, please leave a review on SourceForge

nuBuilder Code Library (82)
Installation Guides
Updating nuBuilder

Join Discord to talk about nuBuilder!
kev1n
 
Posts: 1084
Joined: Mon Oct 15, 2018 2:13 am

Re: nuBuilder4-cloner

Postby nac » Wed Oct 28, 2020 9:13 pm

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
nac
 
Posts: 57
Joined: Wed Dec 13, 2017 7:58 am
Location: Aberdeen, UK

Re: nuBuilder4-cloner

Postby kev1n » Wed Oct 28, 2020 11:08 pm

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.
If you like nuBuilder, please leave a review on SourceForge

nuBuilder Code Library (82)
Installation Guides
Updating nuBuilder

Join Discord to talk about nuBuilder!
kev1n
 
Posts: 1084
Joined: Mon Oct 15, 2018 2:13 am

Re: nuBuilder4-cloner

Postby nac » Wed Oct 28, 2020 11:29 pm

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.
nac
 
Posts: 57
Joined: Wed Dec 13, 2017 7:58 am
Location: Aberdeen, UK

Re: nuBuilder4-cloner

Postby kev1n » Thu Oct 29, 2020 12:35 am

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
sql_dump.png (48.98 KiB) Viewed 194 times
If you like nuBuilder, please leave a review on SourceForge

nuBuilder Code Library (82)
Installation Guides
Updating nuBuilder

Join Discord to talk about nuBuilder!
kev1n
 
Posts: 1084
Joined: Mon Oct 15, 2018 2:13 am

Re: nuBuilder4-cloner

Postby nac » Thu Oct 29, 2020 6:27 pm

Hi kev1n,

I have been doing a few tests using version 1.07 (https://github.com/smalos/nuBuilder4-cloner/blob/main/nubuilder_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
nac
 
Posts: 57
Joined: Wed Dec 13, 2017 7:58 am
Location: Aberdeen, UK

Re: nuBuilder4-cloner

Postby kev1n » Thu Oct 29, 2020 7:01 pm

Thanks Neil for testing (and your inputs) !
If you like nuBuilder, please leave a review on SourceForge

nuBuilder Code Library (82)
Installation Guides
Updating nuBuilder

Join Discord to talk about nuBuilder!
kev1n
 
Posts: 1084
Joined: Mon Oct 15, 2018 2:13 am

Next

Return to General



cron