Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Duplicating records?

 

 


blukabm
User

Aug 19, 2008, 12:20 PM

Post #1 of 16 (4264 views)
Shortcut
Duplicating records? Can't Post

I am curious if there is currently a way to duplicate a record. That way I could modify the copied record instead of creating a new one and re-entering data that won't change much.

Thanks!


Dave
Staff / Moderator


Aug 19, 2008, 9:43 PM

Post #2 of 16 (4249 views)
Shortcut
Re: [blukabm] Duplicating records? [In reply to] Can't Post

There's currently no automatic way to do that.

Another approach might be to set the default values for the fields in the field editor so when you create a new record it starts with those values.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com
 


blukabm
User

Aug 20, 2008, 5:46 AM

Post #3 of 16 (4241 views)
Shortcut
Re: [Dave] Duplicating records? [In reply to] Can't Post

Is that something that could be added through the custom programming option? If so, we may look into that.

Thanks!


Dave
Staff / Moderator


Aug 20, 2008, 6:11 PM

Post #4 of 16 (4220 views)
Shortcut
Re: [blukabm] Duplicating records? [In reply to] Can't Post

Hi blukabm,

It can (as we're discussing over email) - another option might be to try and find a bookmarklet tool that would let you save the form data and re-output it.

I did a google search for "copy form values bookmarklet"
http://www.google.com/search?q=copy+form+values+bookmarklet

and found this site:
http://www.benjaminkeen.com/software/bookmarklet_generator/

I don't know if that will do exactly what you need or not but I thought it might be worth a look.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com
 


Dave
Staff / Moderator


Aug 21, 2008, 1:41 PM

Post #5 of 16 (4209 views)
Shortcut
Re: [Dave] Duplicating records? [In reply to] Can't Post

Here's an (unsupported) hack I wrote up to add a "Save as Copy" button to the bottom left of the edit page.

It doesn't support uploads or all the field types but worked for this case. I'm posting in here in case it turns out to be useful for someone else as well.

- Create a backup copy of /lib/menus/default/edit.php
- Open /lib/menus/default/edit.php
- Search for showWysiwygGeneratorCode
- Add the code in red (about 15 lines above showWysiwygGeneratorCode)


Code
<table border="0" cellspacing="0" cellpadding="0" width="690"> 
<tr>
<td>
<input type="submit" name="action=save" value="<?php _e('Save as Copy') ?>"
onclick="document.getElementById('num').value=''; document.getElementById('preSaveTempId').value='1234567890abc'"
class="inputButton" />
</td>

<td align="right">
<input type="submit" name="action=save" value="<?php _e('Save') ?>" class="inputButton" />
<input type="button" name="cancel" value="<?php _e('Cancel') ?>" class="inputButton"
onclick="window.location='?menu=<?php print urlencode($menu) ?>'" />
</td>
</tr>
</table>
</form>

<?php showWysiwygGeneratorCode() ?>


Update: This version works for 2.00+ - search for _action=save


Code
 
<div style="float:right">

<input type="submit"
name="action=save"
value="<?php et('Save As Copy') ?>"
onclick="document.getElementById('num').value=''; document.getElementById('preSaveTempId').value='1234567890abc'"
class="button" />


<input class="button" type="submit" name="_action=save" value="<?php et('Save') ?>" />
<input class="button" type="button" name="cancel" value="<?php et('Cancel') ?>" onclick="window.location='?menu=<?php print urlencode($menu) ?>'" />
</div>


Dave Edis - Senior Developer
interactivetools.com
 

(This post was edited by Dave on Mar 18, 2010, 7:55 PM)


kevbarker
User

Aug 22, 2008, 5:38 PM

Post #6 of 16 (4178 views)
Shortcut
Re: [Dave] Duplicating records? [In reply to] Can't Post

Talk about perfect timing! I just had a client who asked for this capability so I tried this and it works great!

Thanks Dave!

Kevin


sublmnl
User

Feb 21, 2011, 8:15 PM

Post #7 of 16 (2853 views)
Shortcut
Re: [kevbarker] Duplicating records? [In reply to] Can't Post


Code
    <div style="float:right"> 
<input type="submit"
name="action=save"
value="<?php et('Save As Copy') ?>"
onclick="document.getElementById('num').value=''; document.getElementById('preSaveTempId').value='1234567890abc'"
class="button" />

<?php
$buttonsRight = '';
$buttonsRight .= "<input class='button' type='submit' name='_action=save' value='" .t('Save'). "' />\n";
if ($previewUrl) {
$buttonsRight .= "<input class='button' type='button' name='preview' value='" .t('Preview'). "' onclick=\"editPreview();\" />\n";
}
$buttonsRight .= "<input class='button' type='button' name='cancel' value='" .t('Cancel'). "' onclick=\"editCancel();\" />\n";
$buttonsRight = applyFilters('edit_buttonsRight', $buttonsRight, $tableName, $GLOBALS['RECORD']);
echo $buttonsRight;
?>
</div>


This kind of works.
Perhaps its the newer version of CMSB. I noticed that your code is a little different than the above which is what I have.
I have to make the image upload field not required in order to make a copy.
Dave can you update this?

THanks


(This post was edited by sublmnl on Feb 21, 2011, 8:16 PM)


Jason
Staff / Moderator


Feb 22, 2011, 11:33 AM

Post #8 of 16 (2812 views)
Shortcut
Re: [sublmnl] Duplicating records? [In reply to] Can't Post

Hi,

We have a user submitted plugin that creates the "Save & Copy" button and functionality for you:

http://www.interactivetools.com/add-ons/detail.php?Save-Copy-Button-1030

Hope this helps
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/ 


sublmnl
User

Feb 23, 2011, 7:01 PM

Post #9 of 16 (2800 views)
Shortcut
Re: [Jason] Duplicating records? [In reply to] Can't Post

Thanks Jason, and that looks familiar...
And I remember why I couldn't use it.
Until I found this post today.



thanks!


rjbathgate
User

Feb 23, 2011, 8:27 PM

Post #10 of 16 (2798 views)
Shortcut
Re: [sublmnl] Duplicating records? [In reply to] Can't Post

Would be great is this also added a "Duplicate" link in the list view, next to View | Modify | Erase

:)


