Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
gravitypad  
#1 Posted : Thursday, February 16, 2017 10:20:08 PM(UTC)
gravitypad

Rank: Member

Groups: Member
Joined: 5/18/2016(UTC)
Posts: 11

I'd like to be able to load a PSD template into the editor and allow administrative users to customize all of the layers. However, if the user is not an administrator, I'd like to lock certain layers of the same PSD template. Is this possible?
Kate D.  
#2 Posted : Thursday, February 23, 2017 3:38:35 AM(UTC)
Kate D.

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 10/20/2015(UTC)
Posts: 52

Was thanked: 14 time(s) in 13 post(s)
Originally Posted by: gravitypad Go to Quoted Post
I'd like to be able to load a PSD template into the editor and allow administrative users to customize all of the layers. However, if the user is not an administrator, I'd like to lock certain layers of the same PSD template. Is this possible?


Hi Paul,

Sorry for the delay!

Unfortunately, such a method is absent in our public API. However, you can implement it using our internal API.

If you are interested in this feature, I can create the code snippet for you.

Best regards,
Kate
gravitypad  
#3 Posted : Thursday, February 23, 2017 8:28:02 AM(UTC)
gravitypad

Rank: Member

Groups: Member
Joined: 5/18/2016(UTC)
Posts: 11

Hi Kate,

Yes, I'll take you up on your offer for a code snippet. Thanks for the help.

Paul
Kate D.  
#4 Posted : Monday, February 27, 2017 1:04:40 AM(UTC)
Kate D.

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 10/20/2015(UTC)
Posts: 52

Was thanked: 14 time(s) in 13 post(s)
Originally Posted by: gravitypad Go to Quoted Post
Hi Kate,

Yes, I'll take you up on your offer for a code snippet. Thanks for the help.

Paul


Hi Paul,

Please find the code snippet below:
Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Simplest Design Page</title>
    <!-- Don't remove id from this <script> tag! -->
    <script id="CcIframeApiScript" src="https://h2.customerscanvas.com/Users/1eb784e7-0c9b-4f9b-9ac0-f801c8834977/SimplePolygraphy/Resources/SPEditor/Scripts/IFrame/IframeApi.js"></script>
    <script>
    //Defining product.  
    var emptyProduct = {
       surfaces: ["BusinessCard2_side1", "BusinessCard2_side2"]
    };

    document.addEventListener("DOMContentLoaded", function(event) { 

        //Getting the iframe element to display the editor into.
        var iframe = document.getElementById("editorFrame");
        //Loading the editor.
        CustomersCanvas.IframeApi.loadEditor(iframe, emptyProduct, {
            restoreProductOnReloadEnabled: false,
            safetyLinesCheckboxEnabled: true,
			widgets: {ObjectInspector: {safetyLineViolationWarningEnabled: false}}
        })
            .then(function(e){
                
                // Starting the unlocking code in the context of the iframe.
                e.eval(() => {
					var app = window["spEditor"];
					if (app.configuration.userId === "admin_user") {
						var items = app.productHandler.getAllItems();
						items.forEach(i => { i.locked = false });
						app.productHandler.getProductUpdateEvent().fire();
						app.productHandler.updateView();
					}
				});       
            })
            .catch(function(msg){
                console.log(msg);
            });        
    });
    </script>
    <head>
        <body>
            <iframe id="editorFrame" width="100%" height="600px"></iframe>
        </body>
	</head>
</html>


Please let me know if you need any clarifications.

Best regards,
Kate

Edited by user Monday, February 27, 2017 1:05:47 AM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.