Jason
Staff / Moderator


Feb 24, 2011, 9:11 AM

Post #11 of 16 (2788 views)
Shortcut
Re: [sublmnl] Duplicating records? [In reply to] Can't Post

Hi,

Is this working for you now? Let us know if you have any other questions.

Thanks
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/ 


sublmnl
User

Feb 26, 2011, 9:14 PM

Post #12 of 16 (2752 views)
Shortcut
Re: [Jason] Duplicating records? [In reply to] Can't Post

Jason, not sure if you are referring to me in the question, but yes the Save a Copy does work. Thankfully I found the plugin installation instructions. I've had that plugin for a bit just didn't know where to put it and forgot about it.

In order to copy a record - you have to completely fill out your record and save it and in order to actually COPY the record. So essentially you are closing it out and going back to the list page in the CMS, then you click modify on the desired record-to-be-copied, then click Save a Copy.
Or else some funky stuff happens.

Its not like when you are saving a copy of a field in an editor, you can do that without backing out so to say.

Thx!


(This post was edited by sublmnl on Feb 26, 2011, 9:16 PM)


s2smedia
User

Dec 19, 2011, 9:34 AM

Post #13 of 16 (1790 views)
Shortcut
Re: [sublmnl] Duplicating records? [In reply to] Can't Post

How do you install this plugin?


sublmnl
User

Dec 19, 2011, 10:38 AM

Post #14 of 16 (1787 views)
Shortcut
Re: [s2smedia] Duplicating records? [In reply to] Can't Post

It goes in your plugins folder in the cmsAdmin directory on the server. Then log into the general settings / plugins and you have to 'turn it on' by activating it. I do know it only works with certain versions up. Can't remember the number off the top of my head though.
hope that helps


s2smedia
User

Dec 19, 2011, 11:00 AM

Post #15 of 16 (1781 views)
Shortcut
Re: [sublmnl] Duplicating records? [In reply to] Can't Post

thanks.. i have the most recent beta 2.14

what do I do with the css file thats in the plugin download folder?


Jason
Staff / Moderator


Dec 20, 2011, 11:59 AM

Post #16 of 16 (1758 views)
Shortcut
Re: [s2smedia] Duplicating records? [In reply to] Can't Post

Hi,

There shouldn't be any CSS files that come with the plugin. You should be able to upload the entire folder to the cmsAdmin/plugins folder, then activate the plugin through CMS Builder.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/